diff options
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/CMakeLists.txt | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/image.c | 24 |
2 files changed, 26 insertions, 2 deletions
diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt index efc9cd6e99f..11dab0ecaad 100644 --- a/source/blender/blenkernel/CMakeLists.txt +++ b/source/blender/blenkernel/CMakeLists.txt @@ -611,6 +611,10 @@ if(WITH_IMAGE_HDR) add_definitions(-DWITH_HDR) endif() +if(WITH_IMAGE_KTX) + add_definitions(-DWITH_KTX) +endif() + if(WITH_CODEC_AVI) list(APPEND INC ../io/avi diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index 040257fe976..130691dc7ff 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -1459,7 +1459,6 @@ void BKE_image_all_free_anim_ibufs(Main *bmain, int cfra) } /* *********** READ AND WRITE ************** */ - int BKE_image_imtype_to_ftype(const char imtype, ImbFormatOptions *r_options) { memset(r_options, 0, sizeof(*r_options)); @@ -1571,6 +1570,11 @@ char BKE_image_ftype_to_imtype(const int ftype, const ImbFormatOptions *options) return R_IMF_IMTYPE_JP2; } #endif +#ifdef WITH_KTX + if (ftype == IMB_FTYPE_KTX) { + return R_IMF_IMTYPE_KTX; + } +#endif return R_IMF_IMTYPE_JPEG90; } @@ -1653,6 +1657,7 @@ char BKE_imtype_valid_channels(const char imtype, bool write_file) case R_IMF_IMTYPE_DDS: case R_IMF_IMTYPE_JP2: case R_IMF_IMTYPE_DPX: + case R_IMF_IMTYPE_KTX: chan_flag |= IMA_CHAN_FLAG_ALPHA; break; } @@ -1886,6 +1891,12 @@ static bool do_add_image_extension(char *string, } } #endif +#ifdef WITH_KTX + else if (imtype == R_IMF_IMTYPE_KTX) { + if (!BLI_path_extension_check(string, extension_test = ".ktx")) + extension = extension_test; + } +#endif else { // R_IMF_IMTYPE_AVIRAW, R_IMF_IMTYPE_AVIJPEG, R_IMF_IMTYPE_JPEG90 etc if (!(BLI_path_extension_check_n(string, extension_test = ".jpg", ".jpeg", NULL))) { extension = extension_test; @@ -2051,7 +2062,11 @@ void BKE_imbuf_to_image_format(struct ImageFormatData *im_format, const ImBuf *i } } #endif - +#ifdef WITH_KTX + else if (ftype == IMB_FTYPE_KTX) { + im_format->imtype = R_IMF_IMTYPE_KTX; + } +#endif else { im_format->imtype = R_IMF_IMTYPE_JPEG90; im_format->quality = quality; @@ -3116,6 +3131,11 @@ void BKE_imbuf_write_prepare(ImBuf *ibuf, const ImageFormatData *imf) } } #endif +#ifdef WITH_KTX + else if (imtype == R_IMF_IMTYPE_KTX) { + ibuf->ftype = IMB_FTYPE_KTX; + } +#endif else { /* R_IMF_IMTYPE_JPEG90, etc. default we save jpegs */ if (quality < 10) { |