Blender  V2.93
IMB_filetype.h
Go to the documentation of this file.
1 /*
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.
6  *
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.
11  *
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.
15  */
16 
21 #pragma once
22 
23 #include "IMB_imbuf.h"
24 
25 /* Generic File Type */
26 
27 struct ImBuf;
28 
29 #define IM_FTYPE_FLOAT 1
30 
31 typedef struct ImFileType {
33  void (*init)(void);
35  void (*exit)(void);
36 
42  bool (*is_a)(const unsigned char *buf, const size_t size);
43 
45  struct ImBuf *(*load)(const unsigned char *mem,
46  size_t size,
47  int flags,
48  char colorspace[IM_MAX_SPACE]);
50  struct ImBuf *(*load_filepath)(const char *filepath, int flags, char colorspace[IM_MAX_SPACE]);
52  bool (*save)(struct ImBuf *ibuf, const char *filepath, int flags);
53  void (*load_tile)(struct ImBuf *ibuf,
54  const unsigned char *mem,
55  size_t size,
56  int tx,
57  int ty,
58  unsigned int *rect);
59 
60  int flag;
61 
63  int filetype;
64 
67 
68 extern const ImFileType IMB_FILE_TYPES[];
69 extern const ImFileType *IMB_FILE_TYPES_LAST;
70 
72 const ImFileType *IMB_file_type_from_ibuf(const struct ImBuf *ibuf);
73 
74 void imb_filetypes_init(void);
75 void imb_filetypes_exit(void);
76 
77 void imb_tile_cache_init(void);
78 void imb_tile_cache_exit(void);
79 
80 void imb_loadtile(struct ImBuf *ibuf, int tx, int ty, unsigned int *rect);
81 void imb_tile_cache_tile_free(struct ImBuf *ibuf, int tx, int ty);
82 
83 /* Type Specific Functions */
84 
85 /* png */
86 bool imb_is_a_png(const unsigned char *mem, const size_t size);
87 struct ImBuf *imb_loadpng(const unsigned char *mem,
88  size_t size,
89  int flags,
90  char colorspace[IM_MAX_SPACE]);
91 bool imb_savepng(struct ImBuf *ibuf, const char *filepath, int flags);
92 
93 /* targa */
94 bool imb_is_a_targa(const unsigned char *buf, const size_t size);
95 struct ImBuf *imb_loadtarga(const unsigned char *mem,
96  size_t size,
97  int flags,
98  char colorspace[IM_MAX_SPACE]);
99 bool imb_savetarga(struct ImBuf *ibuf, const char *filepath, int flags);
100 
101 /* iris */
102 bool imb_is_a_iris(const unsigned char *mem, const size_t size);
103 struct ImBuf *imb_loadiris(const unsigned char *mem,
104  size_t size,
105  int flags,
106  char colorspace[IM_MAX_SPACE]);
107 bool imb_saveiris(struct ImBuf *ibuf, const char *filepath, int flags);
108 
109 /* jp2 */
110 bool imb_is_a_jp2(const unsigned char *buf, const size_t size);
111 struct ImBuf *imb_load_jp2(const unsigned char *mem,
112  size_t size,
113  int flags,
114  char colorspace[IM_MAX_SPACE]);
115 struct ImBuf *imb_load_jp2_filepath(const char *filepath,
116  int flags,
117  char colorspace[IM_MAX_SPACE]);
118 bool imb_save_jp2(struct ImBuf *ibuf, const char *filepath, int flags);
119 
120 /* jpeg */
121 bool imb_is_a_jpeg(const unsigned char *mem, const size_t size);
122 bool imb_savejpeg(struct ImBuf *ibuf, const char *filepath, int flags);
123 struct ImBuf *imb_load_jpeg(const unsigned char *buffer,
124  size_t size,
125  int flags,
126  char colorspace[IM_MAX_SPACE]);
127 
128 /* bmp */
129 bool imb_is_a_bmp(const unsigned char *buf, const size_t size);
130 struct ImBuf *imb_bmp_decode(const unsigned char *mem,
131  size_t size,
132  int flags,
133  char colorspace[IM_MAX_SPACE]);
134 bool imb_savebmp(struct ImBuf *ibuf, const char *filepath, int flags);
135 
136 /* cineon */
137 bool imb_is_a_cineon(const unsigned char *buf, const size_t size);
138 bool imb_save_cineon(struct ImBuf *buf, const char *filepath, int flags);
139 struct ImBuf *imb_load_cineon(const unsigned char *mem,
140  size_t size,
141  int flags,
142  char colorspace[IM_MAX_SPACE]);
143 
144 /* dpx */
145 bool imb_is_a_dpx(const unsigned char *buf, const size_t size);
146 bool imb_save_dpx(struct ImBuf *buf, const char *filepath, int flags);
147 struct ImBuf *imb_load_dpx(const unsigned char *mem,
148  size_t size,
149  int flags,
150  char colorspace[IM_MAX_SPACE]);
151 
152 /* hdr */
153 bool imb_is_a_hdr(const unsigned char *buf, const size_t size);
154 struct ImBuf *imb_loadhdr(const unsigned char *mem,
155  size_t size,
156  int flags,
157  char colorspace[IM_MAX_SPACE]);
158 bool imb_savehdr(struct ImBuf *ibuf, const char *filepath, int flags);
159 
160 /* tiff */
161 void imb_inittiff(void);
162 bool imb_is_a_tiff(const unsigned char *buf, const size_t size);
163 struct ImBuf *imb_loadtiff(const unsigned char *mem,
164  size_t size,
165  int flags,
166  char colorspace[IM_MAX_SPACE]);
167 void imb_loadtiletiff(
168  struct ImBuf *ibuf, const unsigned char *mem, size_t size, int tx, int ty, unsigned int *rect);
169 bool imb_savetiff(struct ImBuf *ibuf, const char *filepath, int flags);
void imb_loadtile(struct ImBuf *ibuf, int tx, int ty, unsigned int *rect)
Definition: readimage.c:315
const ImFileType * IMB_file_type_from_ibuf(const struct ImBuf *ibuf)
bool imb_is_a_iris(const unsigned char *mem, const size_t size)
Definition: iris.c:246
bool imb_save_jp2(struct ImBuf *ibuf, const char *filepath, int flags)
Definition: jp2.c:1201
void imb_inittiff(void)
Definition: tiff.c:548
bool imb_saveiris(struct ImBuf *ibuf, const char *filepath, int flags)
Definition: iris.c:977
bool imb_is_a_dpx(const unsigned char *buf, const size_t size)
Definition: cineon_dpx.c:212
struct ImBuf * imb_bmp_decode(const unsigned char *mem, size_t size, int flags, char colorspace[IM_MAX_SPACE])
Definition: bmp.c:121
bool imb_is_a_tiff(const unsigned char *buf, const size_t size)
Definition: tiff.c:319
struct ImBuf * imb_load_jpeg(const unsigned char *buffer, size_t size, int flags, char colorspace[IM_MAX_SPACE])
Definition: jpeg.c:437
bool imb_savepng(struct ImBuf *ibuf, const char *filepath, int flags)
Definition: png.c:126
bool imb_savejpeg(struct ImBuf *ibuf, const char *filepath, int flags)
Definition: jpeg.c:659
struct ImBuf * imb_loadhdr(const unsigned char *mem, size_t size, int flags, char colorspace[IM_MAX_SPACE])
Definition: radiance_hdr.c:218
bool imb_is_a_hdr(const unsigned char *buf, const size_t size)
Definition: radiance_hdr.c:200
bool imb_is_a_jp2(const unsigned char *buf, const size_t size)
Definition: jp2.c:85
bool imb_save_dpx(struct ImBuf *buf, const char *filepath, int flags)
Definition: cineon_dpx.c:207
bool imb_is_a_png(const unsigned char *mem, const size_t size)
Definition: png.c:64
const ImFileType * IMB_file_type_from_ftype(int ftype)
Definition: filetype.c:219
struct ImBuf * imb_loadpng(const unsigned char *mem, size_t size, int flags, char colorspace[IM_MAX_SPACE])
Definition: png.c:540
struct ImBuf * imb_load_jp2(const unsigned char *mem, size_t size, int flags, char colorspace[IM_MAX_SPACE])
Definition: jp2.c:317
struct ImBuf * imb_load_cineon(const unsigned char *mem, size_t size, int flags, char colorspace[IM_MAX_SPACE])
Definition: cineon_dpx.c:196
bool imb_save_cineon(struct ImBuf *buf, const char *filepath, int flags)
Definition: cineon_dpx.c:186
struct ImBuf * imb_loadtiff(const unsigned char *mem, size_t size, int flags, char colorspace[IM_MAX_SPACE])
Definition: tiff.c:564
struct ImBuf * imb_loadiris(const unsigned char *mem, size_t size, int flags, char colorspace[IM_MAX_SPACE])
Definition: iris.c:260
struct ImBuf * imb_load_dpx(const unsigned char *mem, size_t size, int flags, char colorspace[IM_MAX_SPACE])
Definition: cineon_dpx.c:217
bool imb_savehdr(struct ImBuf *ibuf, const char *filepath, int flags)
Definition: radiance_hdr.c:435
const ImFileType IMB_FILE_TYPES[]
Definition: filetype.c:43
void imb_filetypes_init(void)
Definition: filetype.c:234
bool imb_is_a_targa(const unsigned char *buf, const size_t size)
Definition: targa.c:416
void imb_tile_cache_exit(void)
Definition: cache.c:223
bool imb_savetarga(struct ImBuf *ibuf, const char *filepath, int flags)
void imb_tile_cache_tile_free(struct ImBuf *ibuf, int tx, int ty)
Definition: cache.c:157
bool imb_is_a_cineon(const unsigned char *buf, const size_t size)
Definition: cineon_dpx.c:191
void imb_filetypes_exit(void)
Definition: filetype.c:245
const ImFileType * IMB_FILE_TYPES_LAST
Definition: filetype.c:217
bool imb_is_a_bmp(const unsigned char *buf, const size_t size)
Definition: bmp.c:109
bool imb_savetiff(struct ImBuf *ibuf, const char *filepath, int flags)
Definition: tiff.c:761
bool imb_savebmp(struct ImBuf *ibuf, const char *filepath, int flags)
struct ImFileType ImFileType
struct ImBuf * imb_load_jp2_filepath(const char *filepath, int flags, char colorspace[IM_MAX_SPACE])
Definition: jp2.c:336
void imb_tile_cache_init(void)
Definition: cache.c:210
void imb_loadtiletiff(struct ImBuf *ibuf, const unsigned char *mem, size_t size, int tx, int ty, unsigned int *rect)
Definition: tiff.c:689
struct ImBuf * imb_loadtarga(const unsigned char *mem, size_t size, int flags, char colorspace[IM_MAX_SPACE])
Definition: targa.c:628
bool imb_is_a_jpeg(const unsigned char *mem, const size_t size)
Definition: jpeg.c:62
#define IM_MAX_SPACE
Definition: IMB_imbuf.h:65
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition: btDbvt.cpp:52
__kernel void ccl_constant KernelData ccl_global void ccl_global char ccl_global int ccl_global char ccl_global unsigned int ccl_global float * buffer
enum eImbFileType ftype
unsigned int * rect
void(* exit)(void)
Definition: IMB_filetype.h:35
bool(* save)(struct ImBuf *ibuf, const char *filepath, int flags)
Definition: IMB_filetype.h:52
void(* init)(void)
Definition: IMB_filetype.h:33
void(* load_tile)(struct ImBuf *ibuf, const unsigned char *mem, size_t size, int tx, int ty, unsigned int *rect)
Definition: IMB_filetype.h:53
int default_save_role
Definition: IMB_filetype.h:65
bool(* is_a)(const unsigned char *buf, const size_t size)
Definition: IMB_filetype.h:42