mirror of
https://gitlab.gnome.org/GNOME/gimp
synced 2024-10-22 04:22:29 +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
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>
|
||||
|
||||
* 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_scan_convert_render (scan_convert,
|
||||
gimp_drawable_data (GIMP_DRAWABLE (add_on)),
|
||||
antialias);
|
||||
0, 0, antialias);
|
||||
|
||||
gimp_scan_convert_free (scan_convert);
|
||||
|
||||
|
@ -255,7 +255,7 @@ gimp_channel_select_vectors (GimpChannel *channel,
|
|||
|
||||
gimp_scan_convert_render (scan_convert,
|
||||
gimp_drawable_data (GIMP_DRAWABLE (add_on)),
|
||||
antialias);
|
||||
0, 0, antialias);
|
||||
|
||||
if (feather)
|
||||
gimp_channel_feather (add_on,
|
||||
|
@ -330,6 +330,7 @@ gimp_channel_select_alpha (GimpChannel *channel,
|
|||
GimpItem *item;
|
||||
GimpChannel *add_on;
|
||||
GimpRGB color;
|
||||
gint off_x, off_y;
|
||||
|
||||
g_return_if_fail (GIMP_IS_CHANNEL (channel));
|
||||
g_return_if_fail (GIMP_IS_LAYER (layer));
|
||||
|
@ -347,8 +348,10 @@ gimp_channel_select_alpha (GimpChannel *channel,
|
|||
feather_radius_y,
|
||||
FALSE /* no undo */);
|
||||
|
||||
gimp_item_offsets (GIMP_ITEM (layer), &off_x, &off_y);
|
||||
|
||||
gimp_channel_select_channel (channel, _("Alpha to Selection"), add_on,
|
||||
0, 0, op,
|
||||
off_x, off_y, op,
|
||||
FALSE, 0.0, 0.0);
|
||||
|
||||
g_object_unref (add_on);
|
||||
|
|
|
@ -1399,42 +1399,30 @@ gimp_channel_new_from_alpha (GimpImage *gimage,
|
|||
const GimpRGB *color)
|
||||
{
|
||||
GimpChannel *channel;
|
||||
gint x, y;
|
||||
gint width;
|
||||
gint height;
|
||||
PixelRegion srcPR, destPR;
|
||||
|
||||
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_drawable_has_alpha (GIMP_DRAWABLE (layer)), NULL);
|
||||
g_return_val_if_fail (color != NULL, NULL);
|
||||
|
||||
width = gimp_image_get_width (gimage);
|
||||
height = gimp_image_get_height (gimage);
|
||||
width = gimp_item_width (GIMP_ITEM (layer));
|
||||
height = gimp_item_height (GIMP_ITEM (layer));
|
||||
|
||||
channel = gimp_channel_new (gimage, width, height, name, color);
|
||||
|
||||
gimp_channel_clear (channel, NULL, FALSE);
|
||||
|
||||
if (gimp_rectangle_intersect (0, 0, width, height,
|
||||
GIMP_ITEM (layer)->offset_x,
|
||||
GIMP_ITEM (layer)->offset_y,
|
||||
GIMP_ITEM (layer)->width,
|
||||
GIMP_ITEM (layer)->height,
|
||||
&x, &y, &width, &height))
|
||||
{
|
||||
PixelRegion srcPR, destPR;
|
||||
pixel_region_init (&srcPR, gimp_drawable_data (GIMP_DRAWABLE (layer)),
|
||||
0, 0, width, height, FALSE);
|
||||
pixel_region_init (&destPR, gimp_drawable_data (GIMP_DRAWABLE (channel)),
|
||||
0, 0, width, height, TRUE);
|
||||
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -262,12 +262,13 @@ gimp_drawable_stroke_scan_convert (GimpDrawable *drawable,
|
|||
* of the stroke.
|
||||
*/
|
||||
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);
|
||||
color_region (&maskPR, bg);
|
||||
|
||||
/* 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;
|
||||
if (!gimp_drawable_has_alpha (drawable))
|
||||
|
|
|
@ -353,12 +353,13 @@ gimp_scan_convert_stroke (GimpScanConvert *sc,
|
|||
void
|
||||
gimp_scan_convert_render (GimpScanConvert *sc,
|
||||
TileManager *tile_manager,
|
||||
gint off_x,
|
||||
gint off_y,
|
||||
gboolean antialias)
|
||||
{
|
||||
PixelRegion maskPR;
|
||||
gpointer pr;
|
||||
|
||||
gint i, j, x0, y0;
|
||||
gint i, j;
|
||||
guchar *dest, *d;
|
||||
|
||||
g_return_if_fail (sc != NULL);
|
||||
|
@ -366,8 +367,6 @@ gimp_scan_convert_render (GimpScanConvert *sc,
|
|||
|
||||
gimp_scan_convert_finish (sc);
|
||||
|
||||
tile_manager_get_offsets (tile_manager, &x0, &y0);
|
||||
|
||||
pixel_region_init (&maskPR, tile_manager, 0, 0,
|
||||
tile_manager_width (tile_manager),
|
||||
tile_manager_height (tile_manager),
|
||||
|
@ -380,10 +379,10 @@ gimp_scan_convert_render (GimpScanConvert *sc,
|
|||
pr = pixel_regions_process (pr))
|
||||
{
|
||||
art_gray_svp_aa (sc->svp,
|
||||
x0 + maskPR.x,
|
||||
y0 + maskPR.y,
|
||||
x0 + maskPR.x + maskPR.w,
|
||||
y0 + maskPR.y + maskPR.h,
|
||||
off_x + maskPR.x,
|
||||
off_y + maskPR.y,
|
||||
off_x + maskPR.x + maskPR.w,
|
||||
off_y + maskPR.y + maskPR.h,
|
||||
maskPR.data, maskPR.rowstride);
|
||||
|
||||
if (! antialias)
|
||||
|
|
|
@ -81,6 +81,8 @@ void gimp_scan_convert_stroke (GimpScanConvert *sc,
|
|||
*/
|
||||
void gimp_scan_convert_render (GimpScanConvert *scan_converter,
|
||||
TileManager *tile_manager,
|
||||
gint off_x,
|
||||
gint off_y,
|
||||
gboolean antialias);
|
||||
|
||||
|
||||
|
|
|
@ -568,7 +568,7 @@ iscissors_convert (GimpIscissorsTool *iscissors,
|
|||
iscissors->mask = gimp_channel_new_mask (gdisp->gimage,
|
||||
gdisp->gimage->width,
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue