[gimp/soc-2011-seamless-clone2] app: sense the input format in gimp:mask-components
- From: Clayton Walker <claytonw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/soc-2011-seamless-clone2] app: sense the input format in gimp:mask-components
- Date: Wed, 8 May 2013 15:20:31 +0000 (UTC)
commit 85c9b6c98baf4bf3ef1150bb86437afb0d3e62ac
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]