[gimp] app: add gimp_drawable_filter_get_{drawable, operation, format}()



commit 9aee8744dc43adcc2fd60e9dc0850b5ee1542e03
Author: Ell <ell_se yahoo com>
Date:   Mon Apr 6 22:41:49 2020 +0300

    app: add gimp_drawable_filter_get_{drawable,operation,format}()
    
    ... which return the filter's drawable, operation, and output
    format, respectively.

 app/core/gimpdrawablefilter.c | 33 ++++++++++++++++++++++++++++++++-
 app/core/gimpdrawablefilter.h |  7 +++++++
 2 files changed, 39 insertions(+), 1 deletion(-)
---
diff --git a/app/core/gimpdrawablefilter.c b/app/core/gimpdrawablefilter.c
index 2ad35a6838..0e2a755876 100644
--- a/app/core/gimpdrawablefilter.c
+++ b/app/core/gimpdrawablefilter.c
@@ -282,6 +282,22 @@ gimp_drawable_filter_new (GimpDrawable *drawable,
   return filter;
 }
 
+GimpDrawable *
+gimp_drawable_filter_get_drawable (GimpDrawableFilter *filter)
+{
+  g_return_val_if_fail (GIMP_IS_DRAWABLE_FILTER (filter), NULL);
+
+  return filter->drawable;
+}
+
+GeglNode *
+gimp_drawable_filter_get_operation (GimpDrawableFilter *filter)
+{
+  g_return_val_if_fail (GIMP_IS_DRAWABLE_FILTER (filter), NULL);
+
+  return filter->operation;
+}
+
 void
 gimp_drawable_filter_set_clip (GimpDrawableFilter *filter,
                                gboolean            clip)
@@ -499,6 +515,21 @@ gimp_drawable_filter_set_override_constraints (GimpDrawableFilter *filter,
     }
 }
 
+const Babl *
+gimp_drawable_filter_get_format (GimpDrawableFilter *filter)
+{
+  const Babl *format;
+
+  g_return_val_if_fail (GIMP_IS_DRAWABLE_FILTER (filter), NULL);
+
+  format = gimp_applicator_get_output_format (filter->applicator);
+
+  if (! format)
+    format = gimp_drawable_get_format (filter->drawable);
+
+  return format;
+}
+
 void
 gimp_drawable_filter_apply (GimpDrawableFilter  *filter,
                             const GeglRectangle *area)
@@ -534,7 +565,7 @@ gimp_drawable_filter_commit (GimpDrawableFilter *filter,
     {
       const Babl *format;
 
-      format = gimp_applicator_get_output_format (filter->applicator);
+      format = gimp_drawable_filter_get_format (filter);
 
       gimp_drawable_filter_set_preview_split (filter, FALSE,
                                               filter->preview_split_alignment,
diff --git a/app/core/gimpdrawablefilter.h b/app/core/gimpdrawablefilter.h
index 2bd4812074..7e68cc9a2d 100644
--- a/app/core/gimpdrawablefilter.h
+++ b/app/core/gimpdrawablefilter.h
@@ -55,6 +55,10 @@ GimpDrawableFilter *
                                                 GeglNode            *operation,
                                                 const gchar         *icon_name);
 
+GimpDrawable *
+           gimp_drawable_filter_get_drawable   (GimpDrawableFilter  *filter);
+GeglNode * gimp_drawable_filter_get_operation  (GimpDrawableFilter  *filter);
+
 void       gimp_drawable_filter_set_clip       (GimpDrawableFilter  *filter,
                                                 gboolean             clip);
 void       gimp_drawable_filter_set_region     (GimpDrawableFilter  *filter,
@@ -86,6 +90,9 @@ void       gimp_drawable_filter_set_override_constraints
                                                (GimpDrawableFilter  *filter,
                                                 gboolean             override_constraints);
 
+const Babl *
+           gimp_drawable_filter_get_format     (GimpDrawableFilter  *filter);
+
 void       gimp_drawable_filter_apply          (GimpDrawableFilter  *filter,
                                                 const GeglRectangle *area);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]