From da1795619ff661cbb262991e3062994a13ddd993 Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Thu, 6 Apr 2006 07:20:13 +0000 Subject: Adding rendering-intent to (bzr r438) --- src/sp-image.cpp | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'src/sp-image.cpp') diff --git a/src/sp-image.cpp b/src/sp-image.cpp index 6a848c1bc..83b623dbc 100644 --- a/src/sp-image.cpp +++ b/src/sp-image.cpp @@ -38,6 +38,7 @@ #include #if ENABLE_LCMS #include "color-profile-fns.h" +#include "color-profile.h" #endif // ENABLE_LCMS /* * SPImage @@ -665,16 +666,36 @@ sp_image_update (SPObject *object, SPCtx *ctx, unsigned int flags) guchar* px = gdk_pixbuf_get_pixels( pixbuf ); if ( px ) { - cmsHPROFILE prof = Inkscape::colorprofile_get_handle( SP_OBJECT_DOCUMENT( object ), image->color_profile ); + guint profIntent = Inkscape::RENDERING_INTENT_UNKNOWN; + cmsHPROFILE prof = Inkscape::colorprofile_get_handle( SP_OBJECT_DOCUMENT( object ), + &profIntent, + image->color_profile ); if ( prof ) { icProfileClassSignature profileClass = cmsGetDeviceClass( prof ); if ( profileClass != icSigNamedColorClass ) { + int intent = INTENT_PERCEPTUAL; + switch ( profIntent ) { + case Inkscape::RENDERING_INTENT_RELATIVE_COLORIMETRIC: + intent = INTENT_RELATIVE_COLORIMETRIC; + break; + case Inkscape::RENDERING_INTENT_SATURATION: + intent = INTENT_SATURATION; + break; + case Inkscape::RENDERING_INTENT_ABSOLUTE_COLORIMETRIC: + intent = INTENT_ABSOLUTE_COLORIMETRIC; + break; + case Inkscape::RENDERING_INTENT_PERCEPTUAL: + case Inkscape::RENDERING_INTENT_UNKNOWN: + case Inkscape::RENDERING_INTENT_AUTO: + default: + intent = INTENT_PERCEPTUAL; + } cmsHPROFILE destProf = cmsCreate_sRGBProfile(); cmsHTRANSFORM transf = cmsCreateTransform( prof, TYPE_RGBA_8, destProf, TYPE_RGBA_8, - INTENT_PERCEPTUAL, 0 ); + intent, 0 ); if ( transf ) { guchar* currLine = px; for ( int y = 0; y < imageheight; y++ ) { -- cgit v1.2.3