From 743d2f8c0f4359eef120eab4db7bfe00b5185e05 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 22 Nov 2011 00:35:26 +0000 Subject: rename image type defines to be less ambiguous, also set BMP as not supporting alpha (it reads but cant write) --- source/blender/blenkernel/intern/dynamicpaint.c | 6 +- source/blender/blenkernel/intern/image.c | 172 ++++++++++++------------ source/blender/blenkernel/intern/ocean.c | 6 +- source/blender/blenkernel/intern/scene.c | 2 +- source/blender/blenkernel/intern/writeavi.c | 10 +- source/blender/blenkernel/intern/writeffmpeg.c | 8 +- 6 files changed, 102 insertions(+), 102 deletions(-) (limited to 'source/blender/blenkernel/intern') diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c index 36ae764198a..d31dad8f8fa 100644 --- a/source/blender/blenkernel/intern/dynamicpaint.c +++ b/source/blender/blenkernel/intern/dynamicpaint.c @@ -2527,13 +2527,13 @@ void dynamicPaint_outputSurfaceImage(DynamicPaintSurface *surface, char* filenam PaintSurfaceData *sData = surface->data; ImgSeqFormatData *f_data = (ImgSeqFormatData*)sData->format_data; /* OpenEXR or PNG */ - int format = (surface->image_fileformat & MOD_DPAINT_IMGFORMAT_OPENEXR) ? R_OPENEXR : R_PNG; + int format = (surface->image_fileformat & MOD_DPAINT_IMGFORMAT_OPENEXR) ? R_IMF_IMTYPE_OPENEXR : R_IMF_IMTYPE_PNG; char output_file[FILE_MAX]; if (!sData || !sData->type_data) {setError(surface->canvas, "Image save failed: Invalid surface.");return;} /* if selected format is openexr, but current build doesnt support one */ #ifndef WITH_OPENEXR - if (format == R_OPENEXR) format = R_PNG; + if (format == R_IMF_IMTYPE_OPENEXR) format = R_IMF_IMTYPE_PNG; #endif BLI_strncpy(output_file, filename, sizeof(output_file)); BKE_add_image_extension(output_file, format); @@ -2622,7 +2622,7 @@ void dynamicPaint_outputSurfaceImage(DynamicPaintSurface *surface, char* filenam /* Set output format, png in case exr isnt supported */ ibuf->ftype= PNG|95; #ifdef WITH_OPENEXR - if (format == R_OPENEXR) { /* OpenEXR 32-bit float */ + if (format == R_IMF_IMTYPE_OPENEXR) { /* OpenEXR 32-bit float */ ibuf->ftype = OPENEXR | OPENEXR_COMPRESS; } #endif diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index c98c973789d..ef764f2394d 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -802,38 +802,38 @@ void BKE_image_all_free_anim_ibufs(int cfra) int BKE_imtype_to_ftype(const char imtype) { - if(imtype==R_TARGA) + if(imtype==R_IMF_IMTYPE_TARGA) return TGA; - else if(imtype==R_RAWTGA) + else if(imtype==R_IMF_IMTYPE_RAWTGA) return RAWTGA; - else if(imtype== R_IRIS) + else if(imtype== R_IMF_IMTYPE_IRIS) return IMAGIC; #ifdef WITH_HDR - else if (imtype==R_RADHDR) + else if (imtype==R_IMF_IMTYPE_RADHDR) return RADHDR; #endif - else if (imtype==R_PNG) + else if (imtype==R_IMF_IMTYPE_PNG) return PNG; #ifdef WITH_DDS - else if (imtype==R_DDS) + else if (imtype==R_IMF_IMTYPE_DDS) return DDS; #endif - else if (imtype==R_BMP) + else if (imtype==R_IMF_IMTYPE_BMP) return BMP; #ifdef WITH_TIFF - else if (imtype==R_TIFF) + else if (imtype==R_IMF_IMTYPE_TIFF) return TIF; #endif - else if (imtype==R_OPENEXR || imtype==R_MULTILAYER) + else if (imtype==R_IMF_IMTYPE_OPENEXR || imtype==R_IMF_IMTYPE_MULTILAYER) return OPENEXR; #ifdef WITH_CINEON - else if (imtype==R_CINEON) + else if (imtype==R_IMF_IMTYPE_CINEON) return CINEON; - else if (imtype==R_DPX) + else if (imtype==R_IMF_IMTYPE_DPX) return DPX; #endif #ifdef WITH_OPENJPEG - else if(imtype==R_JP2) + else if(imtype==R_IMF_IMTYPE_JP2) return JP2; #endif else @@ -843,58 +843,58 @@ int BKE_imtype_to_ftype(const char imtype) char BKE_ftype_to_imtype(const int ftype) { if(ftype==0) - return R_TARGA; + return R_IMF_IMTYPE_TARGA; else if(ftype == IMAGIC) - return R_IRIS; + return R_IMF_IMTYPE_IRIS; #ifdef WITH_HDR else if (ftype & RADHDR) - return R_RADHDR; + return R_IMF_IMTYPE_RADHDR; #endif else if (ftype & PNG) - return R_PNG; + return R_IMF_IMTYPE_PNG; #ifdef WITH_DDS else if (ftype & DDS) - return R_DDS; + return R_IMF_IMTYPE_DDS; #endif else if (ftype & BMP) - return R_BMP; + return R_IMF_IMTYPE_BMP; #ifdef WITH_TIFF else if (ftype & TIF) - return R_TIFF; + return R_IMF_IMTYPE_TIFF; #endif else if (ftype & OPENEXR) - return R_OPENEXR; + return R_IMF_IMTYPE_OPENEXR; #ifdef WITH_CINEON else if (ftype & CINEON) - return R_CINEON; + return R_IMF_IMTYPE_CINEON; else if (ftype & DPX) - return R_DPX; + return R_IMF_IMTYPE_DPX; #endif else if (ftype & TGA) - return R_TARGA; + return R_IMF_IMTYPE_TARGA; else if(ftype & RAWTGA) - return R_RAWTGA; + return R_IMF_IMTYPE_RAWTGA; #ifdef WITH_OPENJPEG else if(ftype & JP2) - return R_JP2; + return R_IMF_IMTYPE_JP2; #endif else - return R_JPEG90; + return R_IMF_IMTYPE_JPEG90; } int BKE_imtype_is_movie(const char imtype) { switch(imtype) { - case R_AVIRAW: - case R_AVIJPEG: - case R_AVICODEC: - case R_QUICKTIME: - case R_FFMPEG: - case R_H264: - case R_THEORA: - case R_XVID: - case R_FRAMESERVER: + case R_IMF_IMTYPE_AVIRAW: + case R_IMF_IMTYPE_AVIJPEG: + case R_IMF_IMTYPE_AVICODEC: + case R_IMF_IMTYPE_QUICKTIME: + case R_IMF_IMTYPE_FFMPEG: + case R_IMF_IMTYPE_H264: + case R_IMF_IMTYPE_THEORA: + case R_IMF_IMTYPE_XVID: + case R_IMF_IMTYPE_FRAMESERVER: return 1; } return 0; @@ -903,16 +903,16 @@ int BKE_imtype_is_movie(const char imtype) int BKE_imtype_supports_alpha(const char imtype) { switch(imtype) { - case R_TARGA: - case R_IRIS: - case R_PNG: - case R_BMP: - case R_RADHDR: - case R_TIFF: - case R_OPENEXR: - case R_MULTILAYER: - case R_DDS: - case R_JP2: + case R_IMF_IMTYPE_TARGA: + case R_IMF_IMTYPE_IRIS: + case R_IMF_IMTYPE_PNG: + /* case R_IMF_IMTYPE_BMP: */ /* read but not write */ + case R_IMF_IMTYPE_RADHDR: + case R_IMF_IMTYPE_TIFF: + case R_IMF_IMTYPE_OPENEXR: + case R_IMF_IMTYPE_MULTILAYER: + case R_IMF_IMTYPE_DDS: + case R_IMF_IMTYPE_JP2: return 1; } return 0; @@ -921,8 +921,8 @@ int BKE_imtype_supports_alpha(const char imtype) int BKE_imtype_supports_zbuf(const char imtype) { switch(imtype) { - case R_IRIZ: - case R_OPENEXR: /* but not R_MULTILAYER */ + case R_IMF_IMTYPE_IRIZ: + case R_IMF_IMTYPE_OPENEXR: /* but not R_IMF_IMTYPE_MULTILAYER */ return 1; } return 0; @@ -931,7 +931,7 @@ int BKE_imtype_supports_zbuf(const char imtype) int BKE_imtype_supports_compress(const char imtype) { switch(imtype) { - case R_PNG: + case R_IMF_IMTYPE_PNG: return 1; } return 0; @@ -940,9 +940,9 @@ int BKE_imtype_supports_compress(const char imtype) int BKE_imtype_supports_quality(const char imtype) { switch(imtype) { - case R_JPEG90: - case R_JP2: - case R_AVIJPEG: + case R_IMF_IMTYPE_JPEG90: + case R_IMF_IMTYPE_JP2: + case R_IMF_IMTYPE_AVIJPEG: return 1; } return 0; @@ -951,19 +951,19 @@ int BKE_imtype_supports_quality(const char imtype) char BKE_imtype_valid_depths(const char imtype) { switch (imtype) { - case R_RADHDR: + case R_IMF_IMTYPE_RADHDR: return R_IMF_CHAN_DEPTH_32; - case R_TIFF: + case R_IMF_IMTYPE_TIFF: return R_IMF_CHAN_DEPTH_8 | R_IMF_CHAN_DEPTH_16; - case R_OPENEXR: + case R_IMF_IMTYPE_OPENEXR: return R_IMF_CHAN_DEPTH_16 | R_IMF_CHAN_DEPTH_32; - case R_MULTILAYER: + case R_IMF_IMTYPE_MULTILAYER: return R_IMF_CHAN_DEPTH_32; /* eeh, cineone does some strange 10bits per channel */ - case R_DPX: - case R_CINEON: + case R_IMF_IMTYPE_DPX: + case R_IMF_IMTYPE_CINEON: return R_IMF_CHAN_DEPTH_12; - case R_JP2: + case R_IMF_IMTYPE_JP2: return R_IMF_CHAN_DEPTH_8 | R_IMF_CHAN_DEPTH_12 | R_IMF_CHAN_DEPTH_16; /* most formats are 8bit only */ default: @@ -975,71 +975,71 @@ int BKE_add_image_extension(char *string, const char imtype) { const char *extension= NULL; - if(imtype== R_IRIS) { + if(imtype== R_IMF_IMTYPE_IRIS) { if(!BLI_testextensie(string, ".rgb")) extension= ".rgb"; } - else if(imtype==R_IRIZ) { + else if(imtype==R_IMF_IMTYPE_IRIZ) { if(!BLI_testextensie(string, ".rgb")) extension= ".rgb"; } #ifdef WITH_HDR - else if(imtype==R_RADHDR) { + else if(imtype==R_IMF_IMTYPE_RADHDR) { if(!BLI_testextensie(string, ".hdr")) extension= ".hdr"; } #endif - else if (ELEM5(imtype, R_PNG, R_FFMPEG, R_H264, R_THEORA, R_XVID)) { + else if (ELEM5(imtype, R_IMF_IMTYPE_PNG, R_IMF_IMTYPE_FFMPEG, R_IMF_IMTYPE_H264, R_IMF_IMTYPE_THEORA, R_IMF_IMTYPE_XVID)) { if(!BLI_testextensie(string, ".png")) extension= ".png"; } #ifdef WITH_DDS - else if(imtype==R_DDS) { + else if(imtype==R_IMF_IMTYPE_DDS) { if(!BLI_testextensie(string, ".dds")) extension= ".dds"; } #endif - else if(imtype==R_RAWTGA) { + else if(imtype==R_IMF_IMTYPE_RAWTGA) { if(!BLI_testextensie(string, ".tga")) extension= ".tga"; } - else if(imtype==R_BMP) { + else if(imtype==R_IMF_IMTYPE_BMP) { if(!BLI_testextensie(string, ".bmp")) extension= ".bmp"; } #ifdef WITH_TIFF - else if(imtype==R_TIFF) { + else if(imtype==R_IMF_IMTYPE_TIFF) { if(!BLI_testextensie(string, ".tif") && !BLI_testextensie(string, ".tiff")) extension= ".tif"; } #endif #ifdef WITH_OPENEXR - else if( ELEM(imtype, R_OPENEXR, R_MULTILAYER)) { + else if( ELEM(imtype, R_IMF_IMTYPE_OPENEXR, R_IMF_IMTYPE_MULTILAYER)) { if(!BLI_testextensie(string, ".exr")) extension= ".exr"; } #endif #ifdef WITH_CINEON - else if(imtype==R_CINEON){ + else if(imtype==R_IMF_IMTYPE_CINEON){ if (!BLI_testextensie(string, ".cin")) extension= ".cin"; } - else if(imtype==R_DPX){ + else if(imtype==R_IMF_IMTYPE_DPX){ if (!BLI_testextensie(string, ".dpx")) extension= ".dpx"; } #endif - else if(imtype==R_TARGA) { + else if(imtype==R_IMF_IMTYPE_TARGA) { if(!BLI_testextensie(string, ".tga")) extension= ".tga"; } #ifdef WITH_OPENJPEG - else if(imtype==R_JP2) { + else if(imtype==R_IMF_IMTYPE_JP2) { if(!BLI_testextensie(string, ".jp2")) extension= ".jp2"; } #endif - else { // R_AVICODEC, R_AVIRAW, R_AVIJPEG, R_JPEG90, R_QUICKTIME etc + else { // R_IMF_IMTYPE_AVICODEC, R_IMF_IMTYPE_AVIRAW, R_IMF_IMTYPE_AVIJPEG, R_IMF_IMTYPE_JPEG90, R_IMF_IMTYPE_QUICKTIME etc if(!( BLI_testextensie(string, ".jpg") || BLI_testextensie(string, ".jpeg"))) extension= ".jpg"; } @@ -1453,31 +1453,31 @@ int BKE_write_ibuf(ImBuf *ibuf, const char *name, ImageFormatData *imf) if(imtype == -1) { /* use whatever existing image type is set by 'ibuf' */ } - else if(imtype== R_IRIS) { + else if(imtype== R_IMF_IMTYPE_IRIS) { ibuf->ftype= IMAGIC; } #ifdef WITH_HDR - else if (imtype==R_RADHDR) { + else if (imtype==R_IMF_IMTYPE_RADHDR) { ibuf->ftype= RADHDR; } #endif - else if (ELEM5(imtype, R_PNG, R_FFMPEG, R_H264, R_THEORA, R_XVID)) { + else if (ELEM5(imtype, R_IMF_IMTYPE_PNG, R_IMF_IMTYPE_FFMPEG, R_IMF_IMTYPE_H264, R_IMF_IMTYPE_THEORA, R_IMF_IMTYPE_XVID)) { ibuf->ftype= PNG; - if(imtype==R_PNG) + if(imtype==R_IMF_IMTYPE_PNG) ibuf->ftype |= compress; } #ifdef WITH_DDS - else if (imtype==R_DDS) { + else if (imtype==R_IMF_IMTYPE_DDS) { ibuf->ftype= DDS; } #endif - else if (imtype==R_BMP) { + else if (imtype==R_IMF_IMTYPE_BMP) { ibuf->ftype= BMP; } #ifdef WITH_TIFF - else if (imtype==R_TIFF) { + else if (imtype==R_IMF_IMTYPE_TIFF) { ibuf->ftype= TIF; if(imf->depth == R_IMF_CHAN_DEPTH_16) @@ -1485,7 +1485,7 @@ int BKE_write_ibuf(ImBuf *ibuf, const char *name, ImageFormatData *imf) } #endif #ifdef WITH_OPENEXR - else if (imtype==R_OPENEXR || imtype==R_MULTILAYER) { + else if (imtype==R_IMF_IMTYPE_OPENEXR || imtype==R_IMF_IMTYPE_MULTILAYER) { ibuf->ftype= OPENEXR; if(imf->depth == R_IMF_CHAN_DEPTH_16) ibuf->ftype |= OPENEXR_HALF; @@ -1497,21 +1497,21 @@ int BKE_write_ibuf(ImBuf *ibuf, const char *name, ImageFormatData *imf) } #endif #ifdef WITH_CINEON - else if (imtype==R_CINEON) { + else if (imtype==R_IMF_IMTYPE_CINEON) { ibuf->ftype = CINEON; } - else if (imtype==R_DPX) { + else if (imtype==R_IMF_IMTYPE_DPX) { ibuf->ftype = DPX; } #endif - else if (imtype==R_TARGA) { + else if (imtype==R_IMF_IMTYPE_TARGA) { ibuf->ftype= TGA; } - else if(imtype==R_RAWTGA) { + else if(imtype==R_IMF_IMTYPE_RAWTGA) { ibuf->ftype= RAWTGA; } #ifdef WITH_OPENJPEG - else if(imtype==R_JP2) { + else if(imtype==R_IMF_IMTYPE_JP2) { if(quality < 10) quality= 90; ibuf->ftype= JP2|quality; @@ -1533,7 +1533,7 @@ int BKE_write_ibuf(ImBuf *ibuf, const char *name, ImageFormatData *imf) } #endif else { - /* R_JPEG90, etc. default we save jpegs */ + /* R_IMF_IMTYPE_JPEG90, etc. default we save jpegs */ if(quality < 10) quality= 90; ibuf->ftype= JPG|quality; if(ibuf->planes==32) ibuf->planes= 24; /* unsupported feature only confuses other s/w */ diff --git a/source/blender/blenkernel/intern/ocean.c b/source/blender/blenkernel/intern/ocean.c index dbcdf5555ab..b8f96fa732d 100644 --- a/source/blender/blenkernel/intern/ocean.c +++ b/source/blender/blenkernel/intern/ocean.c @@ -1018,7 +1018,7 @@ static void cache_filename(char *string, const char *path, const char *relbase, BLI_join_dirfile(cachepath, sizeof(cachepath), path, fname); - BKE_makepicstring(string, cachepath, relbase, frame, R_OPENEXR, 1, TRUE); + BKE_makepicstring(string, cachepath, relbase, frame, R_IMF_IMTYPE_OPENEXR, 1, TRUE); } void BKE_free_ocean_cache(struct OceanCache *och) @@ -1204,9 +1204,9 @@ void BKE_bake_ocean(struct Ocean *o, struct OceanCache *och, void (*update_cb)(v BLI_srand(0); /* setup image format */ - imf.imtype= R_OPENEXR; + imf.imtype= R_IMF_IMTYPE_OPENEXR; imf.depth= R_IMF_CHAN_DEPTH_16; - imf.exr_codec= 2; /* ZIP */ + imf.exr_codec= R_IMF_EXR_CODEC_ZIP; /* ZIP */ diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index ea0593aba66..b7aa02b2f7b 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -349,7 +349,7 @@ Scene *add_scene(const char *name) sce->r.size= 50; sce->r.im_format.planes= R_IMF_PLANES_RGB; - sce->r.im_format.imtype= R_PNG; + sce->r.im_format.imtype= R_IMF_IMTYPE_PNG; sce->r.im_format.quality= 90; sce->r.displaymode= R_OUTPUT_AREA; diff --git a/source/blender/blenkernel/intern/writeavi.c b/source/blender/blenkernel/intern/writeavi.c index c70d2bdf3de..8cd30912840 100644 --- a/source/blender/blenkernel/intern/writeavi.c +++ b/source/blender/blenkernel/intern/writeavi.c @@ -80,14 +80,14 @@ bMovieHandle *BKE_get_movie_handle(const char imtype) /* do the platform specific handles */ #if defined(_WIN32) && !defined(FREE_WINDOWS) - if (imtype == R_AVICODEC) { + if (imtype == R_IMF_IMTYPE_AVICODEC) { //XXX mh.start_movie= start_avi_codec; //XXX mh.append_movie= append_avi_codec; //XXX mh.end_movie= end_avi_codec; } #endif #ifdef WITH_QUICKTIME - if (imtype == R_QUICKTIME) { + if (imtype == R_IMF_IMTYPE_QUICKTIME) { mh.start_movie= start_qt; mh.append_movie= append_qt; mh.end_movie= end_qt; @@ -95,7 +95,7 @@ bMovieHandle *BKE_get_movie_handle(const char imtype) } #endif #ifdef WITH_FFMPEG - if (ELEM4(imtype, R_FFMPEG, R_H264, R_XVID, R_THEORA)) { + if (ELEM4(imtype, R_IMF_IMTYPE_FFMPEG, R_IMF_IMTYPE_H264, R_IMF_IMTYPE_XVID, R_IMF_IMTYPE_THEORA)) { mh.start_movie = start_ffmpeg; mh.append_movie = append_ffmpeg; mh.end_movie = end_ffmpeg; @@ -103,7 +103,7 @@ bMovieHandle *BKE_get_movie_handle(const char imtype) } #endif #ifdef WITH_FRAMESERVER - if (imtype == R_FRAMESERVER) { + if (imtype == R_IMF_IMTYPE_FRAMESERVER) { mh.start_movie = start_frameserver; mh.append_movie = append_frameserver; mh.end_movie = end_frameserver; @@ -162,7 +162,7 @@ static int start_avi(Scene *scene, RenderData *rd, int rectx, int recty, ReportL /* RPW 11-21-2002 if (rd->imtype != AVI_FORMAT_MJPEG) format = AVI_FORMAT_AVI_RGB; */ - if (rd->im_format.imtype != R_AVIJPEG ) format = AVI_FORMAT_AVI_RGB; + if (rd->im_format.imtype != R_IMF_IMTYPE_AVIJPEG ) format = AVI_FORMAT_AVI_RGB; else format = AVI_FORMAT_MJPEG; if (AVI_open_compress (name, avi, 1, format) != AVI_ERROR_NONE) { diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c index 3af724b4e30..aa7d71b1577 100644 --- a/source/blender/blenkernel/intern/writeffmpeg.c +++ b/source/blender/blenkernel/intern/writeffmpeg.c @@ -1337,7 +1337,7 @@ void ffmpeg_verify_image_type(RenderData *rd) { int audio= 0; - if(rd->imtype == R_FFMPEG) { + if(rd->imtype == R_IMF_IMTYPE_FFMPEG) { if(rd->ffcodecdata.type <= 0 || rd->ffcodecdata.codec <= 0 || rd->ffcodecdata.audio_codec <= 0 || @@ -1353,19 +1353,19 @@ void ffmpeg_verify_image_type(RenderData *rd) audio= 1; } - else if(rd->imtype == R_H264) { + else if(rd->imtype == R_IMF_IMTYPE_H264) { if(rd->ffcodecdata.codec != CODEC_ID_H264) { ffmpeg_set_preset(rd, FFMPEG_PRESET_H264); audio= 1; } } - else if(rd->imtype == R_XVID) { + else if(rd->imtype == R_IMF_IMTYPE_XVID) { if(rd->ffcodecdata.codec != CODEC_ID_MPEG4) { ffmpeg_set_preset(rd, FFMPEG_PRESET_XVID); audio= 1; } } - else if(rd->imtype == R_THEORA) { + else if(rd->imtype == R_IMF_IMTYPE_THEORA) { if(rd->ffcodecdata.codec != CODEC_ID_THEORA) { ffmpeg_set_preset(rd, FFMPEG_PRESET_THEORA); audio= 1; -- cgit v1.2.3