[gimp] app: change the value to render in the GimpScanConvert API to a 0..1 double



commit c4142d05745efe2155cf33f18c9b5d4892992292
Author: Michael Natterer <mitch gimp org>
Date:   Sun May 13 23:13:53 2012 +0200

    app: change the value to render in the GimpScanConvert API to a 0..1 double

 app/core/gimpscanconvert.c           |   12 ++++++------
 app/core/gimpscanconvert.h           |    6 +++---
 app/tools/gimpforegroundselecttool.c |    6 +++---
 3 files changed, 12 insertions(+), 12 deletions(-)
---
diff --git a/app/core/gimpscanconvert.c b/app/core/gimpscanconvert.c
index 28e7426..662f5a6 100644
--- a/app/core/gimpscanconvert.c
+++ b/app/core/gimpscanconvert.c
@@ -345,7 +345,7 @@ gimp_scan_convert_render (GimpScanConvert *sc,
                           gboolean         antialias)
 {
   gimp_scan_convert_render_full (sc, buffer, off_x, off_y,
-                                 TRUE, antialias, 255);
+                                 TRUE, antialias, 1.0);
 }
 
 /**
@@ -368,7 +368,7 @@ gimp_scan_convert_render_value (GimpScanConvert *sc,
                                 GeglBuffer      *buffer,
                                 gint             off_x,
                                 gint             off_y,
-                                guchar           value)
+                                gdouble          value)
 {
   gimp_scan_convert_render_full (sc, buffer, off_x, off_y,
                                  TRUE, FALSE, value);
@@ -393,7 +393,7 @@ gimp_scan_convert_compose (GimpScanConvert *sc,
                            gint             off_y)
 {
   gimp_scan_convert_render_full (sc, buffer, off_x, off_y,
-                                 FALSE, FALSE, 255);
+                                 FALSE, FALSE, 1.0);
 }
 
 /**
@@ -415,7 +415,7 @@ gimp_scan_convert_compose_value (GimpScanConvert *sc,
                                  GeglBuffer      *buffer,
                                  gint             off_x,
                                  gint             off_y,
-                                 gint             value)
+                                 gdouble          value)
 {
   gimp_scan_convert_render_full (sc, buffer, off_x, off_y,
                                  FALSE, FALSE, value);
@@ -446,7 +446,7 @@ gimp_scan_convert_render_full (GimpScanConvert *sc,
                                gint             off_y,
                                gboolean         replace,
                                gboolean         antialias,
-                               guchar           value)
+                               gdouble          value)
 {
   const Babl         *format;
   GeglBufferIterator *iter;
@@ -534,7 +534,7 @@ gimp_scan_convert_render_full (GimpScanConvert *sc,
           cairo_paint (cr);
         }
 
-      cairo_set_source_rgba (cr, 0, 0, 0, value / 255.0);
+      cairo_set_source_rgba (cr, 0, 0, 0, value);
       cairo_append_path (cr, &path);
 
       cairo_set_antialias (cr, antialias ?
diff --git a/app/core/gimpscanconvert.h b/app/core/gimpscanconvert.h
index b717ed2..53fc94e 100644
--- a/app/core/gimpscanconvert.h
+++ b/app/core/gimpscanconvert.h
@@ -48,7 +48,7 @@ void      gimp_scan_convert_render_full        (GimpScanConvert   *sc,
                                                 gint               off_y,
                                                 gboolean           replace,
                                                 gboolean           antialias,
-                                                guchar             value);
+                                                gdouble            value);
 
 void      gimp_scan_convert_render             (GimpScanConvert   *sc,
                                                 GeglBuffer        *buffer,
@@ -59,7 +59,7 @@ void      gimp_scan_convert_render_value       (GimpScanConvert   *sc,
                                                 GeglBuffer        *buffer,
                                                 gint               off_x,
                                                 gint               off_y,
-                                                guchar             value);
+                                                gdouble            value);
 void      gimp_scan_convert_compose            (GimpScanConvert   *sc,
                                                 GeglBuffer        *buffer,
                                                 gint               off_x,
@@ -68,7 +68,7 @@ void      gimp_scan_convert_compose_value      (GimpScanConvert   *sc,
                                                 GeglBuffer        *buffer,
                                                 gint               off_x,
                                                 gint               off_y,
-                                                gint               value);
+                                                gdouble            value);
 
 
 #endif /* __GIMP_SCAN_CONVERT_H__ */
diff --git a/app/tools/gimpforegroundselecttool.c b/app/tools/gimpforegroundselecttool.c
index 8b39cb2..51f12a7 100644
--- a/app/tools/gimpforegroundselecttool.c
+++ b/app/tools/gimpforegroundselecttool.c
@@ -634,7 +634,7 @@ gimp_foreground_select_tool_select (GimpFreeSelectTool *free_sel,
 
   gimp_scan_convert_render_value (scan_convert,
                                   gimp_drawable_get_buffer (GIMP_DRAWABLE (mask)),
-                                  0, 0, 128);
+                                  0, 0, 0.5);
   gimp_scan_convert_free (scan_convert);
 
   if (fg_select->strokes)
@@ -789,8 +789,8 @@ gimp_foreground_select_tool_stroke (GimpChannel    *mask,
                             GIMP_JOIN_ROUND, GIMP_CAP_ROUND, 10.0,
                             0.0, NULL);
   gimp_scan_convert_compose_value (scan_convert,
-                             gimp_drawable_get_buffer (GIMP_DRAWABLE (mask)),
-                             0, 0, stroke->background ? 0 : 255);
+                                   gimp_drawable_get_buffer (GIMP_DRAWABLE (mask)),
+                                   0, 0, stroke->background ? 0.0 : 1.0);
   gimp_scan_convert_free (scan_convert);
 }
 



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