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:
authorMartin Poirier <theeth@yahoo.com>2009-05-17 20:19:13 +0400
committerMartin Poirier <theeth@yahoo.com>2009-05-17 20:19:13 +0400
commit7eeb8ac01cea69fc8dbf3e4a58179b1026fc6198 (patch)
treebb1fda3f9be548369ebaa8742ba0129080257bb8 /source/blender/editors/space_image
parent351086dbb83fa42d393a8a4f64287c2b90e23d97 (diff)
Color proofing support with lcms (http://www.littlecms.com/).
Enable with WITH_LCMS (options have been added for scons). lcms is very common on linux package managers, so no need to add in extern (IMHO). Libs for windows can be added to /lib Code is mostly a proof of concept with hardcoded path for icc profile (taken from the lcms test suite). Adding this now to svn so it doesn't rot on my hard drive. People interested in pushing it forward should feel free to dig in the code or poke me about it.
Diffstat (limited to 'source/blender/editors/space_image')
-rw-r--r--source/blender/editors/space_image/SConscript7
-rw-r--r--source/blender/editors/space_image/image_draw.c21
-rw-r--r--source/blender/editors/space_image/image_header.c7
3 files changed, 31 insertions, 4 deletions
diff --git a/source/blender/editors/space_image/SConscript b/source/blender/editors/space_image/SConscript
index 3ae638d344d..e7041ef0458 100644
--- a/source/blender/editors/space_image/SConscript
+++ b/source/blender/editors/space_image/SConscript
@@ -7,4 +7,9 @@ incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../imbuf'
incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include'
incs += ' ../../render/extern/include ../../makesrna'
-env.BlenderLib ( 'bf_editors_space_image', sources, Split(incs), [], libtype=['core'], priority=[40] )
+defs = []
+
+if env['WITH_BF_LCMS']:
+ defs.append('WITH_LCMS')
+
+env.BlenderLib ( 'bf_editors_space_image', sources, Split(incs), defs, libtype=['core'], priority=[40] )
diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c
index b9407d26352..122e298baaa 100644
--- a/source/blender/editors/space_image/image_draw.c
+++ b/source/blender/editors/space_image/image_draw.c
@@ -117,10 +117,12 @@ static void image_verify_buffer_float(SpaceImage *sima, ImBuf *ibuf)
if(ibuf->rect_float) {
if(ibuf->rect==NULL) {
- if(image_curves_active(sima))
+ if(image_curves_active(sima)) {
curvemapping_do_ibuf(sima->cumap, ibuf);
- else
+ }
+ else {
IMB_rect_from_float(ibuf);
+ }
}
}
}
@@ -309,6 +311,13 @@ static void sima_draw_alpha_pixelsf(float x1, float y1, int rectx, int recty, fl
// glColorMask(1, 1, 1, 1);
}
+static void sima_draw_colorcorrected_pixels(float x1, float y1, ImBuf *ibuf)
+{
+ colorcorrection_do_ibuf(ibuf, "MONOSCNR.ICM"); /* path is hardcoded here, find some place better */
+
+ glaDrawPixelsSafe(x1, y1, ibuf->x, ibuf->y, ibuf->x, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->crect);
+}
+
static void sima_draw_zbuf_pixels(float x1, float y1, int rectx, int recty, int *recti)
{
/* zbuffer values are signed, so we need to shift color range */
@@ -386,6 +395,14 @@ static void draw_image_buffer(SpaceImage *sima, ARegion *ar, Scene *scene, ImBuf
else if(ibuf->channels==1)
sima_draw_zbuffloat_pixels(scene, x, y, ibuf->x, ibuf->y, ibuf->rect_float);
}
+#ifdef WITH_LCMS
+ else if(sima->flag & SI_COLOR_CORRECTION) {
+ image_verify_buffer_float(sima, ibuf);
+
+ sima_draw_colorcorrected_pixels(x, y, ibuf);
+
+ }
+#endif
else {
if(sima->flag & SI_USE_ALPHA) {
sima_draw_alpha_backdrop(x, y, ibuf->x, ibuf->y, zoomx, zoomy);
diff --git a/source/blender/editors/space_image/image_header.c b/source/blender/editors/space_image/image_header.c
index a584993005a..7a28499009b 100644
--- a/source/blender/editors/space_image/image_header.c
+++ b/source/blender/editors/space_image/image_header.c
@@ -907,8 +907,12 @@ void image_header_buttons(const bContext *C, ARegion *ar)
xco+= XIC;
}
}
+#ifdef WITH_LCMS
+ uiDefIconButR(block, ROW, B_REDR, ICON_IMAGE_ALPHA, xco,yco,XIC,YIC, &spaceptr, "draw_channels", 0, 0, SI_COLOR_CORRECTION, 0, 0, NULL);
+ xco+= XIC;
+#endif
xco+= 8;
-
+
/* record & play */
uiBlockBeginAlign(block);
if(ima->type==IMA_TYPE_COMPOSITE) {
@@ -921,6 +925,7 @@ void image_header_buttons(const bContext *C, ARegion *ar)
}
uiBlockEndAlign(block);
xco+= 8;
+
}
/* draw lock */