Author: abrander
Date: 2009-12-28 02:12:58 +0100 (Mon, 28 Dec 2009)
New Revision: 2869

Modified:
   branches/rawstudio-ng-color/plugins/basic-render/basic-render.c
   branches/rawstudio-ng-color/plugins/input-image16/input-image16.c
   branches/rawstudio-ng-color/plugins/output-jpegfile/output-jpegfile.c
Log:
Ported RSJpegfile, RSInputImage16 and RSBasicRender away from ICC-based CMS.

Modified: branches/rawstudio-ng-color/plugins/basic-render/basic-render.c
===================================================================
--- branches/rawstudio-ng-color/plugins/basic-render/basic-render.c     
2009-12-28 01:09:59 UTC (rev 2868)
+++ branches/rawstudio-ng-color/plugins/basic-render/basic-render.c     
2009-12-28 01:12:58 UTC (rev 2869)
@@ -127,7 +127,6 @@
 #endif /* __i386__ || __x86_64__ */
 static RSFilterResponse *get_image(RSFilter *filter, const RSFilterRequest 
*request);
 static RSFilterResponse *get_image8(RSFilter *filter, const RSFilterRequest 
*request);
-static RSIccProfile *get_icc_profile(RSFilter *filter);
 
 static RSFilterClass *rs_basic_render_parent_class = NULL;
 
@@ -175,7 +174,6 @@
        filter_class->name = "BasicRender filter";
        filter_class->get_image = get_image;
        filter_class->get_image8 = get_image8;
-       filter_class->get_icc_profile = get_icc_profile;
        filter_class->previous_changed = previous_changed;
 
        klass->thread_func16 = thread_func_float16;
@@ -315,17 +313,6 @@
        }
 }
 
-static RSIccProfile *
-get_icc_profile(RSFilter *filter)
-{
-       RSBasicRender *basic_render = RS_BASIC_RENDER(filter);
-
-       if (basic_render->icc_profile)
-               return g_object_ref(basic_render->icc_profile);
-       else
-               return rs_filter_get_icc_profile(filter->previous);
-}
-
 static void
 previous_changed(RSFilter *filter, RSFilter *parent, RSFilterChangedMask mask)
 {
@@ -563,10 +550,12 @@
 
        if (!basic_render->lcms_input_profile)
        {
-               RSIccProfile *previous_profile = 
rs_filter_get_icc_profile(RS_FILTER(basic_render)->previous);
+               RSIccProfile *previous_profile = 
NULL;//rs_filter_get_icc_profile(RS_FILTER(basic_render)->previous);
                if (previous_profile)
+               {
                        basic_render->lcms_input_profile = 
lcms_profile_from_rs_icc_profile(previous_profile);
-               g_object_unref(previous_profile);
+                       g_object_unref(previous_profile);
+               }
        }
 
        if (basic_render->icc_profile && !basic_render->lcms_output_profile)

Modified: branches/rawstudio-ng-color/plugins/input-image16/input-image16.c
===================================================================
--- branches/rawstudio-ng-color/plugins/input-image16/input-image16.c   
2009-12-28 01:09:59 UTC (rev 2868)
+++ branches/rawstudio-ng-color/plugins/input-image16/input-image16.c   
2009-12-28 01:12:58 UTC (rev 2869)
@@ -34,7 +34,7 @@
 
        RS_IMAGE16 *image;
        gchar *filename;
-       RSIccProfile *icc_profile;
+       RSColorSpace *colorspace;
        gulong signal;
 };
 
@@ -48,13 +48,12 @@
        PROP_0,
        PROP_IMAGE,
        PROP_FILENAME,
-       PROP_ICC_PROFILE
+       PROP_COLOR_SPACE
 };
 
 static void get_property (GObject *object, guint property_id, GValue *value, 
GParamSpec *pspec);
 static void set_property (GObject *object, guint property_id, const GValue 
*value, GParamSpec *pspec);
 static RSFilterResponse *get_image(RSFilter *filter, const RSFilterRequest 
*request);
-static RSIccProfile *get_icc_profile(RSFilter *filter);
 static void dispose (GObject *object);
 static gint get_width(RSFilter *filter);
 static gint get_height(RSFilter *filter);
