Blender  V3.3
Macros | Typedefs | Enumerations | Functions
IMB_thumbs.h File Reference

Go to the source code of this file.

Macros

#define THUMB_SIZE_MAX   (100 * 1024 * 1024)
 
#define PREVIEW_RENDER_DEFAULT_HEIGHT   128
 
#define PREVIEW_RENDER_LARGE_HEIGHT   256
 
#define THUMB_DEFAULT_HASH   "00000000000000000000000000000000"
 

Typedefs

typedef enum ThumbSize ThumbSize
 
typedef enum ThumbSource ThumbSource
 

Enumerations

enum  ThumbSize { THB_NORMAL , THB_LARGE , THB_FAIL }
 
enum  ThumbSource { THB_SOURCE_IMAGE , THB_SOURCE_MOVIE , THB_SOURCE_BLEND , THB_SOURCE_FONT }
 

Functions

struct ImBufIMB_thumb_create (const char *filepath, ThumbSize size, ThumbSource source, struct ImBuf *img)
 
struct ImBufIMB_thumb_read (const char *filepath, ThumbSize size)
 
void IMB_thumb_delete (const char *filepath, ThumbSize size)
 
struct ImBufIMB_thumb_manage (const char *filepath, ThumbSize size, ThumbSource source)
 
void IMB_thumb_makedirs (void)
 
struct ImBufIMB_thumb_load_blend (const char *blen_path, const char *blen_group, const char *blen_id)
 
struct ImBufIMB_thumb_load_font (const char *filepath, unsigned int x, unsigned int y)
 
bool IMB_thumb_load_font_get_hash (char *r_hash)
 
void IMB_thumb_clear_translations (void)
 
void IMB_thumb_ensure_translations (void)
 
void IMB_thumb_locks_acquire (void)
 
void IMB_thumb_locks_release (void)
 
void IMB_thumb_path_lock (const char *path)
 
void IMB_thumb_path_unlock (const char *path)
 

Macro Definition Documentation

◆ PREVIEW_RENDER_DEFAULT_HEIGHT

#define PREVIEW_RENDER_DEFAULT_HEIGHT   128

Definition at line 40 of file IMB_thumbs.h.

◆ PREVIEW_RENDER_LARGE_HEIGHT

#define PREVIEW_RENDER_LARGE_HEIGHT   256

Definition at line 41 of file IMB_thumbs.h.

◆ THUMB_DEFAULT_HASH

#define THUMB_DEFAULT_HASH   "00000000000000000000000000000000"

Note this can also be used as versioning system, to force refreshing all thumbnails if e.g. we change some thumb generating code or so. Only used by fonts so far.

Definition at line 48 of file IMB_thumbs.h.

◆ THUMB_SIZE_MAX

#define THUMB_SIZE_MAX   (100 * 1024 * 1024)

Don't generate thumbs for images bigger than this (100mb).

Definition at line 38 of file IMB_thumbs.h.

Typedef Documentation

◆ ThumbSize

typedef enum ThumbSize ThumbSize

Thumbnail creation and retrieval according to the 'Thumbnail Management Standard' supported by Gimp, Gnome (Nautilus), KDE etc. Reference: http://jens.triq.net/thumbnail-spec/index.html

◆ ThumbSource

typedef enum ThumbSource ThumbSource

Enumeration Type Documentation

◆ ThumbSize

enum ThumbSize

Thumbnail creation and retrieval according to the 'Thumbnail Management Standard' supported by Gimp, Gnome (Nautilus), KDE etc. Reference: http://jens.triq.net/thumbnail-spec/index.html

Enumerator
THB_NORMAL 
THB_LARGE 
THB_FAIL 

Definition at line 22 of file IMB_thumbs.h.

◆ ThumbSource

Enumerator
THB_SOURCE_IMAGE 
THB_SOURCE_MOVIE 
THB_SOURCE_BLEND 
THB_SOURCE_FONT 

