[gimp/goat-invasion: 133/241] app: make gimp_image_transform_rgb() transform the alpha too
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/goat-invasion: 133/241] app: make gimp_image_transform_rgb() transform the alpha too
- Date: Sat, 24 Mar 2012 20:53:59 +0000 (UTC)
commit bc028f4330108e702a8816c6a18f95bed39ab563
Author: Michael Natterer <mitch gimp org>
Date: Sun Mar 18 17:58:01 2012 +0100
app: make gimp_image_transform_rgb() transform the alpha too
and remove explicit alpha setting in the returned array in most places.
app/core/gimpdrawable-bucket-fill.c | 1 -
app/core/gimpdrawable-stroke.c | 1 -
app/core/gimpimage.c | 8 ++++----
app/paint/gimperaser.c | 3 ---
app/paint/gimpink.c | 3 ---
app/paint/gimppaintbrush.c | 6 ++----
6 files changed, 6 insertions(+), 16 deletions(-)
---
diff --git a/app/core/gimpdrawable-bucket-fill.c b/app/core/gimpdrawable-bucket-fill.c
index ddf34d5..90dbcfd 100644
--- a/app/core/gimpdrawable-bucket-fill.c
+++ b/app/core/gimpdrawable-bucket-fill.c
@@ -154,7 +154,6 @@ gimp_drawable_bucket_fill_full (GimpDrawable *drawable,
{
gimp_image_transform_rgb (image, gimp_drawable_type (drawable),
color, col);
- col[gimp_drawable_bytes_with_alpha (drawable) - 1] = OPAQUE_OPACITY;
}
else if (fill_mode == GIMP_PATTERN_BUCKET_FILL)
{
diff --git a/app/core/gimpdrawable-stroke.c b/app/core/gimpdrawable-stroke.c
index a63330e..400ea0a 100644
--- a/app/core/gimpdrawable-stroke.c
+++ b/app/core/gimpdrawable-stroke.c
@@ -371,7 +371,6 @@ gimp_drawable_stroke_scan_convert (GimpDrawable *drawable,
gimp_image_get_foreground (image, context,
gimp_drawable_type (drawable), col);
- col[bytes - 1] = OPAQUE_OPACITY;
color_region_mask (&basePR, &maskPR, col);
}
diff --git a/app/core/gimpimage.c b/app/core/gimpimage.c
index cff6fe7..4516dd7 100644
--- a/app/core/gimpimage.c
+++ b/app/core/gimpimage.c
@@ -2727,17 +2727,17 @@ gimp_image_transform_rgb (const GimpImage *dest_image,
guchar *color)
{
const Babl *dest_format;
- guchar col[3];
+ guchar col[4];
g_return_if_fail (GIMP_IS_IMAGE (dest_image));
g_return_if_fail (rgb != NULL);
g_return_if_fail (color != NULL);
- dest_format = gimp_image_get_format_without_alpha (dest_image, dest_type);
+ dest_format = gimp_image_get_format_with_alpha (dest_image, dest_type);
- gimp_rgb_get_uchar (rgb, &col[0], &col[1], &col[2]);
+ gimp_rgba_get_uchar (rgb, &col[0], &col[1], &col[2], &col[3]);
- babl_process (babl_fish (babl_format ("RGB u8"), dest_format),
+ babl_process (babl_fish (babl_format ("RGBA u8"), dest_format),
col, color, 1);
}
diff --git a/app/paint/gimperaser.c b/app/paint/gimperaser.c
index 6a8ca68..537ab5d 100644
--- a/app/paint/gimperaser.c
+++ b/app/paint/gimperaser.c
@@ -141,9 +141,6 @@ gimp_eraser_motion (GimpPaintCore *paint_core,
gimp_image_get_background (image, context, gimp_drawable_type (drawable),
col);
- /* set the alpha channel */
- col[area->bytes - 1] = OPAQUE_OPACITY;
-
/* color the pixels */
color_pixels (temp_buf_get_data (area), col,
area->width * area->height, area->bytes);
diff --git a/app/paint/gimpink.c b/app/paint/gimpink.c
index 455549c..c696270 100644
--- a/app/paint/gimpink.c
+++ b/app/paint/gimpink.c
@@ -305,9 +305,6 @@ gimp_ink_motion (GimpPaintCore *paint_core,
gimp_image_get_foreground (image, context, gimp_drawable_type (drawable),
col);
- /* set the alpha channel */
- col[paint_core->canvas_buf->bytes - 1] = OPAQUE_OPACITY;
-
/* color the pixels */
color_pixels (temp_buf_get_data (paint_core->canvas_buf), col,
area->width * area->height, area->bytes);
diff --git a/app/paint/gimppaintbrush.c b/app/paint/gimppaintbrush.c
index 26fcfa8..3c60eb9 100644
--- a/app/paint/gimppaintbrush.c
+++ b/app/paint/gimppaintbrush.c
@@ -123,10 +123,7 @@ _gimp_paintbrush_motion (GimpPaintCore *paint_core,
gdouble fade_point;
gdouble grad_point;
gdouble force;
- guchar pixel[MAX_CHANNELS] = { OPAQUE_OPACITY,
- OPAQUE_OPACITY,
- OPAQUE_OPACITY,
- OPAQUE_OPACITY };
+ guchar pixel[MAX_CHANNELS];
image = gimp_item_get_image (GIMP_ITEM (drawable));
@@ -166,6 +163,7 @@ _gimp_paintbrush_motion (GimpPaintCore *paint_core,
/* optionally take the color from the current gradient */
opacity *= gradient_color.a;
+ gimp_rgb_set_alpha (&gradient_color, GIMP_OPACITY_OPAQUE);
gimp_image_transform_rgb (image, gimp_drawable_type (drawable),
&gradient_color, pixel);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]