[gegl] operations: move cast-space and convert-space out of workshop
- From: Øyvind "pippin" Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] operations: move cast-space and convert-space out of workshop
- Date: Sun, 15 Jul 2018 19:50:30 +0000 (UTC)
commit 9682c3f454fb53164c25f9951fbc4b9c12383d58
Author: Øyvind Kolås <pippin gimp org>
Date: Sun Jul 15 21:47:16 2018 +0200
operations: move cast-space and convert-space out of workshop
operations/core/Makefile.am | 2 +
operations/{workshop => core}/cast-space.c | 30 ++++++------
.../{workshop/set-space.c => core/convert-space.c} | 54 ++++++++++------------
operations/workshop/Makefile.am | 2 -
operations/workshop/ditto.c | 7 ++-
po/POTFILES.in | 4 +-
6 files changed, 45 insertions(+), 54 deletions(-)
---
diff --git a/operations/core/Makefile.am b/operations/core/Makefile.am
index ff12586d1..88828462d 100644
--- a/operations/core/Makefile.am
+++ b/operations/core/Makefile.am
@@ -17,7 +17,9 @@ gegl_core_la_SOURCES =\
load.c \
clone.c \
cast-format.c \
+ cast-space.c \
convert-format.c \
+ convert-space.c \
crop.c \
json.c \
nop.c
diff --git a/operations/workshop/cast-space.c b/operations/core/cast-space.c
similarity index 83%
rename from operations/workshop/cast-space.c
rename to operations/core/cast-space.c
index 442bd1d5c..a5a1697db 100644
--- a/operations/workshop/cast-space.c
+++ b/operations/core/cast-space.c
@@ -22,12 +22,12 @@
#ifdef GEGL_PROPERTIES
-property_string (space, _("Space"), "sRGB")
- description (_("space to assign, using babls names"))
-property_format (babl_space, _("Babl space"), NULL)
- description (_("pointer to a babl space"))
-property_file_path (icc_path, _("ICC path"), "")
- description (_("Path to ICC matrix profile to load"))
+property_string (name, _("Name"), "sRGB")
+ description (_("One of: sRGB, Adobish, Rec2020, ProPhoto, Apple, ACEScg, ACES2065-1"))
+property_format (pointer, _("Pointer"), NULL)
+ description (_("pointer to a const * Babl space"))
+property_file_path (path, _("Path"), "")
+ description (_("File system path to ICC matrix profile to load"))
#else
@@ -46,14 +46,14 @@ prepare (GeglOperation *operation)
const Babl *aux_format = gegl_operation_get_source_format (operation,
"aux");
GeglProperties *o = GEGL_PROPERTIES (operation);
- const Babl *space = babl_space (o->space);
- if (o->babl_space)
- space = o->babl_space;
- if (o->icc_path)
+ const Babl *space = babl_space (o->name);
+ if (o->pointer)
+ space = o->pointer;
+ if (o->path)
{
gchar *icc_data = NULL;
gsize icc_length;
- g_file_get_contents (o->icc_path, &icc_data, &icc_length, NULL);
+ g_file_get_contents (o->path, &icc_data, &icc_length, NULL);
if (icc_data)
{
const char *error = NULL;
@@ -67,10 +67,6 @@ prepare (GeglOperation *operation)
{
space = babl_format_get_space (aux_format);
}
- if (!space)
- {
- fprintf (stderr, "unknown space %s\n", o->space);
- }
gegl_operation_set_format (operation, "input",
babl_format_with_space ("R'G'B'A float", in_format));
@@ -130,9 +126,9 @@ gegl_op_class_init (GeglOpClass *klass)
gegl_operation_class_set_keys (operation_class,
"name", "gegl:cast-space",
- "title", _("Cast space"),
+ "title", _("Cast color space"),
"categories", "core:color",
- "description", _("assign a different babl space"),
+ "description", _("Override the specified color space setting a pointer to a format override the string
property and setting an aux pad overrides both. "),
NULL);
}
diff --git a/operations/workshop/set-space.c b/operations/core/convert-space.c
similarity index 59%
rename from operations/workshop/set-space.c
rename to operations/core/convert-space.c
index ee72c9f65..420ee1920 100644
--- a/operations/workshop/set-space.c
+++ b/operations/core/convert-space.c
@@ -22,36 +22,36 @@
#ifdef GEGL_PROPERTIES
-property_string (space, _("Space"), "sRGB")
- description (_("space to assign, using babls names"))
-property_format (babl_space, _("Babl space"), NULL)
- description (_("pointer to a babl space"))
-property_file_path (icc_path, _("ICC path"), "")
- description (_("Path to ICC matrix profile to load"))
+property_string (name, _("Name"), "sRGB")
+ description (_("One of: sRGB, Adobish, Rec2020, ProPhoto, Apple, ACEScg, ACES2065-1"))
+property_format (pointer, _("Pointer"), NULL)
+ description (_("pointer to a const * Babl space"))
+property_file_path (path, _("Path"), "")
+ description (_("File system path to ICC matrix profile to load"))
#else
#define GEGL_OP_FILTER
-#define GEGL_OP_NAME set_space
-#define GEGL_OP_C_SOURCE set-space.c
+#define GEGL_OP_NAME convert_space
+#define GEGL_OP_C_SOURCE convert-space.c
#include "gegl-op.h"
#include <stdio.h>
static void
-gegl_set_space_prepare (GeglOperation *operation)
+gegl_convert_space_prepare (GeglOperation *operation)
{
const Babl *aux_format = gegl_operation_get_source_format (operation,
"aux");
GeglProperties *o = GEGL_PROPERTIES (operation);
- const Babl *space = babl_space (o->space);
- if (o->babl_space)
- space = o->babl_space;
- if (o->icc_path)
+ const Babl *space = babl_space (o->name);
+ if (o->pointer)
+ space = o->pointer;
+ if (o->path)
{
gchar *icc_data = NULL;
gsize icc_length;
- g_file_get_contents (o->icc_path, &icc_data, &icc_length, NULL);
+ g_file_get_contents (o->path, &icc_data, &icc_length, NULL);
if (icc_data)
{
const char *error = NULL;
@@ -65,21 +65,17 @@ gegl_set_space_prepare (GeglOperation *operation)
{
space = babl_format_get_space (aux_format);
}
- if (!space)
- {
- fprintf (stderr, "unknown space %s\n", o->space);
- }
gegl_operation_set_format (operation, "output",
babl_format_with_space ("RGBA float", space));
}
static gboolean
-gegl_set_space_process (GeglOperation *operation,
- GeglOperationContext *context,
- const gchar *output_prop,
- const GeglRectangle *result,
- gint level)
+gegl_convert_space_process (GeglOperation *operation,
+ GeglOperationContext *context,
+ const gchar *output_prop,
+ const GeglRectangle *result,
+ gint level)
{
GeglBuffer *input;
@@ -100,14 +96,14 @@ gegl_op_class_init (GeglOpClass *klass)
GeglOperationClass *operation_class;
operation_class = GEGL_OPERATION_CLASS (klass);
- operation_class->process = gegl_set_space_process;
- operation_class->prepare = gegl_set_space_prepare;
+ operation_class->process = gegl_convert_space_process;
+ operation_class->prepare = gegl_convert_space_prepare;
gegl_operation_class_set_keys (operation_class,
- "name", "gegl:set-space",
- "title", _("Set space"),
- "categories", "core",
- "description", _("set color space, does not do a conversion but changes the space which
subsequent formats in the pipeline are created with."),
+ "name", "gegl:convert-space",
+ "title", _("Convert color space"),
+ "categories", "core:color",
+ "description", _("set color space which subsequent babl-formats in the pipeline are created
with, and the ICC profile potentially embedded for external color management, setting a pointer to a format
override the string property and setting an aux pad overrides both. "),
NULL);
}
diff --git a/operations/workshop/Makefile.am b/operations/workshop/Makefile.am
index 7bdc9e989..06e7922a3 100644
--- a/operations/workshop/Makefile.am
+++ b/operations/workshop/Makefile.am
@@ -10,8 +10,6 @@ LIBS = $(op_libs)
opdir = $(ext_dir)
op_LTLIBRARIES = \
- cast-space.la \
- set-space.la \
bayer-matrix.la \
bilateral-filter-fast.la \
demosaic-bimedian.la \
diff --git a/operations/workshop/ditto.c b/operations/workshop/ditto.c
index 056f22f41..4e8b5ba9d 100644
--- a/operations/workshop/ditto.c
+++ b/operations/workshop/ditto.c
@@ -40,10 +40,9 @@ property_enum (sampler_type, _("Sampler"), GeglSamplerType, gegl_sampler_type,
static void prepare (GeglOperation *operation)
{
- gegl_operation_set_format (operation, "input",
- babl_format ("RGBA float"));
- gegl_operation_set_format (operation, "output",
- babl_format ("RGBA float"));
+ const Babl *format = gegl_operation_get_source_format (operation, "input");
+ fprintf (stderr, "%s\n", format?babl_get_name (babl_format_get_space (format)):"nil");
+ gegl_operation_set_format (operation, "output", format);
}
static gboolean
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 875277cda..27da9d92e 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -166,8 +166,10 @@ operations/common-gpl3+/whirl-pinch.c
operations/common-gpl3+/wind.c
operations/core/cache.c
operations/core/cast-format.c
+operations/core/cast-space.c
operations/core/clone.c
operations/core/convert-format.c
+operations/core/convert-space.c
operations/core/crop.c
operations/core/load.c
operations/core/nop.c
@@ -243,7 +245,6 @@ operations/transform/transform-core.c
operations/transform/translate.c
operations/workshop/bayer-matrix.c
operations/workshop/bilateral-filter-fast.c
-operations/workshop/cast-space.c
operations/workshop/demosaic-bimedian.c
operations/workshop/demosaic-simple.c
operations/workshop/ditto.c
@@ -265,4 +266,3 @@ operations/workshop/linear-sinusoid.c
operations/workshop/rawbayer-load.c
operations/workshop/segment-kmeans.c
operations/workshop/selective-hue-saturation.c
-operations/workshop/set-space.c
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]