Blender  V2.59
IMB_filetype.h
Go to the documentation of this file.
00001 /*
00002  * $Id: IMB_filetype.h 35239 2011-02-27 20:23:21Z jesterking $
00003  *
00004  * ***** BEGIN GPL LICENSE BLOCK *****
00005  *
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License
00008  * as published by the Free Software Foundation; either version 2
00009  * of the License, or (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software Foundation,
00018  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00019  *
00020  * Contributor(s): Blender Foundation 2010.
00021  *
00022  * ***** END GPL LICENSE BLOCK *****
00023  */
00024 
00030 #ifndef IMB_FILETYPE_H
00031 #define IMB_FILETYPE_H
00032 
00033 /* Generic File Type */
00034 
00035 struct ImBuf;
00036 
00037 #define IM_FTYPE_FLOAT  1
00038 
00039 typedef struct ImFileType {
00040         void (*init)(void);
00041         void (*exit)(void);
00042 
00043         int (*is_a)(unsigned char *buf);
00044         int (*ftype)(struct ImFileType *type, struct ImBuf *ibuf);
00045         struct ImBuf *(*load)(unsigned char *mem, size_t size, int flags);
00046         int (*save)(struct ImBuf *ibuf, const char *name, int flags);
00047         void (*load_tile)(struct ImBuf *ibuf, unsigned char *mem, size_t size, int tx, int ty, unsigned int *rect);
00048 
00049         int flag;
00050         int filetype;
00051 } ImFileType;
00052 
00053 extern ImFileType IMB_FILE_TYPES[];
00054 
00055 void imb_filetypes_init(void);
00056 void imb_filetypes_exit(void);
00057 
00058 void imb_tile_cache_init(void);
00059 void imb_tile_cache_exit(void);
00060 
00061 void imb_loadtile(struct ImBuf *ibuf, int tx, int ty, unsigned int *rect);
00062 void imb_tile_cache_tile_free(struct ImBuf *ibuf, int tx, int ty);
00063 
00064 /* Type Specific Functions */
00065 
00066 /* png */
00067 int imb_is_a_png(unsigned char *buf);
00068 struct ImBuf *imb_loadpng(unsigned char *mem, size_t size, int flags);
00069 int imb_savepng(struct ImBuf *ibuf, const char *name, int flags);
00070 
00071 /* targa */
00072 int imb_is_a_targa(unsigned char *buf);
00073 struct ImBuf *imb_loadtarga(unsigned char *mem, size_t size, int flags);
00074 int imb_savetarga(struct ImBuf * ibuf, const char *name, int flags);
00075 
00076 /* iris */
00077 int imb_is_a_iris(unsigned char *mem);
00078 struct ImBuf *imb_loadiris(unsigned char *mem, size_t size, int flags);
00079 int imb_saveiris(struct ImBuf * ibuf, const char *name, int flags);
00080 
00081 /* jp2 */
00082 int imb_is_a_jp2(unsigned char *buf);
00083 struct ImBuf *imb_jp2_decode(unsigned char *mem, size_t size, int flags);
00084 int imb_savejp2(struct ImBuf *ibuf, const char *name, int flags);
00085 
00086 /* jpeg */
00087 int imb_is_a_jpeg(unsigned char *mem);
00088 int imb_savejpeg(struct ImBuf *ibuf, const char *name, int flags);
00089 struct ImBuf * imb_load_jpeg (unsigned char * buffer, size_t size, int flags);
00090 
00091 /* bmp */
00092 int imb_is_a_bmp(unsigned char *buf);
00093 struct ImBuf *imb_bmp_decode(unsigned char *mem, size_t size, int flags);
00094 int imb_savebmp(struct ImBuf *ibuf, const char *name, int flags);
00095 
00096 /* cocoa */
00097 struct ImBuf *imb_cocoaLoadImage(unsigned char *mem, size_t size, int flags);
00098 short imb_cocoaSaveImage(struct ImBuf *ibuf, const char *name, int flags);
00099 
00100 /* cineon */
00101 int imb_savecineon(struct ImBuf *buf, const char *name, int flags);
00102 struct ImBuf *imb_loadcineon(unsigned char *mem, size_t size, int flags);
00103 int imb_is_cineon(unsigned char *buf);
00104 
00105 /* dpx */
00106 int imb_save_dpx(struct ImBuf *buf, const char *name, int flags);
00107 struct ImBuf *imb_loaddpx(unsigned char *mem, size_t size, int flags);
00108 int imb_is_dpx(unsigned char *buf);
00109 
00110 /* hdr */
00111 int imb_is_a_hdr(unsigned char *buf);
00112 struct ImBuf *imb_loadhdr(unsigned char *mem, size_t size, int flags);
00113 int imb_savehdr(struct ImBuf * ibuf, const char *name, int flags);
00114 
00115 /* tiff */
00116 void imb_inittiff(void);
00117 int imb_is_a_tiff(unsigned char *buf);
00118 struct ImBuf *imb_loadtiff(unsigned char *mem, size_t size, int flags);
00119 void imb_loadtiletiff(struct ImBuf *ibuf, unsigned char *mem, size_t size,
00120         int tx, int ty, unsigned int *rect);
00121 int imb_savetiff(struct ImBuf *ibuf, const char *name, int flags);
00122 void *libtiff_findsymbol(char *name);
00123 
00124 #endif  /* IMB_FILETYPE_H */
00125