[gegl/soc-2012-ville: 19/24] added reference compositions to brightness-contrast, color-reduction, color-temperature, color-to-al
- From: Ville Sokk <villesokk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl/soc-2012-ville: 19/24] added reference compositions to brightness-contrast, color-reduction, color-temperature, color-to-al
- Date: Thu, 2 Aug 2012 18:29:24 +0000 (UTC)
commit d4b2bbb390862e57cc58434035b89261927419bd
Author: Ville Sokk <ville sokk gmail com>
Date: Thu Jul 19 20:21:10 2012 +0300
added reference compositions to brightness-contrast, color-reduction, color-temperature, color-to-alpha so that the example images would be more interesting
bin/gegl-tester.c | 10 ++++++----
operations/common/brightness-contrast.c | 17 ++++++++++++++++-
operations/common/color-reduction.c | 20 +++++++++++++++++++-
operations/common/color-temperature.c | 14 ++++++++++++++
operations/common/color-to-alpha.c | 24 +++++++++++++++++++++++-
5 files changed, 78 insertions(+), 7 deletions(-)
---
diff --git a/bin/gegl-tester.c b/bin/gegl-tester.c
index 078f5ad..e68157a 100644
--- a/bin/gegl-tester.c
+++ b/bin/gegl-tester.c
@@ -114,9 +114,8 @@ process_operations (GType type)
if (output_all && matches)
g_printf ("%s\n", name);
- if (image && xml && matches)
+ if (xml && matches)
{
- gchar *image_path = g_build_path (G_DIR_SEPARATOR_S, reference_dir, image, NULL);
gchar *output_path = operation_to_path (name, FALSE);
GeglNode *composition;
@@ -144,8 +143,10 @@ process_operations (GType type)
gegl_node_process (output);
/* don't test if run with --all */
- if (!output_all)
+ if (!output_all && image)
{
+ gchar *image_path = g_build_path (G_DIR_SEPARATOR_S, reference_dir, image, NULL);
+
ref_img = gegl_node_new_child (composition,
"operation", "gegl:load",
"path", image_path,
@@ -205,11 +206,12 @@ process_operations (GType type)
result = FALSE;
}
}
+
+ g_free (image_path);
}
}
g_object_unref (composition);
- g_free (image_path);
g_free (output_path);
}
/* if we are running with --all and the operation doesn't have a
diff --git a/operations/common/brightness-contrast.c b/operations/common/brightness-contrast.c
index 8d37a96..3acf092 100644
--- a/operations/common/brightness-contrast.c
+++ b/operations/common/brightness-contrast.c
@@ -128,6 +128,20 @@ gegl_chant_class_init (GeglChantClass *klass)
{
GeglOperationClass *operation_class;
GeglOperationPointFilterClass *point_filter_class;
+ gchar *composition = "<?xml version='1.0' encoding='UTF-8'?>"
+ "<gegl>"
+ "<node operation='gegl:brightness-contrast'>"
+ " <params>"
+ " <param name='contrast'>1.8</param>"
+ " <param name='brightness'>0.25</param>"
+ " </params>"
+ "</node>"
+ "<node operation='gegl:load'>"
+ " <params>"
+ " <param name='path'>standard-input.png</param>"
+ " </params>"
+ "</node>"
+ "</gegl>";
operation_class = GEGL_OPERATION_CLASS (klass);
point_filter_class = GEGL_OPERATION_POINT_FILTER_CLASS (klass);
@@ -141,9 +155,10 @@ gegl_chant_class_init (GeglChantClass *klass)
gegl_operation_class_set_keys (operation_class,
"name", "gegl:brightness-contrast",
- "categories", "color",
+ "categories", "color",
"description", _("Changes the light level and contrast."),
"cl-source" , kernel_source,
+ "reference-composition", composition,
NULL);
}
diff --git a/operations/common/color-reduction.c b/operations/common/color-reduction.c
index 3a641cd..0fab02b 100644
--- a/operations/common/color-reduction.c
+++ b/operations/common/color-reduction.c
@@ -440,7 +440,7 @@ process (GeglOperation *operation,
process_random (input, output, result, channel_bits);
break;
case GEGL_DITHER_RANDOM_COVARIANT:
- process_random_covariant (input, output, result,
+ process_random_covariant (input, output, result,
channel_bits);
break;
case GEGL_DITHER_FLOYD_STEINBERG:
@@ -462,6 +462,23 @@ gegl_chant_class_init (GeglChantClass *klass)
{
GeglOperationClass *operation_class;
GeglOperationFilterClass *filter_class;
+ gchar *composition = "<?xml version='1.0' encoding='UTF-8'?>"
+ "<gegl>"
+ "<node operation='gegl:color-reduction'>"
+ " <params>"
+ " <param name='red-bits'>2</param>"
+ " <param name='green-bits'>2</param>"
+ " <param name='blue-bits'>2</param>"
+ " <param name='alpha-bits'>2</param>"
+ " <param name='dither-strategy'>Floyd-Steinberg</param>"
+ " </params>"
+ "</node>"
+ "<node operation='gegl:load'>"
+ " <params>"
+ " <param name='path'>standard-input.png</param>"
+ " </params>"
+ "</node>"
+ "</gegl>";
operation_class = GEGL_OPERATION_CLASS (klass);
filter_class = GEGL_OPERATION_FILTER_CLASS (klass);
@@ -476,6 +493,7 @@ gegl_chant_class_init (GeglChantClass *klass)
"categories" , "misc",
"description" ,
_("Reduces the number of bits per channel (colors and alpha), with optional dithering"),
+ "reference-composition", composition,
NULL);
}
diff --git a/operations/common/color-temperature.c b/operations/common/color-temperature.c
index 8e09af7..0e2e729 100644
--- a/operations/common/color-temperature.c
+++ b/operations/common/color-temperature.c
@@ -245,6 +245,19 @@ gegl_chant_class_init (GeglChantClass *klass)
GObjectClass *object_class;
GeglOperationClass *operation_class;
GeglOperationPointFilterClass *point_filter_class;
+ gchar *composition = "<?xml version='1.0' encoding='UTF-8'?>"
+ "<gegl>"
+ "<node operation='gegl:color-temperature'>"
+ " <params>"
+ " <param name='intended-temperature'>12000</param>"
+ " </params>"
+ "</node>"
+ "<node operation='gegl:load'>"
+ " <params>"
+ " <param name='path'>standard-input.png</param>"
+ " </params>"
+ "</node>"
+ "</gegl>";
object_class = G_OBJECT_CLASS (klass);
operation_class = GEGL_OPERATION_CLASS (klass);
@@ -265,6 +278,7 @@ gegl_chant_class_init (GeglChantClass *klass)
"categories" , "color",
"description",
_("Allows changing the color temperature of an image."),
+ "reference-composition", composition,
NULL);
}
diff --git a/operations/common/color-to-alpha.c b/operations/common/color-to-alpha.c
index f55fddb..d0dcd67 100644
--- a/operations/common/color-to-alpha.c
+++ b/operations/common/color-to-alpha.c
@@ -161,8 +161,29 @@ process (GeglOperation *operation,
static void
gegl_chant_class_init (GeglChantClass *klass)
{
- GeglOperationClass *operation_class;
+ GeglOperationClass *operation_class;
GeglOperationPointFilterClass *filter_class;
+ gchar *composition = "<?xml version='1.0' encoding='UTF-8'?>"
+ "<gegl>"
+ "<node operation='svg:dst-over'>"
+ " <node operation='gegl:crop'>"
+ " <params>"
+ " <param name='width'>200.0</param>"
+ " <param name='height'>200.0</param>"
+ " </params>"
+ " </node>"
+ " <node operation='gegl:checkerboard'>"
+ " <params><param name='color1'>rgb(0.5, 0.5, 0.5)</param></params>"
+ " </node>"
+ "</node>"
+ "<node operation='gegl:color-to-alpha'>"
+ "</node>"
+ "<node operation='gegl:load'>"
+ " <params>"
+ " <param name='path'>standard-input.png</param>"
+ " </params>"
+ "</node>"
+ "</gegl>";
operation_class = GEGL_OPERATION_CLASS (klass);
filter_class = GEGL_OPERATION_POINT_FILTER_CLASS (klass);
@@ -174,6 +195,7 @@ gegl_chant_class_init (GeglChantClass *klass)
"name" , "gegl:color-to-alpha",
"categories" , "color",
"description", _("Performs color-to-alpha on the image."),
+ "reference-composition", composition,
NULL);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]