|
Blender V2.27
|
00001 /* 00002 * $Id: filetype.c 32532 2010-10-17 06:38:56Z campbellbarton $ 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 00025 #include <stddef.h> 00026 #include "IMB_imbuf.h" 00027 #include "IMB_imbuf_types.h" 00028 #include "IMB_filetype.h" 00029 00030 #ifdef WITH_OPENEXR 00031 #include "openexr/openexr_api.h" 00032 #endif 00033 00034 #ifdef WITH_DDS 00035 #include "dds/dds_api.h" 00036 #endif 00037 00038 #ifdef WITH_QUICKTIME 00039 #include "quicktime_import.h" 00040 #endif 00041 00042 #include "imbuf.h" 00043 00044 static int imb_ftype_default(ImFileType *type, ImBuf *ibuf) { return (ibuf->ftype & type->filetype); } 00045 #if defined(__APPLE__) && defined(IMBUF_COCOA) 00046 static int imb_ftype_cocoa(ImFileType *type, ImBuf *ibuf) { return (ibuf->ftype & TIF); } 00047 #endif 00048 static int imb_ftype_iris(ImFileType *type, ImBuf *ibuf) { (void)type; return (ibuf->ftype == IMAGIC); } 00049 #ifdef WITH_QUICKTIME 00050 static int imb_ftype_quicktime(ImFileType *type, ImBuf *ibuf) { return 0; } // XXX 00051 #endif 00052 00053 #ifdef WITH_QUICKTIME 00054 void quicktime_init(void); 00055 void quicktime_exit(void); 00056 #endif 00057 00058 ImFileType IMB_FILE_TYPES[]= { 00059 {NULL, NULL, imb_is_a_iris, imb_ftype_iris, imb_loadiris, imb_saveiris, NULL, 0, IMAGIC}, 00060 {NULL, NULL, imb_is_a_jpeg, imb_ftype_default, imb_load_jpeg, imb_savejpeg, NULL, 0, JPG}, 00061 {NULL, NULL, imb_is_a_png, imb_ftype_default, imb_loadpng, imb_savepng, NULL, 0, PNG}, 00062 {NULL, NULL, imb_is_a_bmp, imb_ftype_default, imb_bmp_decode, imb_savebmp, NULL, 0, BMP}, 00063 {NULL, NULL, imb_is_a_targa, imb_ftype_default, imb_loadtarga, imb_savetarga, NULL, 0, TGA}, 00064 #ifdef WITH_CINEON 00065 {NULL, NULL, imb_is_dpx, imb_ftype_default, imb_loaddpx, imb_save_dpx, NULL, IM_FTYPE_FLOAT, DPX}, 00066 {NULL, NULL, imb_is_cineon, imb_ftype_default, imb_loadcineon, imb_savecineon, NULL, IM_FTYPE_FLOAT, CINEON}, 00067 #endif 00068 #ifdef WITH_TIFF 00069 {imb_inittiff, NULL, imb_is_a_tiff, imb_ftype_default, imb_loadtiff, imb_savetiff, imb_loadtiletiff, 0, TIF}, 00070 #elif defined(__APPLE__) && defined(IMBUF_COCOA) 00071 {NULL, NULL, imb_is_a_cocoa, imb_ftype_cocoa, imb_imb_cocoaLoadImage, imb_savecocoa, NULL, 0, TIF}, 00072 #endif 00073 #ifdef WITH_HDR 00074 {NULL, NULL, imb_is_a_hdr, imb_ftype_default, imb_loadhdr, imb_savehdr, NULL, IM_FTYPE_FLOAT, RADHDR}, 00075 #endif 00076 #ifdef WITH_OPENEXR 00077 {NULL, NULL, imb_is_a_openexr, imb_ftype_default, imb_load_openexr, imb_save_openexr, NULL, IM_FTYPE_FLOAT, OPENEXR}, 00078 #endif 00079 #ifdef WITH_OPENJPEG 00080 {NULL, NULL, imb_is_a_jp2, imb_ftype_default, imb_jp2_decode, imb_savejp2, NULL, IM_FTYPE_FLOAT, JP2}, 00081 #endif 00082 #ifdef WITH_DDS 00083 {NULL, NULL, imb_is_a_dds, imb_ftype_default, imb_load_dds, NULL, NULL, 0, DDS}, 00084 #endif 00085 #ifdef WITH_QUICKTIME 00086 {quicktime_init, quicktime_exit, imb_is_a_quicktime, imb_ftype_quicktime, imb_quicktime_decode, NULL, NULL, 0, QUICKTIME}, 00087 #endif 00088 {NULL, NULL, NULL, NULL, NULL, NULL, 0}}; 00089 00090 void imb_filetypes_init(void) 00091 { 00092 ImFileType *type; 00093 00094 for(type=IMB_FILE_TYPES; type->is_a; type++) 00095 if(type->init) 00096 type->init(); 00097 } 00098 00099 void imb_filetypes_exit(void) 00100 { 00101 ImFileType *type; 00102 00103 for(type=IMB_FILE_TYPES; type->is_a; type++) 00104 if(type->exit) 00105 type->exit(); 00106 } 00107
1.7.3