Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-11-22 00:19:58 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-11-22 00:19:58 +0400
commit0e2c8cdcdd13a49560e6f105de530c2ef94ed4e4 (patch)
tree0f53d799ec422ddc96dd948136061e08233abdf4 /source/blender/blenkernel
parente0482b2def521df87f09c7aa23e58909f5e19b90 (diff)
move image settings into their own structure so the interface can be shared where image saving settings are needed.
currently file out node and render output share this struct & UI.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/BKE_image.h11
-rw-r--r--source/blender/blenkernel/intern/image.c101
-rw-r--r--source/blender/blenkernel/intern/ocean.c15
-rw-r--r--source/blender/blenkernel/intern/scene.c8
-rw-r--r--source/blender/blenkernel/intern/writeavi.c6
5 files changed, 116 insertions, 25 deletions
diff --git a/source/blender/blenkernel/BKE_image.h b/source/blender/blenkernel/BKE_image.h
index a3e0b5b6d5a..c24abfdf6f7 100644
--- a/source/blender/blenkernel/BKE_image.h
+++ b/source/blender/blenkernel/BKE_image.h
@@ -43,6 +43,7 @@ struct Tex;
struct anim;
struct Scene;
struct Object;
+struct ImageFormatData;
/* call from library */
void free_image(struct Image *me);
@@ -50,13 +51,19 @@ void free_image(struct Image *me);
void BKE_stamp_info(struct Scene *scene, struct Object *camera, struct ImBuf *ibuf);
void BKE_stamp_buf(struct Scene *scene, struct Object *camera, unsigned char *rect, float *rectf, int width, int height, int channels);
int BKE_alphatest_ibuf(struct ImBuf *ibuf);
-int BKE_write_ibuf_stamp(struct Scene *scene, struct Object *camera, struct ImBuf *ibuf, const char *name, int imtype, int subimtype, int quality);
-int BKE_write_ibuf(struct ImBuf *ibuf, const char *name, int imtype, int subimtype, int quality);
+int BKE_write_ibuf_stamp(struct Scene *scene, struct Object *camera, struct ImBuf *ibuf, const char *name, struct ImageFormatData *imf);
+int BKE_write_ibuf(struct ImBuf *ibuf, const char *name, struct ImageFormatData *imf);
void BKE_makepicstring(char *string, const char *base, const char *relbase, int frame, int imtype, const short use_ext, const short use_frames);
int BKE_add_image_extension(char *string, int imtype);
int BKE_ftype_to_imtype(int ftype);
int BKE_imtype_to_ftype(int imtype);
+
int BKE_imtype_is_movie(int imtype);
+int BKE_imtype_is_alpha_ok(int imtype);
+int BKE_imtype_is_zbuf_ok(int imtype);
+int BKE_imtype_is_compression_ok(int imtype);
+int BKE_imtype_is_quality_ok(int imtype);
+int BKE_imtype_is_depth_ok(int imtype);
struct anim *openanim(const char *name, int flags, int streamindex);
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index a61ae705020..6a4cb049be7 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -900,6 +900,76 @@ int BKE_imtype_is_movie(int imtype)
return 0;
}
+int BKE_imtype_is_alpha_ok(int 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:
+ return 1;
+ }
+ return 0;
+}
+
+int BKE_imtype_is_zbuf_ok(int imtype)
+{
+ switch(imtype) {
+ case R_IRIZ:
+ case R_OPENEXR: /* but not R_MULTILAYER */
+ return 1;
+ }
+ return 0;
+}
+
+int BKE_imtype_is_compression_ok(int imtype)
+{
+ switch(imtype) {
+ case R_PNG:
+ return 1;
+ }
+ return 0;
+}
+
+int BKE_imtype_is_quality_ok(int imtype)
+{
+ switch(imtype) {
+ case R_JPEG90:
+ case R_JP2:
+ return 1;
+ }
+ return 0;
+}
+
+int BKE_imtype_is_depth_ok(int imtype)
+{
+ switch (imtype) {
+ case R_RADHDR:
+ return R_IMF_CHAN_DEPTH_32;
+ case R_TIFF:
+ return R_IMF_CHAN_DEPTH_8 | R_IMF_CHAN_DEPTH_16;
+ case R_OPENEXR:
+ return R_IMF_CHAN_DEPTH_16 | R_IMF_CHAN_DEPTH_32;
+ case R_MULTILAYER:
+ return R_IMF_CHAN_DEPTH_32;
+ /* eeh, cineone does some strange 10bits per channel */
+ case R_DPX:
+ case R_CINEON:
+ return R_IMF_CHAN_DEPTH_12;
+ case R_JP2:
+ return R_IMF_CHAN_DEPTH_8 | R_IMF_CHAN_DEPTH_12 | R_IMF_CHAN_DEPTH_16;
+ /* most formats are 8bit only */
+ default:
+ return R_IMF_CHAN_DEPTH_8;
+ }
+}
+
int BKE_add_image_extension(char *string, int imtype)
{
const char *extension= NULL;
@@ -1371,10 +1441,13 @@ int BKE_alphatest_ibuf(ImBuf *ibuf)
return FALSE;
}
-int BKE_write_ibuf(ImBuf *ibuf, const char *name, int imtype, int subimtype, int quality)
+int BKE_write_ibuf(ImBuf *ibuf, const char *name, ImageFormatData *imf)
{
+ char imtype= imf->imtype;
+ char compress= imf->compress;
+ char quality= imf->quality;
+
int ok;
- (void)subimtype; /* quies unused warnings */
if(imtype == -1) {
/* use whatever existing image type is set by 'ibuf' */
@@ -1391,7 +1464,7 @@ int BKE_write_ibuf(ImBuf *ibuf, const char *name, int imtype, int subimtype, int
ibuf->ftype= PNG;
if(imtype==R_PNG)
- ibuf->ftype |= quality; /* quality is actually compression 0-100 --> 0-9 */
+ ibuf->ftype |= compress;
}
#ifdef WITH_DDS
@@ -1406,18 +1479,18 @@ int BKE_write_ibuf(ImBuf *ibuf, const char *name, int imtype, int subimtype, int
else if (imtype==R_TIFF) {
ibuf->ftype= TIF;
- if(subimtype & R_TIFF_16BIT)
+ if(imf->depth == R_IMF_CHAN_DEPTH_16)
ibuf->ftype |= TIF_16BIT;
}
#endif
#ifdef WITH_OPENEXR
else if (imtype==R_OPENEXR || imtype==R_MULTILAYER) {
ibuf->ftype= OPENEXR;
- if(subimtype & R_OPENEXR_HALF)
+ if(imf->depth == R_IMF_CHAN_DEPTH_16)
ibuf->ftype |= OPENEXR_HALF;
ibuf->ftype |= (quality & OPENEXR_COMPRESS);
- if(!(subimtype & R_OPENEXR_ZBUF))
+ if(!(imf->flag & R_IMF_FLAG_ZBUF))
ibuf->zbuf_float = NULL; /* signal for exr saving */
}
@@ -1441,19 +1514,19 @@ int BKE_write_ibuf(ImBuf *ibuf, const char *name, int imtype, int subimtype, int
if(quality < 10) quality= 90;
ibuf->ftype= JP2|quality;
- if (subimtype & R_JPEG2K_16BIT) {
+ if (imf->depth == R_IMF_CHAN_DEPTH_16) {
ibuf->ftype |= JP2_16BIT;
- } else if (subimtype & R_JPEG2K_12BIT) {
+ } else if (imf->depth == R_IMF_CHAN_DEPTH_12) {
ibuf->ftype |= JP2_12BIT;
}
- if (subimtype & R_JPEG2K_YCC) {
+ if (imf->jp2_flag & R_IMF_JP2_FLAG_YCC) {
ibuf->ftype |= JP2_YCC;
}
-
- if (subimtype & R_JPEG2K_CINE_PRESET) {
+
+ if (imf->jp2_flag & R_IMF_JP2_FLAG_CINE_PRESET) {
ibuf->ftype |= JP2_CINE;
- if (subimtype & R_JPEG2K_CINE_48FPS)
+ if (imf->jp2_flag & R_IMF_JP2_FLAG_CINE_48)
ibuf->ftype |= JP2_CINE_48FPS;
}
}
@@ -1475,12 +1548,12 @@ int BKE_write_ibuf(ImBuf *ibuf, const char *name, int imtype, int subimtype, int
return(ok);
}
-int BKE_write_ibuf_stamp(Scene *scene, struct Object *camera, ImBuf *ibuf, const char *name, int imtype, int subimtype, int quality)
+int BKE_write_ibuf_stamp(Scene *scene, struct Object *camera, ImBuf *ibuf, const char *name, struct ImageFormatData *imf)
{
if(scene && scene->r.stamp & R_STAMP_ALL)
BKE_stamp_info(scene, camera, ibuf);
- return BKE_write_ibuf(ibuf, name, imtype, subimtype, quality);
+ return BKE_write_ibuf(ibuf, name, imf);
}
diff --git a/source/blender/blenkernel/intern/ocean.c b/source/blender/blenkernel/intern/ocean.c
index 85b9b0fbf22..dbcdf5555ab 100644
--- a/source/blender/blenkernel/intern/ocean.c
+++ b/source/blender/blenkernel/intern/ocean.c
@@ -1185,6 +1185,8 @@ void BKE_bake_ocean(struct Ocean *o, struct OceanCache *och, void (*update_cb)(v
* before use - campbell */
OceanResult ocr;
+ ImageFormatData imf= {0};
+
int f, i=0, x, y, cancel=0;
float progress;
@@ -1201,6 +1203,13 @@ 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.depth= R_IMF_CHAN_DEPTH_16;
+ imf.exr_codec= 2; /* ZIP */
+
+
+
for (f=och->start, i=0; f<=och->end; f++, i++) {
/* create a new imbuf to store image for this frame */
@@ -1292,18 +1301,18 @@ void BKE_bake_ocean(struct Ocean *o, struct OceanCache *och, void (*update_cb)(v
/* write the images */
cache_filename(string, och->bakepath, och->relbase, f, CACHE_TYPE_DISPLACE);
- if(0 == BKE_write_ibuf(ibuf_disp, string, R_OPENEXR, R_OPENEXR_HALF, 2)) // 2 == ZIP exr codec
+ if(0 == BKE_write_ibuf(ibuf_disp, string, &imf)) // 2 == ZIP exr codec
printf("Cannot save Displacement File Output to %s\n", string);
if (o->_do_jacobian) {
cache_filename(string, och->bakepath, och->relbase, f, CACHE_TYPE_FOAM);
- if(0 == BKE_write_ibuf(ibuf_foam, string, R_OPENEXR, R_OPENEXR_HALF, 2)) // 2 == ZIP exr codec
+ if(0 == BKE_write_ibuf(ibuf_foam, string, &imf)) // 2 == ZIP exr codec
printf("Cannot save Foam File Output to %s\n", string);
}
if (o->_do_normals) {
cache_filename(string, och->bakepath, och->relbase, f, CACHE_TYPE_NORMAL);
- if(0 == BKE_write_ibuf(ibuf_normal, string, R_OPENEXR, R_OPENEXR_HALF, 2)) // 2 == ZIP exr codec
+ if(0 == BKE_write_ibuf(ibuf_normal, string, &imf)) // 2 == ZIP exr codec
printf("Cannot save Normal File Output to %s\n", string);
}
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index 483e95f2abb..68e5ebeed4f 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -347,9 +347,11 @@ Scene *add_scene(const char *name)
sce->r.mblur_samples= 1;
sce->r.filtertype= R_FILTER_MITCH;
sce->r.size= 50;
- sce->r.planes= 24;
- sce->r.imtype= R_PNG;
- sce->r.quality= 90;
+
+ sce->r.im_format.planes= R_PLANES24;
+ sce->r.im_format.imtype= R_PNG;
+ sce->r.im_format.quality= 90;
+
sce->r.displaymode= R_OUTPUT_AREA;
sce->r.framapto= 100;
sce->r.images= 100;
diff --git a/source/blender/blenkernel/intern/writeavi.c b/source/blender/blenkernel/intern/writeavi.c
index 03091a08c58..e7e375928e1 100644
--- a/source/blender/blenkernel/intern/writeavi.c
+++ b/source/blender/blenkernel/intern/writeavi.c
@@ -154,7 +154,7 @@ static int start_avi(Scene *scene, RenderData *rd, int rectx, int recty, ReportL
x = rectx;
y = recty;
- quality= rd->quality;
+ quality= rd->im_format.quality;
framerate= (double) rd->frs_sec / (double) rd->frs_sec_base;
avi = MEM_mallocN (sizeof(AviMovie), "avimovie");
@@ -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->imtype != R_AVIJPEG ) format = AVI_FORMAT_AVI_RGB;
+ if (rd->im_format.imtype != R_AVIJPEG ) format = AVI_FORMAT_AVI_RGB;
else format = AVI_FORMAT_MJPEG;
if (AVI_open_compress (name, avi, 1, format) != AVI_ERROR_NONE) {
@@ -233,7 +233,7 @@ static void end_avi(void)
/* similar to BKE_makepicstring() */
void BKE_makeanimstring(char *string, RenderData *rd)
{
- bMovieHandle *mh= BKE_get_movie_handle(rd->imtype);
+ bMovieHandle *mh= BKE_get_movie_handle(rd->im_format.imtype);
if(mh->get_movie_path)
mh->get_movie_path(string, rd);
else