[gimp] app: sense the input format in gimp:mask-components
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: sense the input format in gimp:mask-components
- Date: Fri, 26 Apr 2013 21:31:49 +0000 (UTC)
commit 5322d6a5449ded9e387adecf87974b320ab9f37f
Author: Michael Natterer <mitch gimp org>
Date: Fri Apr 26 23:29:03 2013 +0200
app: sense the input format in gimp:mask-components
because it can work on RGBA and R'G'B'A without conversions.
app/operations/gimpoperationmaskcomponents.c | 22 +++++++++++++++++++---
1 files changed, 19 insertions(+), 3 deletions(-)
---
diff --git a/app/operations/gimpoperationmaskcomponents.c b/app/operations/gimpoperationmaskcomponents.c
index 1df1b58..036ad5b 100644
--- a/app/operations/gimpoperationmaskcomponents.c
+++ b/app/operations/gimpoperationmaskcomponents.c
@@ -143,9 +143,25 @@ gimp_operation_mask_components_set_property (GObject *object,
static void
gimp_operation_mask_components_prepare (GeglOperation *operation)
{
- gegl_operation_set_format (operation, "input", babl_format ("RGBA float"));
- gegl_operation_set_format (operation, "aux", babl_format ("RGBA float"));
- gegl_operation_set_format (operation, "output", babl_format ("RGBA float"));
+ const Babl *format = gegl_operation_get_source_format (operation, "input");
+
+ if (format)
+ {
+ const Babl *model = babl_format_get_model (format);
+
+ if (model == babl_model ("R'G'B'A"))
+ format = babl_format ("R'G'B'A float");
+ else
+ format = babl_format ("RGBA float");
+ }
+ else
+ {
+ format = babl_format ("RGBA float");
+ }
+
+ gegl_operation_set_format (operation, "input", format);
+ gegl_operation_set_format (operation, "aux", format);
+ gegl_operation_set_format (operation, "output", format);
}
static gboolean
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]