diff options
author | Ton Roosendaal <ton@blender.org> | 2006-01-11 00:41:37 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2006-01-11 00:41:37 +0300 |
commit | d594594cbe9c9eb3bc3c8a7708601e68693d324d (patch) | |
tree | f8d7156197e1d5d5e27156d0dbe11a8b94671bf0 /source/blender/imbuf | |
parent | a0a3597b8b0d5be7a9161046cb1f8b4a60f44a35 (diff) |
Orange: more work on float/exr buffers;
- EXR now saves and reads Zbuffers correctly
- EXR reading didn't set alpha to 1 yet when no alpha buffer was present
- ImageWindow: the "black point" only checked for the r value... now is OK
- ImageWindow: Curves panal has button "reset"
- ImageWindow: hold LMB drag shows rgba and z values. With SHIFT or CTRL it
applies black/white point whilte dragging too
- ImageWindow: saving file copied the entire buffer... removed that. Also
made the header print clear; this save only saves in own file type.
- Curves: zoom and drag now gets clamped by the Clipping value
- Imbuf: duplicate buffer only copied one quarter of to new buffer
Diffstat (limited to 'source/blender/imbuf')
-rw-r--r-- | source/blender/imbuf/intern/allocimbuf.c | 2 | ||||
-rw-r--r-- | source/blender/imbuf/intern/openexr/openexr_api.cpp | 28 |
2 files changed, 25 insertions, 5 deletions
diff --git a/source/blender/imbuf/intern/allocimbuf.c b/source/blender/imbuf/intern/allocimbuf.c index 137795eec3f..51d294d2d26 100644 --- a/source/blender/imbuf/intern/allocimbuf.c +++ b/source/blender/imbuf/intern/allocimbuf.c @@ -378,7 +378,7 @@ struct ImBuf *IMB_dupImBuf(struct ImBuf *ibuf1) memcpy(ibuf2->rect, ibuf1->rect, x * y * sizeof(int)); if (flags & IB_rectfloat) - memcpy(ibuf2->rect_float, ibuf1->rect_float, x * y * sizeof(float)); + memcpy(ibuf2->rect_float, ibuf1->rect_float, 4 * x * y * sizeof(float)); if (flags & IB_planes) memcpy(*(ibuf2->planes),*(ibuf1->planes),ibuf1->depth * ibuf1->skipx * y * sizeof(int)); diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp index 6e1c31901ce..327c1ef02c5 100644 --- a/source/blender/imbuf/intern/openexr/openexr_api.cpp +++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp @@ -286,7 +286,6 @@ static short imb_save_openexr_float(struct ImBuf *ibuf, char *name, int flags) if (write_zbuf) frameBuffer.insert ("Z", Slice (UINT, (char *) ibuf->zbuf + 4*(height-1)*width, sizeof(int), sizeof(int) * -width)); - file->setFrameBuffer (frameBuffer); file->writePixels (height); delete file; @@ -344,8 +343,22 @@ static void exr_print_filecontents(InputFile *file) const Channel &channel = i.channel(); printf("OpenEXR-load: Found channel %s of type %d\n", i.name(), channel.type); } +} + +static int exr_has_zbuffer(InputFile *file) +{ + const ChannelList &channels = file->header().channels(); + for (ChannelList::ConstIterator i = channels.begin(); i != channels.end(); ++i) + { + const Channel &channel = i.channel(); + if(strcmp("Z", i.name())==0) + return 1; + } + return 0; } + + struct ImBuf *imb_load_openexr(unsigned char *mem, int size, int flags) { struct ImBuf *ibuf = NULL; @@ -386,9 +399,16 @@ struct ImBuf *imb_load_openexr(unsigned char *mem, int size, int flags) frameBuffer.insert ("R", Slice (FLOAT, (char *) first, xstride, ystride)); frameBuffer.insert ("G", Slice (FLOAT, (char *) (first+1), xstride, ystride)); frameBuffer.insert ("B", Slice (FLOAT, (char *) (first+2), xstride, ystride)); - frameBuffer.insert ("A", Slice (FLOAT, (char *) (first+3), xstride, ystride)); - - // FIXME ? Would be able to read Z data or other channels here ! + /* 1.0 is fill value */ + frameBuffer.insert ("A", Slice (FLOAT, (char *) (first+3), xstride, ystride, 1, 1, 1.0f)); + + if(exr_has_zbuffer(file)) { + int *firstz; + + addzbufImBuf(ibuf); + firstz= ibuf->zbuf + (height-1)*width; + frameBuffer.insert ("Z", Slice (UINT, (char *)firstz , sizeof(int), -width*sizeof(int))); + } file->setFrameBuffer (frameBuffer); file->readPixels (dw.min.y, dw.max.y); |