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