2 * This program is free software; you can redistribute it and/or
3 * modify it under the terms of the GNU General Public License
4 * as published by the Free Software Foundation; either version 2
5 * of the License, or (at your option) any later version.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software Foundation,
14 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 * The Original Code is Copyright (C) 2007 Blender Foundation
17 * All rights reserved.
20 /** \file blender/imbuf/IMB_thumbs.h
25 #ifndef __IMB_THUMBS_H__
26 #define __IMB_THUMBS_H__
34 /** Thumbnail creation and retrieval according to the 'Thumbnail Management Standard'
35 * supported by Gimp, Gnome (Nautilus), KDE etc.
36 * Reference: http://jens.triq.net/thumbnail-spec/index.html
40 typedef enum ThumbSize {
46 typedef enum ThumbSource {
53 /* don't generate thumbs for images bigger then this (100mb) */
54 #define THUMB_SIZE_MAX (100 * 1024 * 1024)
56 #define PREVIEW_RENDER_DEFAULT_HEIGHT 128
58 /* Note this can also be used as versioning system,
59 * to force refreshing all thumbnails if e.g. we change some thumb generating code or so.
60 * Only used by fonts so far. */
61 #define THUMB_DEFAULT_HASH "00000000000000000000000000000000"
63 /* create thumbnail for file and returns new imbuf for thumbnail */
64 ImBuf *IMB_thumb_create(const char *path, ThumbSize size, ThumbSource source, ImBuf *ibuf);
66 /* read thumbnail for file and returns new imbuf for thumbnail */
67 ImBuf *IMB_thumb_read(const char *path, ThumbSize size);
69 /* delete all thumbs for the file */
70 void IMB_thumb_delete(const char *path, ThumbSize size);
72 /* return the state of the thumb, needed to determine how to manage the thumb */
73 ImBuf *IMB_thumb_manage(const char *path, ThumbSize size, ThumbSource source);
75 /* create the necessary dirs to store the thumbnails */
76 void IMB_thumb_makedirs(void);
78 /* special function for loading a thumbnail embedded into a blend file */
79 ImBuf *IMB_thumb_load_blend(const char *blen_path, const char *blen_group, const char *blen_id);
80 void IMB_thumb_overlay_blend(unsigned int *thumb, int width, int height, float aspect);
82 /* special function for previewing fonts */
83 ImBuf *IMB_thumb_load_font(const char *filename, unsigned int x, unsigned int y);
84 bool IMB_thumb_load_font_get_hash(char *r_hash);
87 void IMB_thumb_locks_acquire(void);
88 void IMB_thumb_locks_release(void);
89 void IMB_thumb_path_lock(const char *path);
90 void IMB_thumb_path_unlock(const char *path);
94 #endif /* __cplusplus */
96 #endif /* __IMB_THUMBS_H__ */