diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-11-13 12:25:21 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-11-13 12:32:15 +0300 |
commit | a8f9a2493915bf9384553b3933593a5296e70a1c (patch) | |
tree | b92994b73297c1f9bb439c1d38dae373985065b7 /source/blender/imbuf/intern/IMB_filetype.h | |
parent | 4a3b26dd5e7fc0fb0d95271859ee7b780add2a88 (diff) |
Cleanup: use IMB_FTYPE_NONE instead of 0 for imbuf format comparison
Image format code checked the file type against an enum except for
zero which is used when the format can't be detected.
Also add doc-strings to some of the image file type callbacks.
Diffstat (limited to 'source/blender/imbuf/intern/IMB_filetype.h')
-rw-r--r-- | source/blender/imbuf/intern/IMB_filetype.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/source/blender/imbuf/intern/IMB_filetype.h b/source/blender/imbuf/intern/IMB_filetype.h index 175d973de9a..c8f6135f330 100644 --- a/source/blender/imbuf/intern/IMB_filetype.h +++ b/source/blender/imbuf/intern/IMB_filetype.h @@ -29,15 +29,26 @@ struct ImBuf; #define IM_FTYPE_FLOAT 1 typedef struct ImFileType { + /** Optional, called once when initializing. */ void (*init)(void); + /** Optional, called once when exiting. */ void (*exit)(void); + /** + * Check if the data matches this file types 'magic', + * \note that this may only read in a small part of the files header, + * see: #IMB_ispic_type for details. + */ bool (*is_a)(const unsigned char *buf, const size_t size); + + /** Load an image from memory. */ struct ImBuf *(*load)(const unsigned char *mem, size_t size, int flags, char colorspace[IM_MAX_SPACE]); + /** Load an image from a file. */ struct ImBuf *(*load_filepath)(const char *filepath, int flags, char colorspace[IM_MAX_SPACE]); + /** Save to a file (or memory if #IB_mem is set in `flags` and the format supports it). */ bool (*save)(struct ImBuf *ibuf, const char *filepath, int flags); void (*load_tile)(struct ImBuf *ibuf, const unsigned char *mem, @@ -47,7 +58,10 @@ typedef struct ImFileType { unsigned int *rect); int flag; + + /** #eImbFileType */ int filetype; + int default_save_role; } ImFileType; |