mirror of
https://gitlab.gnome.org/GNOME/gimp.git
synced 2025-07-04 09:53:25 +00:00
create a channel which the size of the layer, not of the image...
2003-10-06 Michael Natterer <mitch@gimp.org> * app/core/gimpchannel.c (gimp_channel_new_from_alpha): create a channel which the size of the layer, not of the image... * app/core/gimpchannel-select.c (gimp_channel_select_alpha): ...and take the layer's offsets into account. * app/core/gimpscanconvert.[ch] (gimp_scan_convert_render): added off_x and off_y parameters and don't use the passed TileManager's offsets. * app/core/gimpchannel-select.c * app/core/gimpdrawable-stroke.c * app/tools/gimpiscissorstool.c: changed accordingly.
This commit is contained in:
parent
8c4dd58bfe
commit
d734595991
7 changed files with 44 additions and 35 deletions
16
ChangeLog
16
ChangeLog
|
@ -1,3 +1,19 @@
|
||||||
|
2003-10-06 Michael Natterer <mitch@gimp.org>
|
||||||
|
|
||||||
|
* app/core/gimpchannel.c (gimp_channel_new_from_alpha): create
|
||||||
|
a channel which the size of the layer, not of the image...
|
||||||
|
|
||||||
|
* app/core/gimpchannel-select.c (gimp_channel_select_alpha):
|
||||||
|
...and take the layer's offsets into account.
|
||||||
|
|
||||||
|
* app/core/gimpscanconvert.[ch] (gimp_scan_convert_render): added
|
||||||
|
off_x and off_y parameters and don't use the passed TileManager's
|
||||||
|
offsets.
|
||||||
|
|
||||||
|
* app/core/gimpchannel-select.c
|
||||||
|
* app/core/gimpdrawable-stroke.c
|
||||||
|
* app/tools/gimpiscissorstool.c: changed accordingly.
|
||||||
|
|
||||||
2003-10-06 Michael Natterer <mitch@gimp.org>
|
2003-10-06 Michael Natterer <mitch@gimp.org>
|
||||||
|
|
||||||
* app/app_procs.c (app_init): fixed starting with --no-splash.
|
* app/app_procs.c (app_init): fixed starting with --no-splash.
|
||||||
|
|
|
@ -171,7 +171,7 @@ gimp_channel_select_polygon (GimpChannel *channel,
|
||||||
gimp_item_height (item));
|
gimp_item_height (item));
|
||||||
gimp_scan_convert_render (scan_convert,
|
gimp_scan_convert_render (scan_convert,
|
||||||
gimp_drawable_data (GIMP_DRAWABLE (add_on)),
|
gimp_drawable_data (GIMP_DRAWABLE (add_on)),
|
||||||
antialias);
|
0, 0, antialias);
|
||||||
|
|
||||||
gimp_scan_convert_free (scan_convert);
|
gimp_scan_convert_free (scan_convert);
|
||||||
|
|
||||||
|
@ -255,7 +255,7 @@ gimp_channel_select_vectors (GimpChannel *channel,
|
||||||
|
|
||||||
gimp_scan_convert_render (scan_convert,
|
gimp_scan_convert_render (scan_convert,
|
||||||
gimp_drawable_data (GIMP_DRAWABLE (add_on)),
|
gimp_drawable_data (GIMP_DRAWABLE (add_on)),
|
||||||
antialias);
|
0, 0, antialias);
|
||||||
|
|
||||||
if (feather)
|
if (feather)
|
||||||
gimp_channel_feather (add_on,
|
gimp_channel_feather (add_on,
|
||||||
|
@ -330,6 +330,7 @@ gimp_channel_select_alpha (GimpChannel *channel,
|
||||||
GimpItem *item;
|
GimpItem *item;
|
||||||
GimpChannel *add_on;
|
GimpChannel *add_on;
|
||||||
GimpRGB color;
|
GimpRGB color;
|
||||||
|
gint off_x, off_y;
|
||||||
|
|
||||||
g_return_if_fail (GIMP_IS_CHANNEL (channel));
|
g_return_if_fail (GIMP_IS_CHANNEL (channel));
|
||||||
g_return_if_fail (GIMP_IS_LAYER (layer));
|
g_return_if_fail (GIMP_IS_LAYER (layer));
|
||||||
|
@ -347,8 +348,10 @@ gimp_channel_select_alpha (GimpChannel *channel,
|
||||||
feather_radius_y,
|
feather_radius_y,
|
||||||
FALSE /* no undo */);
|
FALSE /* no undo */);
|
||||||
|
|
||||||
|
gimp_item_offsets (GIMP_ITEM (layer), &off_x, &off_y);
|
||||||
|
|
||||||
gimp_channel_select_channel (channel, _("Alpha to Selection"), add_on,
|
gimp_channel_select_channel (channel, _("Alpha to Selection"), add_on,
|
||||||
0, 0, op,
|
off_x, off_y, op,
|
||||||
FALSE, 0.0, 0.0);
|
FALSE, 0.0, 0.0);
|
||||||
|
|
||||||
g_object_unref (add_on);
|
g_object_unref (add_on);
|
||||||
|
|
|
@ -1399,42 +1399,30 @@ gimp_channel_new_from_alpha (GimpImage *gimage,
|
||||||
const GimpRGB *color)
|
const GimpRGB *color)
|
||||||
{
|
{
|
||||||
GimpChannel *channel;
|
GimpChannel *channel;
|
||||||
gint x, y;
|
|
||||||
gint width;
|
gint width;
|
||||||
gint height;
|
gint height;
|
||||||
|
PixelRegion srcPR, destPR;
|
||||||
|
|
||||||
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
|
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
|
||||||
g_return_val_if_fail (GIMP_IS_LAYER (layer), NULL);
|
g_return_val_if_fail (GIMP_IS_LAYER (layer), NULL);
|
||||||
g_return_val_if_fail (gimp_drawable_has_alpha (GIMP_DRAWABLE (layer)), NULL);
|
g_return_val_if_fail (gimp_drawable_has_alpha (GIMP_DRAWABLE (layer)), NULL);
|
||||||
g_return_val_if_fail (color != NULL, NULL);
|
g_return_val_if_fail (color != NULL, NULL);
|
||||||
|
|
||||||
width = gimp_image_get_width (gimage);
|
width = gimp_item_width (GIMP_ITEM (layer));
|
||||||
height = gimp_image_get_height (gimage);
|
height = gimp_item_height (GIMP_ITEM (layer));
|
||||||
|
|
||||||
channel = gimp_channel_new (gimage, width, height, name, color);
|
channel = gimp_channel_new (gimage, width, height, name, color);
|
||||||
|
|
||||||
gimp_channel_clear (channel, NULL, FALSE);
|
gimp_channel_clear (channel, NULL, FALSE);
|
||||||
|
|
||||||
if (gimp_rectangle_intersect (0, 0, width, height,
|
pixel_region_init (&srcPR, gimp_drawable_data (GIMP_DRAWABLE (layer)),
|
||||||
GIMP_ITEM (layer)->offset_x,
|
0, 0, width, height, FALSE);
|
||||||
GIMP_ITEM (layer)->offset_y,
|
pixel_region_init (&destPR, gimp_drawable_data (GIMP_DRAWABLE (channel)),
|
||||||
GIMP_ITEM (layer)->width,
|
0, 0, width, height, TRUE);
|
||||||
GIMP_ITEM (layer)->height,
|
|
||||||
&x, &y, &width, &height))
|
|
||||||
{
|
|
||||||
PixelRegion srcPR, destPR;
|
|
||||||
|
|
||||||
pixel_region_init (&srcPR, GIMP_DRAWABLE (layer)->tiles,
|
|
||||||
x - GIMP_ITEM (layer)->offset_x,
|
|
||||||
y - GIMP_ITEM (layer)->offset_y,
|
|
||||||
width, height, FALSE);
|
|
||||||
pixel_region_init (&destPR, GIMP_DRAWABLE (channel)->tiles,
|
|
||||||
x, y, width, height, TRUE);
|
|
||||||
|
|
||||||
extract_alpha_region (&srcPR, NULL, &destPR);
|
extract_alpha_region (&srcPR, NULL, &destPR);
|
||||||
|
|
||||||
channel->bounds_known = FALSE;
|
channel->bounds_known = FALSE;
|
||||||
}
|
|
||||||
|
|
||||||
return channel;
|
return channel;
|
||||||
}
|
}
|
||||||
|
|
|
@ -262,12 +262,13 @@ gimp_drawable_stroke_scan_convert (GimpDrawable *drawable,
|
||||||
* of the stroke.
|
* of the stroke.
|
||||||
*/
|
*/
|
||||||
mask = tile_manager_new (w, h, 1);
|
mask = tile_manager_new (w, h, 1);
|
||||||
tile_manager_set_offsets (mask, x1 + x2, y1 + y2);
|
|
||||||
pixel_region_init (&maskPR, mask, 0, 0, w, h, TRUE);
|
pixel_region_init (&maskPR, mask, 0, 0, w, h, TRUE);
|
||||||
color_region (&maskPR, bg);
|
color_region (&maskPR, bg);
|
||||||
|
|
||||||
/* render the stroke into it */
|
/* render the stroke into it */
|
||||||
gimp_scan_convert_render (scan_convert, mask, options->antialias);
|
gimp_scan_convert_render (scan_convert, mask,
|
||||||
|
x1 + x2, y1 + y2,
|
||||||
|
options->antialias);
|
||||||
|
|
||||||
bytes = drawable->bytes;
|
bytes = drawable->bytes;
|
||||||
if (!gimp_drawable_has_alpha (drawable))
|
if (!gimp_drawable_has_alpha (drawable))
|
||||||
|
|
|
@ -353,12 +353,13 @@ gimp_scan_convert_stroke (GimpScanConvert *sc,
|
||||||
void
|
void
|
||||||
gimp_scan_convert_render (GimpScanConvert *sc,
|
gimp_scan_convert_render (GimpScanConvert *sc,
|
||||||
TileManager *tile_manager,
|
TileManager *tile_manager,
|
||||||
|
gint off_x,
|
||||||
|
gint off_y,
|
||||||
gboolean antialias)
|
gboolean antialias)
|
||||||
{
|
{
|
||||||
PixelRegion maskPR;
|
PixelRegion maskPR;
|
||||||
gpointer pr;
|
gpointer pr;
|
||||||
|
gint i, j;
|
||||||
gint i, j, x0, y0;
|
|
||||||
guchar *dest, *d;
|
guchar *dest, *d;
|
||||||
|
|
||||||
g_return_if_fail (sc != NULL);
|
g_return_if_fail (sc != NULL);
|
||||||
|
@ -366,8 +367,6 @@ gimp_scan_convert_render (GimpScanConvert *sc,
|
||||||
|
|
||||||
gimp_scan_convert_finish (sc);
|
gimp_scan_convert_finish (sc);
|
||||||
|
|
||||||
tile_manager_get_offsets (tile_manager, &x0, &y0);
|
|
||||||
|
|
||||||
pixel_region_init (&maskPR, tile_manager, 0, 0,
|
pixel_region_init (&maskPR, tile_manager, 0, 0,
|
||||||
tile_manager_width (tile_manager),
|
tile_manager_width (tile_manager),
|
||||||
tile_manager_height (tile_manager),
|
tile_manager_height (tile_manager),
|
||||||
|
@ -380,10 +379,10 @@ gimp_scan_convert_render (GimpScanConvert *sc,
|
||||||
pr = pixel_regions_process (pr))
|
pr = pixel_regions_process (pr))
|
||||||
{
|
{
|
||||||
art_gray_svp_aa (sc->svp,
|
art_gray_svp_aa (sc->svp,
|
||||||
x0 + maskPR.x,
|
off_x + maskPR.x,
|
||||||
y0 + maskPR.y,
|
off_y + maskPR.y,
|
||||||
x0 + maskPR.x + maskPR.w,
|
off_x + maskPR.x + maskPR.w,
|
||||||
y0 + maskPR.y + maskPR.h,
|
off_y + maskPR.y + maskPR.h,
|
||||||
maskPR.data, maskPR.rowstride);
|
maskPR.data, maskPR.rowstride);
|
||||||
|
|
||||||
if (! antialias)
|
if (! antialias)
|
||||||
|
|
|
@ -81,6 +81,8 @@ void gimp_scan_convert_stroke (GimpScanConvert *sc,
|
||||||
*/
|
*/
|
||||||
void gimp_scan_convert_render (GimpScanConvert *scan_converter,
|
void gimp_scan_convert_render (GimpScanConvert *scan_converter,
|
||||||
TileManager *tile_manager,
|
TileManager *tile_manager,
|
||||||
|
gint off_x,
|
||||||
|
gint off_y,
|
||||||
gboolean antialias);
|
gboolean antialias);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -568,7 +568,7 @@ iscissors_convert (GimpIscissorsTool *iscissors,
|
||||||
iscissors->mask = gimp_channel_new_mask (gdisp->gimage,
|
iscissors->mask = gimp_channel_new_mask (gdisp->gimage,
|
||||||
gdisp->gimage->width,
|
gdisp->gimage->width,
|
||||||
gdisp->gimage->height);
|
gdisp->gimage->height);
|
||||||
gimp_scan_convert_render (sc, GIMP_DRAWABLE (iscissors)->tiles, TRUE);
|
gimp_scan_convert_render (sc, GIMP_DRAWABLE (iscissors)->tiles, 0, 0, TRUE);
|
||||||
gimp_scan_convert_free (sc);
|
gimp_scan_convert_free (sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue