Author: post
Date: 2010-04-01 23:42:15 +0200 (Thu, 01 Apr 2010)
New Revision: 3307
Modified:
trunk/plugins/input-file/input-file.c
Log:
Add possibility to assign color space to input file.
Modified: trunk/plugins/input-file/input-file.c
===================================================================
--- trunk/plugins/input-file/input-file.c 2010-04-01 21:41:24 UTC (rev
3306)
+++ trunk/plugins/input-file/input-file.c 2010-04-01 21:42:15 UTC (rev
3307)
@@ -32,6 +32,7 @@
gchar *filename;
RS_IMAGE16 *image;
+ RSColorSpace *colorspace;
};
struct _RSInputFileClass {
@@ -42,7 +43,8 @@
enum {
PROP_0,
- PROP_FILENAME
+ PROP_FILENAME,
+ PROP_COLOR_SPACE
};
static void get_property (GObject *object, guint property_id, GValue *value,
GParamSpec *pspec);
@@ -78,6 +80,10 @@
NULL,
G_PARAM_READWRITE)
);
+ g_object_class_install_property(object_class,
+ 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 = "File loader based on rs_filetypes";
filter_class->get_image = get_image;
@@ -95,11 +101,15 @@
static void
get_property (GObject *object, guint property_id, GValue *value, GParamSpec
*pspec)
{
+ RSInputFile *input = RS_INPUT_FILE(object);
switch (property_id)
{
case PROP_FILENAME:
g_value_get_string (value);
break;
+ case PROP_COLOR_SPACE:
+ g_value_set_object(value, input->colorspace);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id,
pspec);
}
@@ -119,6 +129,12 @@
input->image = rs_filetype_load(input->filename);
rs_filter_changed(RS_FILTER(input),
RS_FILTER_CHANGED_DIMENSION);
break;
+ case PROP_COLOR_SPACE:
+ if (input->colorspace)
+ g_object_unref(input->colorspace);
+ input->colorspace =
g_object_ref(g_value_get_object(value));
+ rs_filter_changed(RS_FILTER(input),
RS_FILTER_CHANGED_PIXELDATA);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id,
pspec);
}
@@ -130,6 +146,9 @@
RSFilterResponse *response = rs_filter_response_new();
RSInputFile *input = RS_INPUT_FILE(filter);
+ if (RS_IS_COLOR_SPACE(input->colorspace))
+ rs_filter_param_set_object(RS_FILTER_PARAM(response),
"colorspace", input->colorspace);
+
rs_filter_response_set_image(response, input->image);
g_object_unref(input->image);
_______________________________________________
Rawstudio-commit mailing list
[email protected]
http://rawstudio.org/cgi-bin/mailman/listinfo/rawstudio-commit