Definition at line 28 of file IMB_thumbs.h.

Function Documentation

◆ IMB_thumb_clear_translations()

void IMB_thumb_clear_translations ( void  )

Definition at line 30 of file thumbs_font.c.

References ARRAY_SIZE, i18n_thumb_str, NULL, and thumb_str.

Referenced by BLT_lang_set(), and WM_init().

◆ IMB_thumb_create()

struct ImBuf* IMB_thumb_create ( const char *  filepath,
ThumbSize  size,
ThumbSource  source,
struct ImBuf img 
)

Create thumbnail for file and returns new imbuf for thumbnail.

Definition at line 468 of file thumbs.c.

References NULL, size(), thumb_create_ex(), THUMB_DEFAULT_HASH, thumbname_from_uri(), uri_from_filename(), and URI_MAX.

Referenced by wm_file_write().

◆ IMB_thumb_delete()

void IMB_thumb_delete ( const char *  filepath,
ThumbSize  size 
)

Delete all thumbs for the file.

Definition at line 498 of file thumbs.c.

References BLI_delete(), BLI_exists(), BLI_path_ncmp, FILE_MAX, size(), thumbpath_from_uri(), uri_from_filename(), and URI_MAX.

Referenced by IMB_thumb_manage(), and wm_file_write().

◆ IMB_thumb_ensure_translations()

void IMB_thumb_ensure_translations ( void  )

◆ IMB_thumb_load_blend()

struct ImBuf* IMB_thumb_load_blend ( const char *  blen_path,
const char *  blen_group,
const char *  blen_id 
)

Special function for loading a thumbnail embedded into a blend file.

Definition at line 67 of file thumbs_blend.c.

References imb_thumb_load_from_blend_id(), and imb_thumb_load_from_blendfile().

Referenced by thumb_create_ex().

◆ IMB_thumb_load_font()

struct ImBuf* IMB_thumb_load_font ( const char *  filepath,
unsigned int  x,
unsigned int  y 
)

Special function for previewing fonts.

Definition at line 44 of file thumbs_font.c.

References ARRAY_SIZE, BLF_thumb_preview(), ImBuf::channels, i18n_thumb_str, IB_metadata, IB_rect, IMB_allocImBuf(), IMB_rectfill(), ImBuf::rect, thumb_str, x, ImBuf::x, y, and ImBuf::y.

Referenced by thumb_create_ex().

◆ IMB_thumb_load_font_get_hash()

bool IMB_thumb_load_font_get_hash ( char *  r_hash)

◆ IMB_thumb_locks_acquire()

void IMB_thumb_locks_acquire ( void  )

◆ IMB_thumb_locks_release()

void IMB_thumb_locks_release ( void  )

◆ IMB_thumb_makedirs()

void IMB_thumb_makedirs ( void  )

Create the necessary directories to store the thumbnails.

Definition at line 288 of file thumbs.c.

References BLI_dir_create_recursive(), FILE_MAX, get_thumb_dir(), THB_FAIL, THB_LARGE, and THB_NORMAL.

Referenced by ED_file_init().

◆ IMB_thumb_manage()

struct ImBuf* IMB_thumb_manage ( const char *  filepath,
ThumbSize  size,
ThumbSource  source 
)

◆ IMB_thumb_path_lock()

void IMB_thumb_path_lock ( const char *  path)

◆ IMB_thumb_path_unlock()

void IMB_thumb_path_unlock ( const char *  path)

◆ IMB_thumb_read()

struct ImBuf* IMB_thumb_read ( const char *  filepath,
ThumbSize  size 
)

Read thumbnail for file and returns new imbuf for thumbnail.

Definition at line 482 of file thumbs.c.

References FILE_MAX, IB_metadata, IB_rect, IMB_loadiffname(), NULL, size(), thumbpath_from_uri(), uri_from_filename(), and URI_MAX.

Referenced by filelist_cache_preview_runf().