set the transformed color's alpha to OPAQUE so it works with

2003-09-27  Michael Natterer  <mitch@gimp.org>

	* app/core/gimpdrawable-bucket-fill.c
	(gimp_drawable_bucket_fill_full): set the transformed color's
	alpha to OPAQUE so it works with color_region().

	* app/core/gimpdrawable-stroke.c (gimp_drawable_stroke_vectors):
	no need to transform the color into a newly allocated array,
	simply use guchar[MAX_CHANNELS] instead.

	Cleaned up both functions to use RED_PIX, GREEN_PIX and BLUE_PIX
	instead of 0, 1 and 2.
This commit is contained in:
Michael Natterer
2003-09-27 20:42:31 +00:00
committed by Michael Natterer
parent ab34b3ee94
commit f5b98a4822
3 changed files with 30 additions and 14 deletions

View File

@ -1,3 +1,16 @@
2003-09-27 Michael Natterer <mitch@gimp.org>
* app/core/gimpdrawable-bucket-fill.c
(gimp_drawable_bucket_fill_full): set the transformed color's
alpha to OPAQUE so it works with color_region().
* app/core/gimpdrawable-stroke.c (gimp_drawable_stroke_vectors):
no need to transform the color into a newly allocated array,
simply use guchar[MAX_CHANNELS] instead.
Cleaned up both functions to use RED_PIX, GREEN_PIX and BLUE_PIX
instead of 0, 1 and 2.
2003-09-27 Michael Natterer <mitch@gimp.org>
* app/paint-funcs/paint-funcs.[ch]: added new functions

View File

@ -134,8 +134,8 @@ gimp_drawable_bucket_fill_full (GimpDrawable *drawable,
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
g_return_if_fail (fill_mode != GIMP_PATTERN_BUCKET_FILL ||
GIMP_IS_PATTERN (pattern));
g_return_if_fail ((fill_mode != GIMP_FG_BUCKET_FILL &&
fill_mode != GIMP_BG_BUCKET_FILL) || color != NULL);
g_return_if_fail (fill_mode == GIMP_PATTERN_BUCKET_FILL ||
color != NULL);
gimage = gimp_item_get_image (GIMP_ITEM (drawable));
@ -146,9 +146,13 @@ gimp_drawable_bucket_fill_full (GimpDrawable *drawable,
{
guchar tmp_col[MAX_CHANNELS];
gimp_rgb_get_uchar (color, &tmp_col[0], &tmp_col[1], &tmp_col[2]);
gimp_rgb_get_uchar (color,
&tmp_col[RED_PIX],
&tmp_col[GREEN_PIX],
&tmp_col[BLUE_PIX]);
gimp_image_transform_color (gimage, drawable, col, GIMP_RGB, tmp_col);
col[gimp_drawable_bytes_with_alpha (drawable) - 1] = OPAQUE_OPACITY;
}
else if (fill_mode == GIMP_PATTERN_BUCKET_FILL)
{
@ -245,7 +249,7 @@ gimp_drawable_bucket_fill_full (GimpDrawable *drawable,
*/
if (! has_alpha)
{
bytes ++;
bytes++;
has_alpha = TRUE;
}
}

View File

@ -186,22 +186,21 @@ gimp_drawable_stroke_vectors (GimpDrawable *drawable,
case GIMP_STROKE_STYLE_SOLID:
{
GimpRGB *color;
guchar ucolor[4] = { 0, 0, 0, OPAQUE_OPACITY };
guchar *src_bytes;
guchar tmp_col[MAX_CHANNELS] = { 0, };
guchar col[MAX_CHANNELS] = { 0, };
g_object_get (options, "foreground", &color, NULL);
gimp_rgb_get_uchar (color, ucolor + 0, ucolor + 1, ucolor + 2);
gimp_rgb_get_uchar (color,
&tmp_col[RED_PIX],
&tmp_col[GREEN_PIX],
&tmp_col[BLUE_PIX]);
g_free (color);
src_bytes = g_malloc0 (bytes);
src_bytes[bytes - 1] = OPAQUE_OPACITY;
gimp_image_transform_color (GIMP_ITEM (drawable)->gimage, drawable,
src_bytes, GIMP_RGB, ucolor);
col, GIMP_RGB, tmp_col);
col[bytes - 1] = OPAQUE_OPACITY;
color_region_mask (&basePR, &maskPR, src_bytes);
g_free (src_bytes);
color_region_mask (&basePR, &maskPR, col);
}
break;