@@ -94,15 +93,14 @@
                        "filename", "filename", "filename",
                        NULL, G_PARAM_READWRITE));
        g_object_class_install_property(object_class,
-               PROP_ICC_PROFILE, g_param_spec_object(
-                       "icc-profile", "icc-profile", "ICC Profile",
-                       RS_TYPE_ICC_PROFILE, G_PARAM_READWRITE));
+               PROP_COLOR_SPACE, g_param_spec_object(
+                       "color-space", "color-space", "A colorspace to assign 
input",
+                       RS_TYPE_COLOR_SPACE, G_PARAM_READWRITE));
 
        filter_class->name = "Import a RS_IMAGE16 into a RSFilter chain";
        filter_class->get_image = get_image;
        filter_class->get_width = get_width;
        filter_class->get_height = get_height;
-       filter_class->get_icc_profile = get_icc_profile;
 }
 
 static void
@@ -124,8 +122,8 @@
                case PROP_FILENAME:
                        g_value_set_string(value, input_image16->filename);
                        break;
-               case PROP_ICC_PROFILE:
-                       g_value_set_object(value, input_image16->icc_profile);
+               case PROP_COLOR_SPACE:
+                       g_value_set_object(value, input_image16->colorspace);
                        break;
                default:
                        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, 
pspec);
@@ -152,11 +150,11 @@
                        g_free(input_image16->filename);
                        input_image16->filename = g_value_dup_string(value);
                        break;
-               case PROP_ICC_PROFILE:
-                       if (input_image16->icc_profile)
-                               g_object_unref(input_image16->icc_profile);
-                       input_image16->icc_profile = 
g_object_ref(g_value_get_object(value));
-                       rs_filter_changed(RS_FILTER(input_image16), 
RS_FILTER_CHANGED_ICC_PROFILE);
+               case PROP_COLOR_SPACE:
+                       if (input_image16->colorspace)
+                               g_object_unref(input_image16->colorspace);
+                       input_image16->colorspace = 
g_object_ref(g_value_get_object(value));
+                       rs_filter_changed(RS_FILTER(input_image16), 
RS_FILTER_CHANGED_DIMENSION);
                        break;
                default:
                        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, 
pspec);
@@ -181,22 +179,15 @@
        RSFilterResponse *response = rs_filter_response_new();
        RSInputImage16 *input_image16 = RS_INPUT_IMAGE16(filter);
 
+       if (RS_IS_COLOR_SPACE(input_image16->colorspace))
+               rs_filter_param_set_object(RS_FILTER_PARAM(response), 
"colorspace", input_image16->colorspace);
+
        if (RS_IS_IMAGE16(input_image16->image))
                rs_filter_response_set_image(response, input_image16->image);
 
        return response;
 }
 
-static RSIccProfile *
-get_icc_profile(RSFilter *filter)
-{
-       RSInputImage16 *input_image16 = RS_INPUT_IMAGE16(filter);
-
-       g_assert(RS_IS_ICC_PROFILE(input_image16->icc_profile));
-
-       return g_object_ref(input_image16->icc_profile);
-}
-
 static gint
 get_width(RSFilter *filter)
 {

Modified: branches/rawstudio-ng-color/plugins/output-jpegfile/output-jpegfile.c
===================================================================
--- branches/rawstudio-ng-color/plugins/output-jpegfile/output-jpegfile.c       
2009-12-28 01:09:59 UTC (rev 2868)
+++ branches/rawstudio-ng-color/plugins/output-jpegfile/output-jpegfile.c       
2009-12-28 01:12:58 UTC (rev 2869)
@@ -189,8 +189,11 @@
        struct jpeg_error_mgr jerr;
        FILE * outfile;
        JSAMPROW row_pointer[1];
-       RSIccProfile *profile = rs_filter_get_icc_profile(filter);
+       const RSIccProfile *profile = NULL;
        RSFilterResponse *response = rs_filter_get_image8(filter, NULL);
+       RSColorSpace *colorspace = 
rs_filter_param_get_object_with_type(RS_FILTER_PARAM(response), "colorspace", 
RS_TYPE_COLOR_SPACE);
+       if (colorspace)
+               profile = rs_color_space_get_icc_profile(colorspace);
        GdkPixbuf *pixbuf = rs_filter_response_get_image8(response);
 
        cinfo.err = jpeg_std_error(&jerr);


_______________________________________________
Rawstudio-commit mailing list
[email protected]
http://rawstudio.org/cgi-bin/mailman/listinfo/rawstudio-commit

Reply via email to