[gimp/goat-invasion: 327/526] app: remove gimp_image_get_foreground, background()



commit f481889fae8c133e217fd67fdfd92fc64124e562
Author: Michael Natterer <mitch gimp org>
Date:   Fri Mar 30 13:38:11 2012 +0200

    app: remove gimp_image_get_foreground,background()
    
    and use gimp_context_get_foreground,background_pixel() instead.

 app/core/gimpimage.c       |   34 ----------------------------------
 app/core/gimpimage.h       |    8 --------
 app/paint/gimperaser.c     |    8 +++-----
 app/paint/gimpink.c        |   14 ++++++--------
 app/paint/gimppaintbrush.c |    5 +++--
 5 files changed, 12 insertions(+), 57 deletions(-)
---
diff --git a/app/core/gimpimage.c b/app/core/gimpimage.c
index 6a51e06..c6575f3 100644
--- a/app/core/gimpimage.c
+++ b/app/core/gimpimage.c
@@ -2634,40 +2634,6 @@ gimp_image_inc_instance_count (GimpImage *image)
 /*  color transforms / utilities  */
 
 void
-gimp_image_get_foreground (const GimpImage *image,
-                           GimpContext     *context,
-                           GimpImageType    dest_type,
-                           guchar          *fg)
-{
-  GimpRGB color;
-
-  g_return_if_fail (GIMP_IS_IMAGE (image));
-  g_return_if_fail (GIMP_IS_CONTEXT (context));
-  g_return_if_fail (fg != NULL);
-
-  gimp_context_get_foreground (context, &color);
-
-  gimp_image_transform_rgb (image, dest_type, &color, fg);
-}
-
-void
-gimp_image_get_background (const GimpImage *image,
-                           GimpContext     *context,
-                           GimpImageType    dest_type,
-                           guchar          *bg)
-{
-  GimpRGB color;
-
-  g_return_if_fail (GIMP_IS_IMAGE (image));
-  g_return_if_fail (GIMP_IS_CONTEXT (context));
-  g_return_if_fail (bg != NULL);
-
-  gimp_context_get_background (context, &color);
-
-  gimp_image_transform_rgb (image, dest_type, &color, bg);
-}
-
-void
 gimp_image_transform_rgb (const GimpImage *dest_image,
                           GimpImageType    dest_type,
                           const GimpRGB   *rgb,
diff --git a/app/core/gimpimage.h b/app/core/gimpimage.h
index ceaf775..b8cd2f1 100644
--- a/app/core/gimpimage.h
+++ b/app/core/gimpimage.h
@@ -332,14 +332,6 @@ void            gimp_image_inc_instance_count    (GimpImage          *image);
 
 /*  color transforms / utilities  */
 
-void            gimp_image_get_foreground        (const GimpImage    *image,
-                                                  GimpContext        *context,
-                                                  GimpImageType       dest_type,
-                                                  guchar             *fg);
-void            gimp_image_get_background        (const GimpImage    *image,
-                                                  GimpContext        *context,
-                                                  GimpImageType       dest_type,
-                                                  guchar             *bg);
 void            gimp_image_transform_rgb         (const GimpImage    *dest_image,
                                                   GimpImageType       dest_type,
                                                   const GimpRGB      *rgb,
diff --git a/app/paint/gimperaser.c b/app/paint/gimperaser.c
index 537ab5d..3452d4c 100644
--- a/app/paint/gimperaser.c
+++ b/app/paint/gimperaser.c
@@ -110,15 +110,12 @@ gimp_eraser_motion (GimpPaintCore    *paint_core,
   GimpDynamics       *dynamics = GIMP_BRUSH_CORE (paint_core)->dynamics;
   GimpDynamicsOutput *opacity_output;
   GimpDynamicsOutput *force_output;
-  GimpImage          *image;
   gdouble             fade_point;
   gdouble             opacity;
   TempBuf            *area;
   guchar              col[MAX_CHANNELS];
   gdouble             force;
 
-  image = gimp_item_get_image (GIMP_ITEM (drawable));
-
   opacity_output = gimp_dynamics_get_output (dynamics,
                                              GIMP_DYNAMICS_OUTPUT_OPACITY);
 
@@ -138,8 +135,9 @@ gimp_eraser_motion (GimpPaintCore    *paint_core,
   if (! area)
     return;
 
-  gimp_image_get_background (image, context, gimp_drawable_type (drawable),
-                             col);
+  gimp_context_get_background_pixel (context,
+                                     gimp_drawable_get_format_with_alpha (drawable),
+                                     col);
 
   /*  color the pixels  */
   color_pixels (temp_buf_get_data (area), col,
diff --git a/app/paint/gimpink.c b/app/paint/gimpink.c
index c696270..43f26dd 100644
--- a/app/paint/gimpink.c
+++ b/app/paint/gimpink.c
@@ -246,18 +246,15 @@ gimp_ink_motion (GimpPaintCore    *paint_core,
                  const GimpCoords *coords,
                  guint32           time)
 {
-  GimpInk        *ink     = GIMP_INK (paint_core);
-  GimpInkOptions *options = GIMP_INK_OPTIONS (paint_options);
-  GimpContext    *context = GIMP_CONTEXT (paint_options);
-  GimpImage      *image;
+  GimpInk        *ink        = GIMP_INK (paint_core);
+  GimpInkOptions *options    = GIMP_INK_OPTIONS (paint_options);
+  GimpContext    *context    = GIMP_CONTEXT (paint_options);
   GimpBlob       *blob_union = NULL;
   GimpBlob       *blob_to_render;
   TempBuf        *area;
   guchar          col[MAX_CHANNELS];
   PixelRegion     blob_maskPR;
 
-  image = gimp_item_get_image (GIMP_ITEM (drawable));
-
   if (! ink->last_blob)
     {
       ink->last_blob = ink_pen_ellipse (options,
@@ -302,8 +299,9 @@ gimp_ink_motion (GimpPaintCore    *paint_core,
   if (! area)
     return;
 
-  gimp_image_get_foreground (image, context, gimp_drawable_type (drawable),
-                             col);
+  gimp_context_get_foreground_pixel (context,
+                                     gimp_drawable_get_format_with_alpha (drawable),
+                                     col);
 
   /*  color the pixels  */
   color_pixels (temp_buf_get_data (paint_core->canvas_buf), col,
diff --git a/app/paint/gimppaintbrush.c b/app/paint/gimppaintbrush.c
index 3c60eb9..24e1671 100644
--- a/app/paint/gimppaintbrush.c
+++ b/app/paint/gimppaintbrush.c
@@ -191,8 +191,9 @@ _gimp_paintbrush_motion (GimpPaintCore    *paint_core,
     {
       /* otherwise fill the area with the foreground color */
 
-      gimp_image_get_foreground (image, context, gimp_drawable_type (drawable),
-                                 pixel);
+      gimp_context_get_foreground_pixel (context,
+                                         gimp_drawable_get_format_with_alpha (drawable),
+                                         pixel);
 
       color_pixels (temp_buf_get_data (area), pixel,
                     area->width * area->height,



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