mirror of https://github.com/GNOME/gimp.git
app/gimage.h implemented gimp_image_get_layer_by_index(), small cleanups.
2000-12-27 Michael Natterer <mitch@gimp.org> * app/gimage.h * app/gimpimage.[ch]: implemented gimp_image_get_layer_by_index(), small cleanups. * app/commands.c * app/layers_dialog.c: use the new function instead of accessing the layer list directly.
This commit is contained in:
parent
8d37156c7b
commit
4c5757ee96
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
||||||
|
2000-12-27 Michael Natterer <mitch@gimp.org>
|
||||||
|
|
||||||
|
* app/gimage.h
|
||||||
|
* app/gimpimage.[ch]: implemented gimp_image_get_layer_by_index(),
|
||||||
|
small cleanups.
|
||||||
|
|
||||||
|
* app/commands.c
|
||||||
|
* app/layers_dialog.c: use the new function instead of accessing
|
||||||
|
the layer list directly.
|
||||||
|
|
||||||
2000-12-27 Michael Natterer <mitch@gimp.org>
|
2000-12-27 Michael Natterer <mitch@gimp.org>
|
||||||
|
|
||||||
* app/layers_dialog.c: layers_dialog_scroll_index(): don't fiddle
|
* app/layers_dialog.c: layers_dialog_scroll_index(): don't fiddle
|
||||||
|
|
|
@ -894,11 +894,7 @@ layers_previous_cmd_callback (GtkWidget *widget,
|
||||||
current_layer =
|
current_layer =
|
||||||
gimage_get_layer_index (gdisp->gimage, gdisp->gimage->active_layer);
|
gimage_get_layer_index (gdisp->gimage, gdisp->gimage->active_layer);
|
||||||
|
|
||||||
/* FIXME: don't use internal knowledge about layer lists
|
new_layer = gimage_get_layer_by_index (gdisp->gimage, current_layer - 1);
|
||||||
* TODO : implement gimage_get_layer_by_index()
|
|
||||||
*/
|
|
||||||
new_layer =
|
|
||||||
(Layer *) g_slist_nth_data (gdisp->gimage->layers, current_layer - 1);
|
|
||||||
|
|
||||||
if (new_layer)
|
if (new_layer)
|
||||||
{
|
{
|
||||||
|
@ -920,11 +916,7 @@ layers_next_cmd_callback (GtkWidget *widget,
|
||||||
current_layer =
|
current_layer =
|
||||||
gimage_get_layer_index (gdisp->gimage, gdisp->gimage->active_layer);
|
gimage_get_layer_index (gdisp->gimage, gdisp->gimage->active_layer);
|
||||||
|
|
||||||
/* FIXME: don't use internal knowledge about layer lists
|
new_layer = gimage_get_layer_by_index (gdisp->gimage, current_layer + 1);
|
||||||
* TODO : implement gimage_get_layer_by_index()
|
|
||||||
*/
|
|
||||||
new_layer =
|
|
||||||
(Layer *) g_slist_nth_data (gdisp->gimage->layers, current_layer + 1);
|
|
||||||
|
|
||||||
if (new_layer)
|
if (new_layer)
|
||||||
{
|
{
|
||||||
|
|
|
@ -894,11 +894,7 @@ layers_previous_cmd_callback (GtkWidget *widget,
|
||||||
current_layer =
|
current_layer =
|
||||||
gimage_get_layer_index (gdisp->gimage, gdisp->gimage->active_layer);
|
gimage_get_layer_index (gdisp->gimage, gdisp->gimage->active_layer);
|
||||||
|
|
||||||
/* FIXME: don't use internal knowledge about layer lists
|
new_layer = gimage_get_layer_by_index (gdisp->gimage, current_layer - 1);
|
||||||
* TODO : implement gimage_get_layer_by_index()
|
|
||||||
*/
|
|
||||||
new_layer =
|
|
||||||
(Layer *) g_slist_nth_data (gdisp->gimage->layers, current_layer - 1);
|
|
||||||
|
|
||||||
if (new_layer)
|
if (new_layer)
|
||||||
{
|
{
|
||||||
|
@ -920,11 +916,7 @@ layers_next_cmd_callback (GtkWidget *widget,
|
||||||
current_layer =
|
current_layer =
|
||||||
gimage_get_layer_index (gdisp->gimage, gdisp->gimage->active_layer);
|
gimage_get_layer_index (gdisp->gimage, gdisp->gimage->active_layer);
|
||||||
|
|
||||||
/* FIXME: don't use internal knowledge about layer lists
|
new_layer = gimage_get_layer_by_index (gdisp->gimage, current_layer + 1);
|
||||||
* TODO : implement gimage_get_layer_by_index()
|
|
||||||
*/
|
|
||||||
new_layer =
|
|
||||||
(Layer *) g_slist_nth_data (gdisp->gimage->layers, current_layer + 1);
|
|
||||||
|
|
||||||
if (new_layer)
|
if (new_layer)
|
||||||
{
|
{
|
||||||
|
|
|
@ -435,7 +435,7 @@ gimp_image_resize (GimpImage *gimage,
|
||||||
GSList *list;
|
GSList *list;
|
||||||
GList *guide_list;
|
GList *guide_list;
|
||||||
|
|
||||||
gimp_add_busy_cursors();
|
gimp_add_busy_cursors ();
|
||||||
|
|
||||||
g_assert (new_width > 0 && new_height > 0);
|
g_assert (new_width > 0 && new_height > 0);
|
||||||
|
|
||||||
|
@ -574,8 +574,8 @@ gimp_image_scale (GimpImage *gimage,
|
||||||
old_height = gimage->height;
|
old_height = gimage->height;
|
||||||
gimage->width = new_width;
|
gimage->width = new_width;
|
||||||
gimage->height = new_height;
|
gimage->height = new_height;
|
||||||
img_scale_w = (gdouble)new_width / (gdouble)old_width;
|
img_scale_w = (gdouble) new_width / (gdouble) old_width;
|
||||||
img_scale_h = (gdouble)new_height / (gdouble)old_height;
|
img_scale_h = (gdouble) new_height / (gdouble) old_height;
|
||||||
|
|
||||||
/* Scale all channels */
|
/* Scale all channels */
|
||||||
for (list = gimage->channels; list; list = g_slist_next (list))
|
for (list = gimage->channels; list; list = g_slist_next (list))
|
||||||
|
@ -600,10 +600,11 @@ gimp_image_scale (GimpImage *gimage,
|
||||||
layer = (Layer *) list->data;
|
layer = (Layer *) list->data;
|
||||||
if (layer_scale_by_factors (layer, img_scale_w, img_scale_h) == FALSE)
|
if (layer_scale_by_factors (layer, img_scale_w, img_scale_h) == FALSE)
|
||||||
{
|
{
|
||||||
/* Since 0 < img_scale_w, img_scale_h, failure due to one or more */
|
/* Since 0 < img_scale_w, img_scale_h, failure due to one or more
|
||||||
/* vanishing scaled layer dimensions. Implicit delete implemented */
|
* vanishing scaled layer dimensions. Implicit delete implemented
|
||||||
/* here. Upstream warning implemented in resize_check_layer_scaling() */
|
* here. Upstream warning implemented in resize_check_layer_scaling()
|
||||||
/* [resize.c line 1295], which offers the user the chance to bail out.*/
|
* [resize.c line 1295], which offers the user the chance to bail out.
|
||||||
|
*/
|
||||||
|
|
||||||
remove = g_slist_append (remove, layer);
|
remove = g_slist_append (remove, layer);
|
||||||
}
|
}
|
||||||
|
@ -733,7 +734,7 @@ gimp_image_apply_image (GimpImage *gimage,
|
||||||
/* determine what sort of operation is being attempted and
|
/* determine what sort of operation is being attempted and
|
||||||
* if it's actually legal...
|
* if it's actually legal...
|
||||||
*/
|
*/
|
||||||
operation = valid_combinations [drawable_type (drawable)][src2PR->bytes];
|
operation = valid_combinations[drawable_type (drawable)][src2PR->bytes];
|
||||||
if (operation == -1)
|
if (operation == -1)
|
||||||
{
|
{
|
||||||
g_message ("gimp_image_apply_image sent illegal parameters");
|
g_message ("gimp_image_apply_image sent illegal parameters");
|
||||||
|
@ -755,10 +756,10 @@ gimp_image_apply_image (GimpImage *gimage,
|
||||||
* we need to add the layer offset to transform coords
|
* we need to add the layer offset to transform coords
|
||||||
* into the mask coordinate system
|
* into the mask coordinate system
|
||||||
*/
|
*/
|
||||||
x1 = CLAMP (x1, -offset_x, drawable_width (GIMP_DRAWABLE(mask))-offset_x);
|
x1 = CLAMP (x1, -offset_x, drawable_width (GIMP_DRAWABLE (mask))-offset_x);
|
||||||
y1 = CLAMP (y1, -offset_y, drawable_height(GIMP_DRAWABLE(mask))-offset_y);
|
y1 = CLAMP (y1, -offset_y, drawable_height(GIMP_DRAWABLE (mask))-offset_y);
|
||||||
x2 = CLAMP (x2, -offset_x, drawable_width (GIMP_DRAWABLE(mask))-offset_x);
|
x2 = CLAMP (x2, -offset_x, drawable_width (GIMP_DRAWABLE (mask))-offset_x);
|
||||||
y2 = CLAMP (y2, -offset_y, drawable_height(GIMP_DRAWABLE(mask))-offset_y);
|
y2 = CLAMP (y2, -offset_y, drawable_height(GIMP_DRAWABLE (mask))-offset_y);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If the calling procedure specified an undo step... */
|
/* If the calling procedure specified an undo step... */
|
||||||
|
@ -800,8 +801,10 @@ gimp_image_apply_image (GimpImage *gimage,
|
||||||
opacity, mode, active, operation);
|
opacity, mode, active, operation);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
combine_regions (&src1PR, src2PR, &destPR, NULL, NULL,
|
{
|
||||||
opacity, mode, active, operation);
|
combine_regions (&src1PR, src2PR, &destPR, NULL, NULL,
|
||||||
|
opacity, mode, active, operation);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Similar to gimp_image_apply_image but works in "replace" mode (i.e.
|
/* Similar to gimp_image_apply_image but works in "replace" mode (i.e.
|
||||||
|
@ -860,10 +863,10 @@ gimp_image_replace_image (GimpImage *gimage,
|
||||||
* we need to add the layer offset to transform coords
|
* we need to add the layer offset to transform coords
|
||||||
* into the mask coordinate system
|
* into the mask coordinate system
|
||||||
*/
|
*/
|
||||||
x1 = CLAMP (x1, -offset_x, drawable_width (GIMP_DRAWABLE(mask))-offset_x);
|
x1 = CLAMP (x1, -offset_x, drawable_width (GIMP_DRAWABLE (mask))-offset_x);
|
||||||
y1 = CLAMP (y1, -offset_y, drawable_height(GIMP_DRAWABLE(mask))-offset_y);
|
y1 = CLAMP (y1, -offset_y, drawable_height(GIMP_DRAWABLE (mask))-offset_y);
|
||||||
x2 = CLAMP (x2, -offset_x, drawable_width (GIMP_DRAWABLE(mask))-offset_x);
|
x2 = CLAMP (x2, -offset_x, drawable_width (GIMP_DRAWABLE (mask))-offset_x);
|
||||||
y2 = CLAMP (y2, -offset_y, drawable_height(GIMP_DRAWABLE(mask))-offset_y);
|
y2 = CLAMP (y2, -offset_y, drawable_height(GIMP_DRAWABLE (mask))-offset_y);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If the calling procedure specified an undo step... */
|
/* If the calling procedure specified an undo step... */
|
||||||
|
@ -873,9 +876,13 @@ gimp_image_replace_image (GimpImage *gimage,
|
||||||
/* configure the pixel regions
|
/* configure the pixel regions
|
||||||
* If an alternative to using the drawable's data as src1 was provided...
|
* If an alternative to using the drawable's data as src1 was provided...
|
||||||
*/
|
*/
|
||||||
pixel_region_init (&src1PR, drawable_data (drawable), x1, y1, (x2 - x1), (y2 - y1), FALSE);
|
pixel_region_init (&src1PR, drawable_data (drawable),
|
||||||
pixel_region_init (&destPR, drawable_data (drawable), x1, y1, (x2 - x1), (y2 - y1), TRUE);
|
x1, y1, (x2 - x1), (y2 - y1), FALSE);
|
||||||
pixel_region_resize (src2PR, src2PR->x + (x1 - x), src2PR->y + (y1 - y), (x2 - x1), (y2 - y1));
|
pixel_region_init (&destPR, drawable_data (drawable),
|
||||||
|
x1, y1, (x2 - x1), (y2 - y1), TRUE);
|
||||||
|
pixel_region_resize (src2PR,
|
||||||
|
src2PR->x + (x1 - x), src2PR->y + (y1 - y),
|
||||||
|
(x2 - x1), (y2 - y1));
|
||||||
|
|
||||||
if (mask)
|
if (mask)
|
||||||
{
|
{
|
||||||
|
@ -926,8 +933,10 @@ gimp_image_replace_image (GimpImage *gimage,
|
||||||
g_free (temp_data);
|
g_free (temp_data);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
combine_regions_replace (&src1PR, src2PR, &destPR, maskPR, NULL,
|
{
|
||||||
opacity, active, operation);
|
combine_regions_replace (&src1PR, src2PR, &destPR, maskPR, NULL,
|
||||||
|
opacity, active, operation);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get rid of these! A "foreground" is an UI concept.. */
|
/* Get rid of these! A "foreground" is an UI concept.. */
|
||||||
|
@ -1536,19 +1545,19 @@ gimp_image_construct_layers (GimpImage *gimage,
|
||||||
/* only add layers that are visible and not floating selections
|
/* only add layers that are visible and not floating selections
|
||||||
to the list */
|
to the list */
|
||||||
if (!layer_is_floating_sel (layer) &&
|
if (!layer_is_floating_sel (layer) &&
|
||||||
drawable_visible (GIMP_DRAWABLE(layer)))
|
drawable_visible (GIMP_DRAWABLE (layer)))
|
||||||
reverse_list = g_slist_prepend (reverse_list, layer);
|
reverse_list = g_slist_prepend (reverse_list, layer);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (reverse_list)
|
while (reverse_list)
|
||||||
{
|
{
|
||||||
layer = (Layer *) reverse_list->data;
|
layer = (Layer *) reverse_list->data;
|
||||||
drawable_offsets (GIMP_DRAWABLE(layer), &off_x, &off_y);
|
drawable_offsets (GIMP_DRAWABLE (layer), &off_x, &off_y);
|
||||||
|
|
||||||
x1 = CLAMP (off_x, x, x + w);
|
x1 = CLAMP (off_x, x, x + w);
|
||||||
y1 = CLAMP (off_y, y, y + h);
|
y1 = CLAMP (off_y, y, y + h);
|
||||||
x2 = CLAMP (off_x + drawable_width (GIMP_DRAWABLE(layer)), x, x + w);
|
x2 = CLAMP (off_x + drawable_width (GIMP_DRAWABLE (layer)), x, x + w);
|
||||||
y2 = CLAMP (off_y + drawable_height (GIMP_DRAWABLE(layer)), y, y + h);
|
y2 = CLAMP (off_y + drawable_height (GIMP_DRAWABLE (layer)), y, y + h);
|
||||||
|
|
||||||
/* configure the pixel regions */
|
/* configure the pixel regions */
|
||||||
pixel_region_init (&src1PR, gimp_image_projection (gimage),
|
pixel_region_init (&src1PR, gimp_image_projection (gimage),
|
||||||
|
@ -1559,7 +1568,7 @@ gimp_image_construct_layers (GimpImage *gimage,
|
||||||
if (layer->mask && layer->show_mask)
|
if (layer->mask && layer->show_mask)
|
||||||
{
|
{
|
||||||
pixel_region_init (&src2PR,
|
pixel_region_init (&src2PR,
|
||||||
drawable_data (GIMP_DRAWABLE(layer->mask)),
|
drawable_data (GIMP_DRAWABLE (layer->mask)),
|
||||||
(x1 - off_x), (y1 - off_y),
|
(x1 - off_x), (y1 - off_y),
|
||||||
(x2 - x1), (y2 - y1), FALSE);
|
(x2 - x1), (y2 - y1), FALSE);
|
||||||
|
|
||||||
|
@ -1587,7 +1596,7 @@ gimp_image_construct_layers (GimpImage *gimage,
|
||||||
/* Based on the type of the layer, project the layer onto the
|
/* Based on the type of the layer, project the layer onto the
|
||||||
* projection image...
|
* projection image...
|
||||||
*/
|
*/
|
||||||
switch (drawable_type (GIMP_DRAWABLE(layer)))
|
switch (drawable_type (GIMP_DRAWABLE (layer)))
|
||||||
{
|
{
|
||||||
case RGB_GIMAGE: case GRAY_GIMAGE:
|
case RGB_GIMAGE: case GRAY_GIMAGE:
|
||||||
/* no mask possible */
|
/* no mask possible */
|
||||||
|
@ -1627,7 +1636,8 @@ gimp_image_construct_channels (GimpImage *gimage,
|
||||||
gint h)
|
gint h)
|
||||||
{
|
{
|
||||||
Channel *channel;
|
Channel *channel;
|
||||||
PixelRegion src1PR, src2PR;
|
PixelRegion src1PR;
|
||||||
|
PixelRegion src2PR;
|
||||||
GSList *list;
|
GSList *list;
|
||||||
GSList *reverse_list = NULL;
|
GSList *reverse_list = NULL;
|
||||||
|
|
||||||
|
@ -1645,7 +1655,7 @@ gimp_image_construct_channels (GimpImage *gimage,
|
||||||
pixel_region_init (&src1PR, gimp_image_projection (gimage),
|
pixel_region_init (&src1PR, gimp_image_projection (gimage),
|
||||||
x, y, w, h,
|
x, y, w, h,
|
||||||
TRUE);
|
TRUE);
|
||||||
pixel_region_init (&src2PR, drawable_data (GIMP_DRAWABLE(channel)),
|
pixel_region_init (&src2PR, drawable_data (GIMP_DRAWABLE (channel)),
|
||||||
x, y, w, h,
|
x, y, w, h,
|
||||||
FALSE);
|
FALSE);
|
||||||
|
|
||||||
|
@ -1683,14 +1693,14 @@ gimp_image_initialize_projection (GimpImage *gimage,
|
||||||
gint off_x, off_y;
|
gint off_x, off_y;
|
||||||
|
|
||||||
layer = (Layer *) list->data;
|
layer = (Layer *) list->data;
|
||||||
drawable_offsets (GIMP_DRAWABLE(layer), &off_x, &off_y);
|
drawable_offsets (GIMP_DRAWABLE (layer), &off_x, &off_y);
|
||||||
|
|
||||||
if (drawable_visible (GIMP_DRAWABLE(layer)) &&
|
if (drawable_visible (GIMP_DRAWABLE (layer)) &&
|
||||||
! layer_has_alpha (layer) &&
|
! layer_has_alpha (layer) &&
|
||||||
(off_x <= x) &&
|
(off_x <= x) &&
|
||||||
(off_y <= y) &&
|
(off_y <= y) &&
|
||||||
(off_x + drawable_width (GIMP_DRAWABLE(layer)) >= x + w) &&
|
(off_x + drawable_width (GIMP_DRAWABLE (layer)) >= x + w) &&
|
||||||
(off_y + drawable_height (GIMP_DRAWABLE(layer)) >= y + h))
|
(off_y + drawable_height (GIMP_DRAWABLE (layer)) >= y + h))
|
||||||
{
|
{
|
||||||
coverage = 1;
|
coverage = 1;
|
||||||
break;
|
break;
|
||||||
|
@ -1738,9 +1748,9 @@ gimp_image_get_active_channels (GimpImage *gimage,
|
||||||
|
|
||||||
void
|
void
|
||||||
gimp_image_construct (GimpImage *gimage,
|
gimp_image_construct (GimpImage *gimage,
|
||||||
gint x,
|
gint x,
|
||||||
gint y,
|
gint y,
|
||||||
gint w,
|
gint w,
|
||||||
gint h,
|
gint h,
|
||||||
gboolean can_use_cowproject)
|
gboolean can_use_cowproject)
|
||||||
{
|
{
|
||||||
|
@ -1757,12 +1767,11 @@ gimp_image_construct (GimpImage *gimage,
|
||||||
|
|
||||||
if (gimage->layers)
|
if (gimage->layers)
|
||||||
{
|
{
|
||||||
gimp_drawable_offsets (GIMP_DRAWABLE((Layer*)(gimage->layers->data)),
|
gimp_drawable_offsets (GIMP_DRAWABLE ((Layer*) gimage->layers->data),
|
||||||
&xoff, &yoff);
|
&xoff, &yoff);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (/*can_use_cowproject &&*/
|
if ((gimage->layers) && /* There's a layer. */
|
||||||
(gimage->layers) && /* There's a layer. */
|
|
||||||
(!g_slist_next(gimage->layers)) && /* It's the only layer. */
|
(!g_slist_next(gimage->layers)) && /* It's the only layer. */
|
||||||
(layer_has_alpha((Layer*)(gimage->layers->data))) && /* It's !flat. */
|
(layer_has_alpha((Layer*)(gimage->layers->data))) && /* It's !flat. */
|
||||||
/* It's visible. */
|
/* It's visible. */
|
||||||
|
@ -1926,15 +1935,15 @@ gimp_image_invalidate (GimpImage *gimage,
|
||||||
/* If the tile is not valid, make sure we get the entire tile
|
/* If the tile is not valid, make sure we get the entire tile
|
||||||
* in the construction extents
|
* in the construction extents
|
||||||
*/
|
*/
|
||||||
if (tile_is_valid(tile) == FALSE)
|
if (tile_is_valid (tile) == FALSE)
|
||||||
{
|
{
|
||||||
tilex = j - (j % TILE_WIDTH);
|
tilex = j - (j % TILE_WIDTH);
|
||||||
tiley = i - (i % TILE_HEIGHT);
|
tiley = i - (i % TILE_HEIGHT);
|
||||||
|
|
||||||
startx = MIN (startx, tilex);
|
startx = MIN (startx, tilex);
|
||||||
endx = MAX (endx, tilex + tile_ewidth(tile));
|
endx = MAX (endx, tilex + tile_ewidth (tile));
|
||||||
starty = MIN (starty, tiley);
|
starty = MIN (starty, tiley);
|
||||||
endy = MAX (endy, tiley + tile_eheight(tile));
|
endy = MAX (endy, tiley + tile_eheight (tile));
|
||||||
|
|
||||||
tile_mark_valid (tile); /* hmmmmmmm..... */
|
tile_mark_valid (tile); /* hmmmmmmm..... */
|
||||||
}
|
}
|
||||||
|
@ -1991,6 +2000,21 @@ gimp_image_get_layer_index (GimpImage *gimage,
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Layer *
|
||||||
|
gimp_image_get_layer_by_index (GimpImage *gimage,
|
||||||
|
gint layer_index)
|
||||||
|
{
|
||||||
|
Layer *layer;
|
||||||
|
|
||||||
|
g_return_val_if_fail (gimage != NULL, NULL);
|
||||||
|
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
|
||||||
|
|
||||||
|
layer =
|
||||||
|
(Layer *) g_slist_nth_data (gimage->layers, layer_index);
|
||||||
|
|
||||||
|
return layer;
|
||||||
|
}
|
||||||
|
|
||||||
gint
|
gint
|
||||||
gimp_image_get_channel_index (GimpImage *gimage,
|
gimp_image_get_channel_index (GimpImage *gimage,
|
||||||
Channel *channel_ID)
|
Channel *channel_ID)
|
||||||
|
@ -1999,6 +2023,7 @@ gimp_image_get_channel_index (GimpImage *gimage,
|
||||||
GSList *channels;
|
GSList *channels;
|
||||||
gint index;
|
gint index;
|
||||||
|
|
||||||
|
g_return_val_if_fail (gimage != NULL, -1);
|
||||||
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), -1);
|
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), -1);
|
||||||
|
|
||||||
for (channels = gimage->channels, index = 0;
|
for (channels = gimage->channels, index = 0;
|
||||||
|
@ -2016,6 +2041,7 @@ gimp_image_get_channel_index (GimpImage *gimage,
|
||||||
Layer *
|
Layer *
|
||||||
gimp_image_get_active_layer (GimpImage *gimage)
|
gimp_image_get_active_layer (GimpImage *gimage)
|
||||||
{
|
{
|
||||||
|
g_return_val_if_fail (gimage != NULL, NULL);
|
||||||
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
|
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
|
||||||
|
|
||||||
return gimage->active_layer;
|
return gimage->active_layer;
|
||||||
|
|
|
@ -189,6 +189,7 @@ void gimp_image_colormap_changed (GimpImage * image,
|
||||||
/* layer/channel functions */
|
/* layer/channel functions */
|
||||||
|
|
||||||
gint gimp_image_get_layer_index (GimpImage *, Layer *);
|
gint gimp_image_get_layer_index (GimpImage *, Layer *);
|
||||||
|
Layer * gimp_image_get_layer_by_index (GimpImage *, gint);
|
||||||
gint gimp_image_get_channel_index (GimpImage *, Channel *);
|
gint gimp_image_get_channel_index (GimpImage *, Channel *);
|
||||||
Layer * gimp_image_get_active_layer (GimpImage *);
|
Layer * gimp_image_get_active_layer (GimpImage *);
|
||||||
Channel * gimp_image_get_active_channel (GimpImage *);
|
Channel * gimp_image_get_active_channel (GimpImage *);
|
||||||
|
|
|
@ -435,7 +435,7 @@ gimp_image_resize (GimpImage *gimage,
|
||||||
GSList *list;
|
GSList *list;
|
||||||
GList *guide_list;
|
GList *guide_list;
|
||||||
|
|
||||||
gimp_add_busy_cursors();
|
gimp_add_busy_cursors ();
|
||||||
|
|
||||||
g_assert (new_width > 0 && new_height > 0);
|
g_assert (new_width > 0 && new_height > 0);
|
||||||
|
|
||||||
|
@ -574,8 +574,8 @@ gimp_image_scale (GimpImage *gimage,
|
||||||
old_height = gimage->height;
|
old_height = gimage->height;
|
||||||
gimage->width = new_width;
|
gimage->width = new_width;
|
||||||
gimage->height = new_height;
|
gimage->height = new_height;
|
||||||
img_scale_w = (gdouble)new_width / (gdouble)old_width;
|
img_scale_w = (gdouble) new_width / (gdouble) old_width;
|
||||||
img_scale_h = (gdouble)new_height / (gdouble)old_height;
|
img_scale_h = (gdouble) new_height / (gdouble) old_height;
|
||||||
|
|
||||||
/* Scale all channels */
|
/* Scale all channels */
|
||||||
for (list = gimage->channels; list; list = g_slist_next (list))
|
for (list = gimage->channels; list; list = g_slist_next (list))
|
||||||
|
@ -600,10 +600,11 @@ gimp_image_scale (GimpImage *gimage,
|
||||||
layer = (Layer *) list->data;
|
layer = (Layer *) list->data;
|
||||||
if (layer_scale_by_factors (layer, img_scale_w, img_scale_h) == FALSE)
|
if (layer_scale_by_factors (layer, img_scale_w, img_scale_h) == FALSE)
|
||||||
{
|
{
|
||||||
/* Since 0 < img_scale_w, img_scale_h, failure due to one or more */
|
/* Since 0 < img_scale_w, img_scale_h, failure due to one or more
|
||||||
/* vanishing scaled layer dimensions. Implicit delete implemented */
|
* vanishing scaled layer dimensions. Implicit delete implemented
|
||||||
/* here. Upstream warning implemented in resize_check_layer_scaling() */
|
* here. Upstream warning implemented in resize_check_layer_scaling()
|
||||||
/* [resize.c line 1295], which offers the user the chance to bail out.*/
|
* [resize.c line 1295], which offers the user the chance to bail out.
|
||||||
|
*/
|
||||||
|
|
||||||
remove = g_slist_append (remove, layer);
|
remove = g_slist_append (remove, layer);
|
||||||
}
|
}
|
||||||
|
@ -733,7 +734,7 @@ gimp_image_apply_image (GimpImage *gimage,
|
||||||
/* determine what sort of operation is being attempted and
|
/* determine what sort of operation is being attempted and
|
||||||
* if it's actually legal...
|
* if it's actually legal...
|
||||||
*/
|
*/
|
||||||
operation = valid_combinations [drawable_type (drawable)][src2PR->bytes];
|
operation = valid_combinations[drawable_type (drawable)][src2PR->bytes];
|
||||||
if (operation == -1)
|
if (operation == -1)
|
||||||
{
|
{
|
||||||
g_message ("gimp_image_apply_image sent illegal parameters");
|
g_message ("gimp_image_apply_image sent illegal parameters");
|
||||||
|
@ -755,10 +756,10 @@ gimp_image_apply_image (GimpImage *gimage,
|
||||||
* we need to add the layer offset to transform coords
|
* we need to add the layer offset to transform coords
|
||||||
* into the mask coordinate system
|
* into the mask coordinate system
|
||||||
*/
|
*/
|
||||||
x1 = CLAMP (x1, -offset_x, drawable_width (GIMP_DRAWABLE(mask))-offset_x);
|
x1 = CLAMP (x1, -offset_x, drawable_width (GIMP_DRAWABLE (mask))-offset_x);
|
||||||
y1 = CLAMP (y1, -offset_y, drawable_height(GIMP_DRAWABLE(mask))-offset_y);
|
y1 = CLAMP (y1, -offset_y, drawable_height(GIMP_DRAWABLE (mask))-offset_y);
|
||||||
x2 = CLAMP (x2, -offset_x, drawable_width (GIMP_DRAWABLE(mask))-offset_x);
|
x2 = CLAMP (x2, -offset_x, drawable_width (GIMP_DRAWABLE (mask))-offset_x);
|
||||||
y2 = CLAMP (y2, -offset_y, drawable_height(GIMP_DRAWABLE(mask))-offset_y);
|
y2 = CLAMP (y2, -offset_y, drawable_height(GIMP_DRAWABLE (mask))-offset_y);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If the calling procedure specified an undo step... */
|
/* If the calling procedure specified an undo step... */
|
||||||
|
@ -800,8 +801,10 @@ gimp_image_apply_image (GimpImage *gimage,
|
||||||
opacity, mode, active, operation);
|
opacity, mode, active, operation);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
combine_regions (&src1PR, src2PR, &destPR, NULL, NULL,
|
{
|
||||||
opacity, mode, active, operation);
|
combine_regions (&src1PR, src2PR, &destPR, NULL, NULL,
|
||||||
|
opacity, mode, active, operation);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Similar to gimp_image_apply_image but works in "replace" mode (i.e.
|
/* Similar to gimp_image_apply_image but works in "replace" mode (i.e.
|
||||||
|
@ -860,10 +863,10 @@ gimp_image_replace_image (GimpImage *gimage,
|
||||||
* we need to add the layer offset to transform coords
|
* we need to add the layer offset to transform coords
|
||||||
* into the mask coordinate system
|
* into the mask coordinate system
|
||||||
*/
|
*/
|
||||||
x1 = CLAMP (x1, -offset_x, drawable_width (GIMP_DRAWABLE(mask))-offset_x);
|
x1 = CLAMP (x1, -offset_x, drawable_width (GIMP_DRAWABLE (mask))-offset_x);
|
||||||
y1 = CLAMP (y1, -offset_y, drawable_height(GIMP_DRAWABLE(mask))-offset_y);
|
y1 = CLAMP (y1, -offset_y, drawable_height(GIMP_DRAWABLE (mask))-offset_y);
|
||||||
x2 = CLAMP (x2, -offset_x, drawable_width (GIMP_DRAWABLE(mask))-offset_x);
|
x2 = CLAMP (x2, -offset_x, drawable_width (GIMP_DRAWABLE (mask))-offset_x);
|
||||||
y2 = CLAMP (y2, -offset_y, drawable_height(GIMP_DRAWABLE(mask))-offset_y);
|
y2 = CLAMP (y2, -offset_y, drawable_height(GIMP_DRAWABLE (mask))-offset_y);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If the calling procedure specified an undo step... */
|
/* If the calling procedure specified an undo step... */
|
||||||
|
@ -873,9 +876,13 @@ gimp_image_replace_image (GimpImage *gimage,
|
||||||
/* configure the pixel regions
|
/* configure the pixel regions
|
||||||
* If an alternative to using the drawable's data as src1 was provided...
|
* If an alternative to using the drawable's data as src1 was provided...
|
||||||
*/
|
*/
|
||||||
pixel_region_init (&src1PR, drawable_data (drawable), x1, y1, (x2 - x1), (y2 - y1), FALSE);
|
pixel_region_init (&src1PR, drawable_data (drawable),
|
||||||
pixel_region_init (&destPR, drawable_data (drawable), x1, y1, (x2 - x1), (y2 - y1), TRUE);
|
x1, y1, (x2 - x1), (y2 - y1), FALSE);
|
||||||
pixel_region_resize (src2PR, src2PR->x + (x1 - x), src2PR->y + (y1 - y), (x2 - x1), (y2 - y1));
|
pixel_region_init (&destPR, drawable_data (drawable),
|
||||||
|
x1, y1, (x2 - x1), (y2 - y1), TRUE);
|
||||||
|
pixel_region_resize (src2PR,
|
||||||
|
src2PR->x + (x1 - x), src2PR->y + (y1 - y),
|
||||||
|
(x2 - x1), (y2 - y1));
|
||||||
|
|
||||||
if (mask)
|
if (mask)
|
||||||
{
|
{
|
||||||
|
@ -926,8 +933,10 @@ gimp_image_replace_image (GimpImage *gimage,
|
||||||
g_free (temp_data);
|
g_free (temp_data);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
combine_regions_replace (&src1PR, src2PR, &destPR, maskPR, NULL,
|
{
|
||||||
opacity, active, operation);
|
combine_regions_replace (&src1PR, src2PR, &destPR, maskPR, NULL,
|
||||||
|
opacity, active, operation);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get rid of these! A "foreground" is an UI concept.. */
|
/* Get rid of these! A "foreground" is an UI concept.. */
|
||||||
|
@ -1536,19 +1545,19 @@ gimp_image_construct_layers (GimpImage *gimage,
|
||||||
/* only add layers that are visible and not floating selections
|
/* only add layers that are visible and not floating selections
|
||||||
to the list */
|
to the list */
|
||||||
if (!layer_is_floating_sel (layer) &&
|
if (!layer_is_floating_sel (layer) &&
|
||||||
drawable_visible (GIMP_DRAWABLE(layer)))
|
drawable_visible (GIMP_DRAWABLE (layer)))
|
||||||
reverse_list = g_slist_prepend (reverse_list, layer);
|
reverse_list = g_slist_prepend (reverse_list, layer);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (reverse_list)
|
while (reverse_list)
|
||||||
{
|
{
|
||||||
layer = (Layer *) reverse_list->data;
|
layer = (Layer *) reverse_list->data;
|
||||||
drawable_offsets (GIMP_DRAWABLE(layer), &off_x, &off_y);
|
drawable_offsets (GIMP_DRAWABLE (layer), &off_x, &off_y);
|
||||||
|
|
||||||
x1 = CLAMP (off_x, x, x + w);
|
x1 = CLAMP (off_x, x, x + w);
|
||||||
y1 = CLAMP (off_y, y, y + h);
|
y1 = CLAMP (off_y, y, y + h);
|
||||||
x2 = CLAMP (off_x + drawable_width (GIMP_DRAWABLE(layer)), x, x + w);
|
x2 = CLAMP (off_x + drawable_width (GIMP_DRAWABLE (layer)), x, x + w);
|
||||||
y2 = CLAMP (off_y + drawable_height (GIMP_DRAWABLE(layer)), y, y + h);
|
y2 = CLAMP (off_y + drawable_height (GIMP_DRAWABLE (layer)), y, y + h);
|
||||||
|
|
||||||
/* configure the pixel regions */
|
/* configure the pixel regions */
|
||||||
pixel_region_init (&src1PR, gimp_image_projection (gimage),
|
pixel_region_init (&src1PR, gimp_image_projection (gimage),
|
||||||
|
@ -1559,7 +1568,7 @@ gimp_image_construct_layers (GimpImage *gimage,
|
||||||
if (layer->mask && layer->show_mask)
|
if (layer->mask && layer->show_mask)
|
||||||
{
|
{
|
||||||
pixel_region_init (&src2PR,
|
pixel_region_init (&src2PR,
|
||||||
drawable_data (GIMP_DRAWABLE(layer->mask)),
|
drawable_data (GIMP_DRAWABLE (layer->mask)),
|
||||||
(x1 - off_x), (y1 - off_y),
|
(x1 - off_x), (y1 - off_y),
|
||||||
(x2 - x1), (y2 - y1), FALSE);
|
(x2 - x1), (y2 - y1), FALSE);
|
||||||
|
|
||||||
|
@ -1587,7 +1596,7 @@ gimp_image_construct_layers (GimpImage *gimage,
|
||||||
/* Based on the type of the layer, project the layer onto the
|
/* Based on the type of the layer, project the layer onto the
|
||||||
* projection image...
|
* projection image...
|
||||||
*/
|
*/
|
||||||
switch (drawable_type (GIMP_DRAWABLE(layer)))
|
switch (drawable_type (GIMP_DRAWABLE (layer)))
|
||||||
{
|
{
|
||||||
case RGB_GIMAGE: case GRAY_GIMAGE:
|
case RGB_GIMAGE: case GRAY_GIMAGE:
|
||||||
/* no mask possible */
|
/* no mask possible */
|
||||||
|
@ -1627,7 +1636,8 @@ gimp_image_construct_channels (GimpImage *gimage,
|
||||||
gint h)
|
gint h)
|
||||||
{
|
{
|
||||||
Channel *channel;
|
Channel *channel;
|
||||||
PixelRegion src1PR, src2PR;
|
PixelRegion src1PR;
|
||||||
|
PixelRegion src2PR;
|
||||||
GSList *list;
|
GSList *list;
|
||||||
GSList *reverse_list = NULL;
|
GSList *reverse_list = NULL;
|
||||||
|
|
||||||
|
@ -1645,7 +1655,7 @@ gimp_image_construct_channels (GimpImage *gimage,
|
||||||
pixel_region_init (&src1PR, gimp_image_projection (gimage),
|
pixel_region_init (&src1PR, gimp_image_projection (gimage),
|
||||||
x, y, w, h,
|
x, y, w, h,
|
||||||
TRUE);
|
TRUE);
|
||||||
pixel_region_init (&src2PR, drawable_data (GIMP_DRAWABLE(channel)),
|
pixel_region_init (&src2PR, drawable_data (GIMP_DRAWABLE (channel)),
|
||||||
x, y, w, h,
|
x, y, w, h,
|
||||||
FALSE);
|
FALSE);
|
||||||
|
|
||||||
|
@ -1683,14 +1693,14 @@ gimp_image_initialize_projection (GimpImage *gimage,
|
||||||
gint off_x, off_y;
|
gint off_x, off_y;
|
||||||
|
|
||||||
layer = (Layer *) list->data;
|
layer = (Layer *) list->data;
|
||||||
drawable_offsets (GIMP_DRAWABLE(layer), &off_x, &off_y);
|
drawable_offsets (GIMP_DRAWABLE (layer), &off_x, &off_y);
|
||||||
|
|
||||||
if (drawable_visible (GIMP_DRAWABLE(layer)) &&
|
if (drawable_visible (GIMP_DRAWABLE (layer)) &&
|
||||||
! layer_has_alpha (layer) &&
|
! layer_has_alpha (layer) &&
|
||||||
(off_x <= x) &&
|
(off_x <= x) &&
|
||||||
(off_y <= y) &&
|
(off_y <= y) &&
|
||||||
(off_x + drawable_width (GIMP_DRAWABLE(layer)) >= x + w) &&
|
(off_x + drawable_width (GIMP_DRAWABLE (layer)) >= x + w) &&
|
||||||
(off_y + drawable_height (GIMP_DRAWABLE(layer)) >= y + h))
|
(off_y + drawable_height (GIMP_DRAWABLE (layer)) >= y + h))
|
||||||
{
|
{
|
||||||
coverage = 1;
|
coverage = 1;
|
||||||
break;
|
break;
|
||||||
|
@ -1738,9 +1748,9 @@ gimp_image_get_active_channels (GimpImage *gimage,
|
||||||
|
|
||||||
void
|
void
|
||||||
gimp_image_construct (GimpImage *gimage,
|
gimp_image_construct (GimpImage *gimage,
|
||||||
gint x,
|
gint x,
|
||||||
gint y,
|
gint y,
|
||||||
gint w,
|
gint w,
|
||||||
gint h,
|
gint h,
|
||||||
gboolean can_use_cowproject)
|
gboolean can_use_cowproject)
|
||||||
{
|
{
|
||||||
|
@ -1757,12 +1767,11 @@ gimp_image_construct (GimpImage *gimage,
|
||||||
|
|
||||||
if (gimage->layers)
|
if (gimage->layers)
|
||||||
{
|
{
|
||||||
gimp_drawable_offsets (GIMP_DRAWABLE((Layer*)(gimage->layers->data)),
|
gimp_drawable_offsets (GIMP_DRAWABLE ((Layer*) gimage->layers->data),
|
||||||
&xoff, &yoff);
|
&xoff, &yoff);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (/*can_use_cowproject &&*/
|
if ((gimage->layers) && /* There's a layer. */
|
||||||
(gimage->layers) && /* There's a layer. */
|
|
||||||
(!g_slist_next(gimage->layers)) && /* It's the only layer. */
|
(!g_slist_next(gimage->layers)) && /* It's the only layer. */
|
||||||
(layer_has_alpha((Layer*)(gimage->layers->data))) && /* It's !flat. */
|
(layer_has_alpha((Layer*)(gimage->layers->data))) && /* It's !flat. */
|
||||||
/* It's visible. */
|
/* It's visible. */
|
||||||
|
@ -1926,15 +1935,15 @@ gimp_image_invalidate (GimpImage *gimage,
|
||||||
/* If the tile is not valid, make sure we get the entire tile
|
/* If the tile is not valid, make sure we get the entire tile
|
||||||
* in the construction extents
|
* in the construction extents
|
||||||
*/
|
*/
|
||||||
if (tile_is_valid(tile) == FALSE)
|
if (tile_is_valid (tile) == FALSE)
|
||||||
{
|
{
|
||||||
tilex = j - (j % TILE_WIDTH);
|
tilex = j - (j % TILE_WIDTH);
|
||||||
tiley = i - (i % TILE_HEIGHT);
|
tiley = i - (i % TILE_HEIGHT);
|
||||||
|
|
||||||
startx = MIN (startx, tilex);
|
startx = MIN (startx, tilex);
|
||||||
endx = MAX (endx, tilex + tile_ewidth(tile));
|
endx = MAX (endx, tilex + tile_ewidth (tile));
|
||||||
starty = MIN (starty, tiley);
|
starty = MIN (starty, tiley);
|
||||||
endy = MAX (endy, tiley + tile_eheight(tile));
|
endy = MAX (endy, tiley + tile_eheight (tile));
|
||||||
|
|
||||||
tile_mark_valid (tile); /* hmmmmmmm..... */
|
tile_mark_valid (tile); /* hmmmmmmm..... */
|
||||||
}
|
}
|
||||||
|
@ -1991,6 +2000,21 @@ gimp_image_get_layer_index (GimpImage *gimage,
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Layer *
|
||||||
|
gimp_image_get_layer_by_index (GimpImage *gimage,
|
||||||
|
gint layer_index)
|
||||||
|
{
|
||||||
|
Layer *layer;
|
||||||
|
|
||||||
|
g_return_val_if_fail (gimage != NULL, NULL);
|
||||||
|
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
|
||||||
|
|
||||||
|
layer =
|
||||||
|
(Layer *) g_slist_nth_data (gimage->layers, layer_index);
|
||||||
|
|
||||||
|
return layer;
|
||||||
|
}
|
||||||
|
|
||||||
gint
|
gint
|
||||||
gimp_image_get_channel_index (GimpImage *gimage,
|
gimp_image_get_channel_index (GimpImage *gimage,
|
||||||
Channel *channel_ID)
|
Channel *channel_ID)
|
||||||
|
@ -1999,6 +2023,7 @@ gimp_image_get_channel_index (GimpImage *gimage,
|
||||||
GSList *channels;
|
GSList *channels;
|
||||||
gint index;
|
gint index;
|
||||||
|
|
||||||
|
g_return_val_if_fail (gimage != NULL, -1);
|
||||||
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), -1);
|
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), -1);
|
||||||
|
|
||||||
for (channels = gimage->channels, index = 0;
|
for (channels = gimage->channels, index = 0;
|
||||||
|
@ -2016,6 +2041,7 @@ gimp_image_get_channel_index (GimpImage *gimage,
|
||||||
Layer *
|
Layer *
|
||||||
gimp_image_get_active_layer (GimpImage *gimage)
|
gimp_image_get_active_layer (GimpImage *gimage)
|
||||||
{
|
{
|
||||||
|
g_return_val_if_fail (gimage != NULL, NULL);
|
||||||
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
|
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
|
||||||
|
|
||||||
return gimage->active_layer;
|
return gimage->active_layer;
|
||||||
|
|
|
@ -189,6 +189,7 @@ void gimp_image_colormap_changed (GimpImage * image,
|
||||||
/* layer/channel functions */
|
/* layer/channel functions */
|
||||||
|
|
||||||
gint gimp_image_get_layer_index (GimpImage *, Layer *);
|
gint gimp_image_get_layer_index (GimpImage *, Layer *);
|
||||||
|
Layer * gimp_image_get_layer_by_index (GimpImage *, gint);
|
||||||
gint gimp_image_get_channel_index (GimpImage *, Channel *);
|
gint gimp_image_get_channel_index (GimpImage *, Channel *);
|
||||||
Layer * gimp_image_get_active_layer (GimpImage *);
|
Layer * gimp_image_get_active_layer (GimpImage *);
|
||||||
Channel * gimp_image_get_active_channel (GimpImage *);
|
Channel * gimp_image_get_active_channel (GimpImage *);
|
||||||
|
|
|
@ -435,7 +435,7 @@ gimp_image_resize (GimpImage *gimage,
|
||||||
GSList *list;
|
GSList *list;
|
||||||
GList *guide_list;
|
GList *guide_list;
|
||||||
|
|
||||||
gimp_add_busy_cursors();
|
gimp_add_busy_cursors ();
|
||||||
|
|
||||||
g_assert (new_width > 0 && new_height > 0);
|
g_assert (new_width > 0 && new_height > 0);
|
||||||
|
|
||||||
|
@ -574,8 +574,8 @@ gimp_image_scale (GimpImage *gimage,
|
||||||
old_height = gimage->height;
|
old_height = gimage->height;
|
||||||
gimage->width = new_width;
|
gimage->width = new_width;
|
||||||
gimage->height = new_height;
|
gimage->height = new_height;
|
||||||
img_scale_w = (gdouble)new_width / (gdouble)old_width;
|
img_scale_w = (gdouble) new_width / (gdouble) old_width;
|
||||||
img_scale_h = (gdouble)new_height / (gdouble)old_height;
|
img_scale_h = (gdouble) new_height / (gdouble) old_height;
|
||||||
|
|
||||||
/* Scale all channels */
|
/* Scale all channels */
|
||||||
for (list = gimage->channels; list; list = g_slist_next (list))
|
for (list = gimage->channels; list; list = g_slist_next (list))
|
||||||
|
@ -600,10 +600,11 @@ gimp_image_scale (GimpImage *gimage,
|
||||||
layer = (Layer *) list->data;
|
layer = (Layer *) list->data;
|
||||||
if (layer_scale_by_factors (layer, img_scale_w, img_scale_h) == FALSE)
|
if (layer_scale_by_factors (layer, img_scale_w, img_scale_h) == FALSE)
|
||||||
{
|
{
|
||||||
/* Since 0 < img_scale_w, img_scale_h, failure due to one or more */
|
/* Since 0 < img_scale_w, img_scale_h, failure due to one or more
|
||||||
/* vanishing scaled layer dimensions. Implicit delete implemented */
|
* vanishing scaled layer dimensions. Implicit delete implemented
|
||||||
/* here. Upstream warning implemented in resize_check_layer_scaling() */
|
* here. Upstream warning implemented in resize_check_layer_scaling()
|
||||||
/* [resize.c line 1295], which offers the user the chance to bail out.*/
|
* [resize.c line 1295], which offers the user the chance to bail out.
|
||||||
|
*/
|
||||||
|
|
||||||
remove = g_slist_append (remove, layer);
|
remove = g_slist_append (remove, layer);
|
||||||
}
|
}
|
||||||
|
@ -733,7 +734,7 @@ gimp_image_apply_image (GimpImage *gimage,
|
||||||
/* determine what sort of operation is being attempted and
|
/* determine what sort of operation is being attempted and
|
||||||
* if it's actually legal...
|
* if it's actually legal...
|
||||||
*/
|
*/
|
||||||
operation = valid_combinations [drawable_type (drawable)][src2PR->bytes];
|
operation = valid_combinations[drawable_type (drawable)][src2PR->bytes];
|
||||||
if (operation == -1)
|
if (operation == -1)
|
||||||
{
|
{
|
||||||
g_message ("gimp_image_apply_image sent illegal parameters");
|
g_message ("gimp_image_apply_image sent illegal parameters");
|
||||||
|
@ -755,10 +756,10 @@ gimp_image_apply_image (GimpImage *gimage,
|
||||||
* we need to add the layer offset to transform coords
|
* we need to add the layer offset to transform coords
|
||||||
* into the mask coordinate system
|
* into the mask coordinate system
|
||||||
*/
|
*/
|
||||||
x1 = CLAMP (x1, -offset_x, drawable_width (GIMP_DRAWABLE(mask))-offset_x);
|
x1 = CLAMP (x1, -offset_x, drawable_width (GIMP_DRAWABLE (mask))-offset_x);
|
||||||
y1 = CLAMP (y1, -offset_y, drawable_height(GIMP_DRAWABLE(mask))-offset_y);
|
y1 = CLAMP (y1, -offset_y, drawable_height(GIMP_DRAWABLE (mask))-offset_y);
|
||||||
x2 = CLAMP (x2, -offset_x, drawable_width (GIMP_DRAWABLE(mask))-offset_x);
|
x2 = CLAMP (x2, -offset_x, drawable_width (GIMP_DRAWABLE (mask))-offset_x);
|
||||||
y2 = CLAMP (y2, -offset_y, drawable_height(GIMP_DRAWABLE(mask))-offset_y);
|
y2 = CLAMP (y2, -offset_y, drawable_height(GIMP_DRAWABLE (mask))-offset_y);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If the calling procedure specified an undo step... */
|
/* If the calling procedure specified an undo step... */
|
||||||
|
@ -800,8 +801,10 @@ gimp_image_apply_image (GimpImage *gimage,
|
||||||
opacity, mode, active, operation);
|
opacity, mode, active, operation);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
combine_regions (&src1PR, src2PR, &destPR, NULL, NULL,
|
{
|
||||||
opacity, mode, active, operation);
|
combine_regions (&src1PR, src2PR, &destPR, NULL, NULL,
|
||||||
|
opacity, mode, active, operation);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Similar to gimp_image_apply_image but works in "replace" mode (i.e.
|
/* Similar to gimp_image_apply_image but works in "replace" mode (i.e.
|
||||||
|
@ -860,10 +863,10 @@ gimp_image_replace_image (GimpImage *gimage,
|
||||||
* we need to add the layer offset to transform coords
|
* we need to add the layer offset to transform coords
|
||||||
* into the mask coordinate system
|
* into the mask coordinate system
|
||||||
*/
|
*/
|
||||||
x1 = CLAMP (x1, -offset_x, drawable_width (GIMP_DRAWABLE(mask))-offset_x);
|
x1 = CLAMP (x1, -offset_x, drawable_width (GIMP_DRAWABLE (mask))-offset_x);
|
||||||
y1 = CLAMP (y1, -offset_y, drawable_height(GIMP_DRAWABLE(mask))-offset_y);
|
y1 = CLAMP (y1, -offset_y, drawable_height(GIMP_DRAWABLE (mask))-offset_y);
|
||||||
x2 = CLAMP (x2, -offset_x, drawable_width (GIMP_DRAWABLE(mask))-offset_x);
|
x2 = CLAMP (x2, -offset_x, drawable_width (GIMP_DRAWABLE (mask))-offset_x);
|
||||||
y2 = CLAMP (y2, -offset_y, drawable_height(GIMP_DRAWABLE(mask))-offset_y);
|
y2 = CLAMP (y2, -offset_y, drawable_height(GIMP_DRAWABLE (mask))-offset_y);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If the calling procedure specified an undo step... */
|
/* If the calling procedure specified an undo step... */
|
||||||
|
@ -873,9 +876,13 @@ gimp_image_replace_image (GimpImage *gimage,
|
||||||
/* configure the pixel regions
|
/* configure the pixel regions
|
||||||
* If an alternative to using the drawable's data as src1 was provided...
|
* If an alternative to using the drawable's data as src1 was provided...
|
||||||
*/
|
*/
|
||||||
pixel_region_init (&src1PR, drawable_data (drawable), x1, y1, (x2 - x1), (y2 - y1), FALSE);
|
pixel_region_init (&src1PR, drawable_data (drawable),
|
||||||
pixel_region_init (&destPR, drawable_data (drawable), x1, y1, (x2 - x1), (y2 - y1), TRUE);
|
x1, y1, (x2 - x1), (y2 - y1), FALSE);
|
||||||
pixel_region_resize (src2PR, src2PR->x + (x1 - x), src2PR->y + (y1 - y), (x2 - x1), (y2 - y1));
|
pixel_region_init (&destPR, drawable_data (drawable),
|
||||||
|
x1, y1, (x2 - x1), (y2 - y1), TRUE);
|
||||||
|
pixel_region_resize (src2PR,
|
||||||
|
src2PR->x + (x1 - x), src2PR->y + (y1 - y),
|
||||||
|
(x2 - x1), (y2 - y1));
|
||||||
|
|
||||||
if (mask)
|
if (mask)
|
||||||
{
|
{
|
||||||
|
@ -926,8 +933,10 @@ gimp_image_replace_image (GimpImage *gimage,
|
||||||
g_free (temp_data);
|
g_free (temp_data);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
combine_regions_replace (&src1PR, src2PR, &destPR, maskPR, NULL,
|
{
|
||||||
opacity, active, operation);
|
combine_regions_replace (&src1PR, src2PR, &destPR, maskPR, NULL,
|
||||||
|
opacity, active, operation);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get rid of these! A "foreground" is an UI concept.. */
|
/* Get rid of these! A "foreground" is an UI concept.. */
|
||||||
|
@ -1536,19 +1545,19 @@ gimp_image_construct_layers (GimpImage *gimage,
|
||||||
/* only add layers that are visible and not floating selections
|
/* only add layers that are visible and not floating selections
|
||||||
to the list */
|
to the list */
|
||||||
if (!layer_is_floating_sel (layer) &&
|
if (!layer_is_floating_sel (layer) &&
|
||||||
drawable_visible (GIMP_DRAWABLE(layer)))
|
drawable_visible (GIMP_DRAWABLE (layer)))
|
||||||
reverse_list = g_slist_prepend (reverse_list, layer);
|
reverse_list = g_slist_prepend (reverse_list, layer);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (reverse_list)
|
while (reverse_list)
|
||||||
{
|
{
|
||||||
layer = (Layer *) reverse_list->data;
|
layer = (Layer *) reverse_list->data;
|
||||||
drawable_offsets (GIMP_DRAWABLE(layer), &off_x, &off_y);
|
drawable_offsets (GIMP_DRAWABLE (layer), &off_x, &off_y);
|
||||||
|
|
||||||
x1 = CLAMP (off_x, x, x + w);
|
x1 = CLAMP (off_x, x, x + w);
|
||||||
y1 = CLAMP (off_y, y, y + h);
|
y1 = CLAMP (off_y, y, y + h);
|
||||||
x2 = CLAMP (off_x + drawable_width (GIMP_DRAWABLE(layer)), x, x + w);
|
x2 = CLAMP (off_x + drawable_width (GIMP_DRAWABLE (layer)), x, x + w);
|
||||||
y2 = CLAMP (off_y + drawable_height (GIMP_DRAWABLE(layer)), y, y + h);
|
y2 = CLAMP (off_y + drawable_height (GIMP_DRAWABLE (layer)), y, y + h);
|
||||||
|
|
||||||
/* configure the pixel regions */
|
/* configure the pixel regions */
|
||||||
pixel_region_init (&src1PR, gimp_image_projection (gimage),
|
pixel_region_init (&src1PR, gimp_image_projection (gimage),
|
||||||
|
@ -1559,7 +1568,7 @@ gimp_image_construct_layers (GimpImage *gimage,
|
||||||
if (layer->mask && layer->show_mask)
|
if (layer->mask && layer->show_mask)
|
||||||
{
|
{
|
||||||
pixel_region_init (&src2PR,
|
pixel_region_init (&src2PR,
|
||||||
drawable_data (GIMP_DRAWABLE(layer->mask)),
|
drawable_data (GIMP_DRAWABLE (layer->mask)),
|
||||||
(x1 - off_x), (y1 - off_y),
|
(x1 - off_x), (y1 - off_y),
|
||||||
(x2 - x1), (y2 - y1), FALSE);
|
(x2 - x1), (y2 - y1), FALSE);
|
||||||
|
|
||||||
|
@ -1587,7 +1596,7 @@ gimp_image_construct_layers (GimpImage *gimage,
|
||||||
/* Based on the type of the layer, project the layer onto the
|
/* Based on the type of the layer, project the layer onto the
|
||||||
* projection image...
|
* projection image...
|
||||||
*/
|
*/
|
||||||
switch (drawable_type (GIMP_DRAWABLE(layer)))
|
switch (drawable_type (GIMP_DRAWABLE (layer)))
|
||||||
{
|
{
|
||||||
case RGB_GIMAGE: case GRAY_GIMAGE:
|
case RGB_GIMAGE: case GRAY_GIMAGE:
|
||||||
/* no mask possible */
|
/* no mask possible */
|
||||||
|
@ -1627,7 +1636,8 @@ gimp_image_construct_channels (GimpImage *gimage,
|
||||||
gint h)
|
gint h)
|
||||||
{
|
{
|
||||||
Channel *channel;
|
Channel *channel;
|
||||||
PixelRegion src1PR, src2PR;
|
PixelRegion src1PR;
|
||||||
|
PixelRegion src2PR;
|
||||||
GSList *list;
|
GSList *list;
|
||||||
GSList *reverse_list = NULL;
|
GSList *reverse_list = NULL;
|
||||||
|
|
||||||
|
@ -1645,7 +1655,7 @@ gimp_image_construct_channels (GimpImage *gimage,
|
||||||
pixel_region_init (&src1PR, gimp_image_projection (gimage),
|
pixel_region_init (&src1PR, gimp_image_projection (gimage),
|
||||||
x, y, w, h,
|
x, y, w, h,
|
||||||
TRUE);
|
TRUE);
|
||||||
pixel_region_init (&src2PR, drawable_data (GIMP_DRAWABLE(channel)),
|
pixel_region_init (&src2PR, drawable_data (GIMP_DRAWABLE (channel)),
|
||||||
x, y, w, h,
|
x, y, w, h,
|
||||||
FALSE);
|
FALSE);
|
||||||
|
|
||||||
|
@ -1683,14 +1693,14 @@ gimp_image_initialize_projection (GimpImage *gimage,
|
||||||
gint off_x, off_y;
|
gint off_x, off_y;
|
||||||
|
|
||||||
layer = (Layer *) list->data;
|
layer = (Layer *) list->data;
|
||||||
drawable_offsets (GIMP_DRAWABLE(layer), &off_x, &off_y);
|
drawable_offsets (GIMP_DRAWABLE (layer), &off_x, &off_y);
|
||||||
|
|
||||||
if (drawable_visible (GIMP_DRAWABLE(layer)) &&
|
if (drawable_visible (GIMP_DRAWABLE (layer)) &&
|
||||||
! layer_has_alpha (layer) &&
|
! layer_has_alpha (layer) &&
|
||||||
(off_x <= x) &&
|
(off_x <= x) &&
|
||||||
(off_y <= y) &&
|
(off_y <= y) &&
|
||||||
(off_x + drawable_width (GIMP_DRAWABLE(layer)) >= x + w) &&
|
(off_x + drawable_width (GIMP_DRAWABLE (layer)) >= x + w) &&
|
||||||
(off_y + drawable_height (GIMP_DRAWABLE(layer)) >= y + h))
|
(off_y + drawable_height (GIMP_DRAWABLE (layer)) >= y + h))
|
||||||
{
|
{
|
||||||
coverage = 1;
|
coverage = 1;
|
||||||
break;
|
break;
|
||||||
|
@ -1738,9 +1748,9 @@ gimp_image_get_active_channels (GimpImage *gimage,
|
||||||
|
|
||||||
void
|
void
|
||||||
gimp_image_construct (GimpImage *gimage,
|
gimp_image_construct (GimpImage *gimage,
|
||||||
gint x,
|
gint x,
|
||||||
gint y,
|
gint y,
|
||||||
gint w,
|
gint w,
|
||||||
gint h,
|
gint h,
|
||||||
gboolean can_use_cowproject)
|
gboolean can_use_cowproject)
|
||||||
{
|
{
|
||||||
|
@ -1757,12 +1767,11 @@ gimp_image_construct (GimpImage *gimage,
|
||||||
|
|
||||||
if (gimage->layers)
|
if (gimage->layers)
|
||||||
{
|
{
|
||||||
gimp_drawable_offsets (GIMP_DRAWABLE((Layer*)(gimage->layers->data)),
|
gimp_drawable_offsets (GIMP_DRAWABLE ((Layer*) gimage->layers->data),
|
||||||
&xoff, &yoff);
|
&xoff, &yoff);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (/*can_use_cowproject &&*/
|
if ((gimage->layers) && /* There's a layer. */
|
||||||
(gimage->layers) && /* There's a layer. */
|
|
||||||
(!g_slist_next(gimage->layers)) && /* It's the only layer. */
|
(!g_slist_next(gimage->layers)) && /* It's the only layer. */
|
||||||
(layer_has_alpha((Layer*)(gimage->layers->data))) && /* It's !flat. */
|
(layer_has_alpha((Layer*)(gimage->layers->data))) && /* It's !flat. */
|
||||||
/* It's visible. */
|
/* It's visible. */
|
||||||
|
@ -1926,15 +1935,15 @@ gimp_image_invalidate (GimpImage *gimage,
|
||||||
/* If the tile is not valid, make sure we get the entire tile
|
/* If the tile is not valid, make sure we get the entire tile
|
||||||
* in the construction extents
|
* in the construction extents
|
||||||
*/
|
*/
|
||||||
if (tile_is_valid(tile) == FALSE)
|
if (tile_is_valid (tile) == FALSE)
|
||||||
{
|
{
|
||||||
tilex = j - (j % TILE_WIDTH);
|
tilex = j - (j % TILE_WIDTH);
|
||||||
tiley = i - (i % TILE_HEIGHT);
|
tiley = i - (i % TILE_HEIGHT);
|
||||||
|
|
||||||
startx = MIN (startx, tilex);
|
startx = MIN (startx, tilex);
|
||||||
endx = MAX (endx, tilex + tile_ewidth(tile));
|
endx = MAX (endx, tilex + tile_ewidth (tile));
|
||||||
starty = MIN (starty, tiley);
|
starty = MIN (starty, tiley);
|
||||||
endy = MAX (endy, tiley + tile_eheight(tile));
|
endy = MAX (endy, tiley + tile_eheight (tile));
|
||||||
|
|
||||||
tile_mark_valid (tile); /* hmmmmmmm..... */
|
tile_mark_valid (tile); /* hmmmmmmm..... */
|
||||||
}
|
}
|
||||||
|
@ -1991,6 +2000,21 @@ gimp_image_get_layer_index (GimpImage *gimage,
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Layer *
|
||||||
|
gimp_image_get_layer_by_index (GimpImage *gimage,
|
||||||
|
gint layer_index)
|
||||||
|
{
|
||||||
|
Layer *layer;
|
||||||
|
|
||||||
|
g_return_val_if_fail (gimage != NULL, NULL);
|
||||||
|
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
|
||||||
|
|
||||||
|
layer =
|
||||||
|
(Layer *) g_slist_nth_data (gimage->layers, layer_index);
|
||||||
|
|
||||||
|
return layer;
|
||||||
|
}
|
||||||
|
|
||||||
gint
|
gint
|
||||||
gimp_image_get_channel_index (GimpImage *gimage,
|
gimp_image_get_channel_index (GimpImage *gimage,
|
||||||
Channel *channel_ID)
|
Channel *channel_ID)
|
||||||
|
@ -1999,6 +2023,7 @@ gimp_image_get_channel_index (GimpImage *gimage,
|
||||||
GSList *channels;
|
GSList *channels;
|
||||||
gint index;
|
gint index;
|
||||||
|
|
||||||
|
g_return_val_if_fail (gimage != NULL, -1);
|
||||||
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), -1);
|
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), -1);
|
||||||
|
|
||||||
for (channels = gimage->channels, index = 0;
|
for (channels = gimage->channels, index = 0;
|
||||||
|
@ -2016,6 +2041,7 @@ gimp_image_get_channel_index (GimpImage *gimage,
|
||||||
Layer *
|
Layer *
|
||||||
gimp_image_get_active_layer (GimpImage *gimage)
|
gimp_image_get_active_layer (GimpImage *gimage)
|
||||||
{
|
{
|
||||||
|
g_return_val_if_fail (gimage != NULL, NULL);
|
||||||
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
|
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
|
||||||
|
|
||||||
return gimage->active_layer;
|
return gimage->active_layer;
|
||||||
|
|
|
@ -189,6 +189,7 @@ void gimp_image_colormap_changed (GimpImage * image,
|
||||||
/* layer/channel functions */
|
/* layer/channel functions */
|
||||||
|
|
||||||
gint gimp_image_get_layer_index (GimpImage *, Layer *);
|
gint gimp_image_get_layer_index (GimpImage *, Layer *);
|
||||||
|
Layer * gimp_image_get_layer_by_index (GimpImage *, gint);
|
||||||
gint gimp_image_get_channel_index (GimpImage *, Channel *);
|
gint gimp_image_get_channel_index (GimpImage *, Channel *);
|
||||||
Layer * gimp_image_get_active_layer (GimpImage *);
|
Layer * gimp_image_get_active_layer (GimpImage *);
|
||||||
Channel * gimp_image_get_active_channel (GimpImage *);
|
Channel * gimp_image_get_active_channel (GimpImage *);
|
||||||
|
|
|
@ -435,7 +435,7 @@ gimp_image_resize (GimpImage *gimage,
|
||||||
GSList *list;
|
GSList *list;
|
||||||
GList *guide_list;
|
GList *guide_list;
|
||||||
|
|
||||||
gimp_add_busy_cursors();
|
gimp_add_busy_cursors ();
|
||||||
|
|
||||||
g_assert (new_width > 0 && new_height > 0);
|
g_assert (new_width > 0 && new_height > 0);
|
||||||
|
|
||||||
|
@ -574,8 +574,8 @@ gimp_image_scale (GimpImage *gimage,
|
||||||
old_height = gimage->height;
|
old_height = gimage->height;
|
||||||
gimage->width = new_width;
|
gimage->width = new_width;
|
||||||
gimage->height = new_height;
|
gimage->height = new_height;
|
||||||
img_scale_w = (gdouble)new_width / (gdouble)old_width;
|
img_scale_w = (gdouble) new_width / (gdouble) old_width;
|
||||||
img_scale_h = (gdouble)new_height / (gdouble)old_height;
|
img_scale_h = (gdouble) new_height / (gdouble) old_height;
|
||||||
|
|
||||||
/* Scale all channels */
|
/* Scale all channels */
|
||||||
for (list = gimage->channels; list; list = g_slist_next (list))
|
for (list = gimage->channels; list; list = g_slist_next (list))
|
||||||
|
@ -600,10 +600,11 @@ gimp_image_scale (GimpImage *gimage,
|
||||||
layer = (Layer *) list->data;
|
layer = (Layer *) list->data;
|
||||||
if (layer_scale_by_factors (layer, img_scale_w, img_scale_h) == FALSE)
|
if (layer_scale_by_factors (layer, img_scale_w, img_scale_h) == FALSE)
|
||||||
{
|
{
|
||||||
/* Since 0 < img_scale_w, img_scale_h, failure due to one or more */
|
/* Since 0 < img_scale_w, img_scale_h, failure due to one or more
|
||||||
/* vanishing scaled layer dimensions. Implicit delete implemented */
|
* vanishing scaled layer dimensions. Implicit delete implemented
|
||||||
/* here. Upstream warning implemented in resize_check_layer_scaling() */
|
* here. Upstream warning implemented in resize_check_layer_scaling()
|
||||||
/* [resize.c line 1295], which offers the user the chance to bail out.*/
|
* [resize.c line 1295], which offers the user the chance to bail out.
|
||||||
|
*/
|
||||||
|
|
||||||
remove = g_slist_append (remove, layer);
|
remove = g_slist_append (remove, layer);
|
||||||
}
|
}
|
||||||
|
@ -733,7 +734,7 @@ gimp_image_apply_image (GimpImage *gimage,
|
||||||
/* determine what sort of operation is being attempted and
|
/* determine what sort of operation is being attempted and
|
||||||
* if it's actually legal...
|
* if it's actually legal...
|
||||||
*/
|
*/
|
||||||
operation = valid_combinations [drawable_type (drawable)][src2PR->bytes];
|
operation = valid_combinations[drawable_type (drawable)][src2PR->bytes];
|
||||||
if (operation == -1)
|
if (operation == -1)
|
||||||
{
|
{
|
||||||
g_message ("gimp_image_apply_image sent illegal parameters");
|
g_message ("gimp_image_apply_image sent illegal parameters");
|
||||||
|
@ -755,10 +756,10 @@ gimp_image_apply_image (GimpImage *gimage,
|
||||||
* we need to add the layer offset to transform coords
|
* we need to add the layer offset to transform coords
|
||||||
* into the mask coordinate system
|
* into the mask coordinate system
|
||||||
*/
|
*/
|
||||||
x1 = CLAMP (x1, -offset_x, drawable_width (GIMP_DRAWABLE(mask))-offset_x);
|
x1 = CLAMP (x1, -offset_x, drawable_width (GIMP_DRAWABLE (mask))-offset_x);
|
||||||
y1 = CLAMP (y1, -offset_y, drawable_height(GIMP_DRAWABLE(mask))-offset_y);
|
y1 = CLAMP (y1, -offset_y, drawable_height(GIMP_DRAWABLE (mask))-offset_y);
|
||||||
x2 = CLAMP (x2, -offset_x, drawable_width (GIMP_DRAWABLE(mask))-offset_x);
|
x2 = CLAMP (x2, -offset_x, drawable_width (GIMP_DRAWABLE (mask))-offset_x);
|
||||||
y2 = CLAMP (y2, -offset_y, drawable_height(GIMP_DRAWABLE(mask))-offset_y);
|
y2 = CLAMP (y2, -offset_y, drawable_height(GIMP_DRAWABLE (mask))-offset_y);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If the calling procedure specified an undo step... */
|
/* If the calling procedure specified an undo step... */
|
||||||
|
@ -800,8 +801,10 @@ gimp_image_apply_image (GimpImage *gimage,
|
||||||
opacity, mode, active, operation);
|
opacity, mode, active, operation);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
combine_regions (&src1PR, src2PR, &destPR, NULL, NULL,
|
{
|
||||||
opacity, mode, active, operation);
|
combine_regions (&src1PR, src2PR, &destPR, NULL, NULL,
|
||||||
|
opacity, mode, active, operation);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Similar to gimp_image_apply_image but works in "replace" mode (i.e.
|
/* Similar to gimp_image_apply_image but works in "replace" mode (i.e.
|
||||||
|
@ -860,10 +863,10 @@ gimp_image_replace_image (GimpImage *gimage,
|
||||||
* we need to add the layer offset to transform coords
|
* we need to add the layer offset to transform coords
|
||||||
* into the mask coordinate system
|
* into the mask coordinate system
|
||||||
*/
|
*/
|
||||||
x1 = CLAMP (x1, -offset_x, drawable_width (GIMP_DRAWABLE(mask))-offset_x);
|
x1 = CLAMP (x1, -offset_x, drawable_width (GIMP_DRAWABLE (mask))-offset_x);
|
||||||
y1 = CLAMP (y1, -offset_y, drawable_height(GIMP_DRAWABLE(mask))-offset_y);
|
y1 = CLAMP (y1, -offset_y, drawable_height(GIMP_DRAWABLE (mask))-offset_y);
|
||||||
x2 = CLAMP (x2, -offset_x, drawable_width (GIMP_DRAWABLE(mask))-offset_x);
|
x2 = CLAMP (x2, -offset_x, drawable_width (GIMP_DRAWABLE (mask))-offset_x);
|
||||||
y2 = CLAMP (y2, -offset_y, drawable_height(GIMP_DRAWABLE(mask))-offset_y);
|
y2 = CLAMP (y2, -offset_y, drawable_height(GIMP_DRAWABLE (mask))-offset_y);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If the calling procedure specified an undo step... */
|
/* If the calling procedure specified an undo step... */
|
||||||
|
@ -873,9 +876,13 @@ gimp_image_replace_image (GimpImage *gimage,
|
||||||
/* configure the pixel regions
|
/* configure the pixel regions
|
||||||
* If an alternative to using the drawable's data as src1 was provided...
|
* If an alternative to using the drawable's data as src1 was provided...
|
||||||
*/
|
*/
|
||||||
pixel_region_init (&src1PR, drawable_data (drawable), x1, y1, (x2 - x1), (y2 - y1), FALSE);
|
pixel_region_init (&src1PR, drawable_data (drawable),
|
||||||
pixel_region_init (&destPR, drawable_data (drawable), x1, y1, (x2 - x1), (y2 - y1), TRUE);
|
x1, y1, (x2 - x1), (y2 - y1), FALSE);
|
||||||
pixel_region_resize (src2PR, src2PR->x + (x1 - x), src2PR->y + (y1 - y), (x2 - x1), (y2 - y1));
|
pixel_region_init (&destPR, drawable_data (drawable),
|
||||||
|
x1, y1, (x2 - x1), (y2 - y1), TRUE);
|
||||||
|
pixel_region_resize (src2PR,
|
||||||
|
src2PR->x + (x1 - x), src2PR->y + (y1 - y),
|
||||||
|
(x2 - x1), (y2 - y1));
|
||||||
|
|
||||||
if (mask)
|
if (mask)
|
||||||
{
|
{
|
||||||
|
@ -926,8 +933,10 @@ gimp_image_replace_image (GimpImage *gimage,
|
||||||
g_free (temp_data);
|
g_free (temp_data);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
combine_regions_replace (&src1PR, src2PR, &destPR, maskPR, NULL,
|
{
|
||||||
opacity, active, operation);
|
combine_regions_replace (&src1PR, src2PR, &destPR, maskPR, NULL,
|
||||||
|
opacity, active, operation);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get rid of these! A "foreground" is an UI concept.. */
|
/* Get rid of these! A "foreground" is an UI concept.. */
|
||||||
|
@ -1536,19 +1545,19 @@ gimp_image_construct_layers (GimpImage *gimage,
|
||||||
/* only add layers that are visible and not floating selections
|
/* only add layers that are visible and not floating selections
|
||||||
to the list */
|
to the list */
|
||||||
if (!layer_is_floating_sel (layer) &&
|
if (!layer_is_floating_sel (layer) &&
|
||||||
drawable_visible (GIMP_DRAWABLE(layer)))
|
drawable_visible (GIMP_DRAWABLE (layer)))
|
||||||
reverse_list = g_slist_prepend (reverse_list, layer);
|
reverse_list = g_slist_prepend (reverse_list, layer);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (reverse_list)
|
while (reverse_list)
|
||||||
{
|
{
|
||||||
layer = (Layer *) reverse_list->data;
|
layer = (Layer *) reverse_list->data;
|
||||||
drawable_offsets (GIMP_DRAWABLE(layer), &off_x, &off_y);
|
drawable_offsets (GIMP_DRAWABLE (layer), &off_x, &off_y);
|
||||||
|
|
||||||
x1 = CLAMP (off_x, x, x + w);
|
x1 = CLAMP (off_x, x, x + w);
|
||||||
y1 = CLAMP (off_y, y, y + h);
|
y1 = CLAMP (off_y, y, y + h);
|
||||||
x2 = CLAMP (off_x + drawable_width (GIMP_DRAWABLE(layer)), x, x + w);
|
x2 = CLAMP (off_x + drawable_width (GIMP_DRAWABLE (layer)), x, x + w);
|
||||||
y2 = CLAMP (off_y + drawable_height (GIMP_DRAWABLE(layer)), y, y + h);
|
y2 = CLAMP (off_y + drawable_height (GIMP_DRAWABLE (layer)), y, y + h);
|
||||||
|
|
||||||
/* configure the pixel regions */
|
/* configure the pixel regions */
|
||||||
pixel_region_init (&src1PR, gimp_image_projection (gimage),
|
pixel_region_init (&src1PR, gimp_image_projection (gimage),
|
||||||
|
@ -1559,7 +1568,7 @@ gimp_image_construct_layers (GimpImage *gimage,
|
||||||
if (layer->mask && layer->show_mask)
|
if (layer->mask && layer->show_mask)
|
||||||
{
|
{
|
||||||
pixel_region_init (&src2PR,
|
pixel_region_init (&src2PR,
|
||||||
drawable_data (GIMP_DRAWABLE(layer->mask)),
|
drawable_data (GIMP_DRAWABLE (layer->mask)),
|
||||||
(x1 - off_x), (y1 - off_y),
|
(x1 - off_x), (y1 - off_y),
|
||||||
(x2 - x1), (y2 - y1), FALSE);
|
(x2 - x1), (y2 - y1), FALSE);
|
||||||
|
|
||||||
|
@ -1587,7 +1596,7 @@ gimp_image_construct_layers (GimpImage *gimage,
|
||||||
/* Based on the type of the layer, project the layer onto the
|
/* Based on the type of the layer, project the layer onto the
|
||||||
* projection image...
|
* projection image...
|
||||||
*/
|
*/
|
||||||
switch (drawable_type (GIMP_DRAWABLE(layer)))
|
switch (drawable_type (GIMP_DRAWABLE (layer)))
|
||||||
{
|
{
|
||||||
case RGB_GIMAGE: case GRAY_GIMAGE:
|
case RGB_GIMAGE: case GRAY_GIMAGE:
|
||||||
/* no mask possible */
|
/* no mask possible */
|
||||||
|
@ -1627,7 +1636,8 @@ gimp_image_construct_channels (GimpImage *gimage,
|
||||||
gint h)
|
gint h)
|
||||||
{
|
{
|
||||||
Channel *channel;
|
Channel *channel;
|
||||||
PixelRegion src1PR, src2PR;
|
PixelRegion src1PR;
|
||||||
|
PixelRegion src2PR;
|
||||||
GSList *list;
|
GSList *list;
|
||||||
GSList *reverse_list = NULL;
|
GSList *reverse_list = NULL;
|
||||||
|
|
||||||
|
@ -1645,7 +1655,7 @@ gimp_image_construct_channels (GimpImage *gimage,
|
||||||
pixel_region_init (&src1PR, gimp_image_projection (gimage),
|
pixel_region_init (&src1PR, gimp_image_projection (gimage),
|
||||||
x, y, w, h,
|
x, y, w, h,
|
||||||
TRUE);
|
TRUE);
|
||||||
pixel_region_init (&src2PR, drawable_data (GIMP_DRAWABLE(channel)),
|
pixel_region_init (&src2PR, drawable_data (GIMP_DRAWABLE (channel)),
|
||||||
x, y, w, h,
|
x, y, w, h,
|
||||||
FALSE);
|
FALSE);
|
||||||
|
|
||||||
|
@ -1683,14 +1693,14 @@ gimp_image_initialize_projection (GimpImage *gimage,
|
||||||
gint off_x, off_y;
|
gint off_x, off_y;
|
||||||
|
|
||||||
layer = (Layer *) list->data;
|
layer = (Layer *) list->data;
|
||||||
drawable_offsets (GIMP_DRAWABLE(layer), &off_x, &off_y);
|
drawable_offsets (GIMP_DRAWABLE (layer), &off_x, &off_y);
|
||||||
|
|
||||||
if (drawable_visible (GIMP_DRAWABLE(layer)) &&
|
if (drawable_visible (GIMP_DRAWABLE (layer)) &&
|
||||||
! layer_has_alpha (layer) &&
|
! layer_has_alpha (layer) &&
|
||||||
(off_x <= x) &&
|
(off_x <= x) &&
|
||||||
(off_y <= y) &&
|
(off_y <= y) &&
|
||||||
(off_x + drawable_width (GIMP_DRAWABLE(layer)) >= x + w) &&
|
(off_x + drawable_width (GIMP_DRAWABLE (layer)) >= x + w) &&
|
||||||
(off_y + drawable_height (GIMP_DRAWABLE(layer)) >= y + h))
|
(off_y + drawable_height (GIMP_DRAWABLE (layer)) >= y + h))
|
||||||
{
|
{
|
||||||
coverage = 1;
|
coverage = 1;
|
||||||
break;
|
break;
|
||||||
|
@ -1738,9 +1748,9 @@ gimp_image_get_active_channels (GimpImage *gimage,
|
||||||
|
|
||||||
void
|
void
|
||||||
gimp_image_construct (GimpImage *gimage,
|
gimp_image_construct (GimpImage *gimage,
|
||||||
gint x,
|
gint x,
|
||||||
gint y,
|
gint y,
|
||||||
gint w,
|
gint w,
|
||||||
gint h,
|
gint h,
|
||||||
gboolean can_use_cowproject)
|
gboolean can_use_cowproject)
|
||||||
{
|
{
|
||||||
|
@ -1757,12 +1767,11 @@ gimp_image_construct (GimpImage *gimage,
|
||||||
|
|
||||||
if (gimage->layers)
|
if (gimage->layers)
|
||||||
{
|
{
|
||||||
gimp_drawable_offsets (GIMP_DRAWABLE((Layer*)(gimage->layers->data)),
|
gimp_drawable_offsets (GIMP_DRAWABLE ((Layer*) gimage->layers->data),
|
||||||
&xoff, &yoff);
|
&xoff, &yoff);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (/*can_use_cowproject &&*/
|
if ((gimage->layers) && /* There's a layer. */
|
||||||
(gimage->layers) && /* There's a layer. */
|
|
||||||
(!g_slist_next(gimage->layers)) && /* It's the only layer. */
|
(!g_slist_next(gimage->layers)) && /* It's the only layer. */
|
||||||
(layer_has_alpha((Layer*)(gimage->layers->data))) && /* It's !flat. */
|
(layer_has_alpha((Layer*)(gimage->layers->data))) && /* It's !flat. */
|
||||||
/* It's visible. */
|
/* It's visible. */
|
||||||
|
@ -1926,15 +1935,15 @@ gimp_image_invalidate (GimpImage *gimage,
|
||||||
/* If the tile is not valid, make sure we get the entire tile
|
/* If the tile is not valid, make sure we get the entire tile
|
||||||
* in the construction extents
|
* in the construction extents
|
||||||
*/
|
*/
|
||||||
if (tile_is_valid(tile) == FALSE)
|
if (tile_is_valid (tile) == FALSE)
|
||||||
{
|
{
|
||||||
tilex = j - (j % TILE_WIDTH);
|
tilex = j - (j % TILE_WIDTH);
|
||||||
tiley = i - (i % TILE_HEIGHT);
|
tiley = i - (i % TILE_HEIGHT);
|
||||||
|
|
||||||
startx = MIN (startx, tilex);
|
startx = MIN (startx, tilex);
|
||||||
endx = MAX (endx, tilex + tile_ewidth(tile));
|
endx = MAX (endx, tilex + tile_ewidth (tile));
|
||||||
starty = MIN (starty, tiley);
|
starty = MIN (starty, tiley);
|
||||||
endy = MAX (endy, tiley + tile_eheight(tile));
|
endy = MAX (endy, tiley + tile_eheight (tile));
|
||||||
|
|
||||||
tile_mark_valid (tile); /* hmmmmmmm..... */
|
tile_mark_valid (tile); /* hmmmmmmm..... */
|
||||||
}
|
}
|
||||||
|
@ -1991,6 +2000,21 @@ gimp_image_get_layer_index (GimpImage *gimage,
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Layer *
|
||||||
|
gimp_image_get_layer_by_index (GimpImage *gimage,
|
||||||
|
gint layer_index)
|
||||||
|
{
|
||||||
|
Layer *layer;
|
||||||
|
|
||||||
|
g_return_val_if_fail (gimage != NULL, NULL);
|
||||||
|
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
|
||||||
|
|
||||||
|
layer =
|
||||||
|
(Layer *) g_slist_nth_data (gimage->layers, layer_index);
|
||||||
|
|
||||||
|
return layer;
|
||||||
|
}
|
||||||
|
|
||||||
gint
|
gint
|
||||||
gimp_image_get_channel_index (GimpImage *gimage,
|
gimp_image_get_channel_index (GimpImage *gimage,
|
||||||
Channel *channel_ID)
|
Channel *channel_ID)
|
||||||
|
@ -1999,6 +2023,7 @@ gimp_image_get_channel_index (GimpImage *gimage,
|
||||||
GSList *channels;
|
GSList *channels;
|
||||||
gint index;
|
gint index;
|
||||||
|
|
||||||
|
g_return_val_if_fail (gimage != NULL, -1);
|
||||||
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), -1);
|
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), -1);
|
||||||
|
|
||||||
for (channels = gimage->channels, index = 0;
|
for (channels = gimage->channels, index = 0;
|
||||||
|
@ -2016,6 +2041,7 @@ gimp_image_get_channel_index (GimpImage *gimage,
|
||||||
Layer *
|
Layer *
|
||||||
gimp_image_get_active_layer (GimpImage *gimage)
|
gimp_image_get_active_layer (GimpImage *gimage)
|
||||||
{
|
{
|
||||||
|
g_return_val_if_fail (gimage != NULL, NULL);
|
||||||
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
|
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
|
||||||
|
|
||||||
return gimage->active_layer;
|
return gimage->active_layer;
|
||||||
|
|
|
@ -189,6 +189,7 @@ void gimp_image_colormap_changed (GimpImage * image,
|
||||||
/* layer/channel functions */
|
/* layer/channel functions */
|
||||||
|
|
||||||
gint gimp_image_get_layer_index (GimpImage *, Layer *);
|
gint gimp_image_get_layer_index (GimpImage *, Layer *);
|
||||||
|
Layer * gimp_image_get_layer_by_index (GimpImage *, gint);
|
||||||
gint gimp_image_get_channel_index (GimpImage *, Channel *);
|
gint gimp_image_get_channel_index (GimpImage *, Channel *);
|
||||||
Layer * gimp_image_get_active_layer (GimpImage *);
|
Layer * gimp_image_get_active_layer (GimpImage *);
|
||||||
Channel * gimp_image_get_active_channel (GimpImage *);
|
Channel * gimp_image_get_active_channel (GimpImage *);
|
||||||
|
|
|
@ -435,7 +435,7 @@ gimp_image_resize (GimpImage *gimage,
|
||||||
GSList *list;
|
GSList *list;
|
||||||
GList *guide_list;
|
GList *guide_list;
|
||||||
|
|
||||||
gimp_add_busy_cursors();
|
gimp_add_busy_cursors ();
|
||||||
|
|
||||||
g_assert (new_width > 0 && new_height > 0);
|
g_assert (new_width > 0 && new_height > 0);
|
||||||
|
|
||||||
|
@ -574,8 +574,8 @@ gimp_image_scale (GimpImage *gimage,
|
||||||
old_height = gimage->height;
|
old_height = gimage->height;
|
||||||
gimage->width = new_width;
|
gimage->width = new_width;
|
||||||
gimage->height = new_height;
|
gimage->height = new_height;
|
||||||
img_scale_w = (gdouble)new_width / (gdouble)old_width;
|
img_scale_w = (gdouble) new_width / (gdouble) old_width;
|
||||||
img_scale_h = (gdouble)new_height / (gdouble)old_height;
|
img_scale_h = (gdouble) new_height / (gdouble) old_height;
|
||||||
|
|
||||||
/* Scale all channels */
|
/* Scale all channels */
|
||||||
for (list = gimage->channels; list; list = g_slist_next (list))
|
for (list = gimage->channels; list; list = g_slist_next (list))
|
||||||
|
@ -600,10 +600,11 @@ gimp_image_scale (GimpImage *gimage,
|
||||||
layer = (Layer *) list->data;
|
layer = (Layer *) list->data;
|
||||||
if (layer_scale_by_factors (layer, img_scale_w, img_scale_h) == FALSE)
|
if (layer_scale_by_factors (layer, img_scale_w, img_scale_h) == FALSE)
|
||||||
{
|
{
|
||||||
/* Since 0 < img_scale_w, img_scale_h, failure due to one or more */
|
/* Since 0 < img_scale_w, img_scale_h, failure due to one or more
|
||||||
/* vanishing scaled layer dimensions. Implicit delete implemented */
|
* vanishing scaled layer dimensions. Implicit delete implemented
|
||||||
/* here. Upstream warning implemented in resize_check_layer_scaling() */
|
* here. Upstream warning implemented in resize_check_layer_scaling()
|
||||||
/* [resize.c line 1295], which offers the user the chance to bail out.*/
|
* [resize.c line 1295], which offers the user the chance to bail out.
|
||||||
|
*/
|
||||||
|
|
||||||
remove = g_slist_append (remove, layer);
|
remove = g_slist_append (remove, layer);
|
||||||
}
|
}
|
||||||
|
@ -733,7 +734,7 @@ gimp_image_apply_image (GimpImage *gimage,
|
||||||
/* determine what sort of operation is being attempted and
|
/* determine what sort of operation is being attempted and
|
||||||
* if it's actually legal...
|
* if it's actually legal...
|
||||||
*/
|
*/
|
||||||
operation = valid_combinations [drawable_type (drawable)][src2PR->bytes];
|
operation = valid_combinations[drawable_type (drawable)][src2PR->bytes];
|
||||||
if (operation == -1)
|
if (operation == -1)
|
||||||
{
|
{
|
||||||
g_message ("gimp_image_apply_image sent illegal parameters");
|
g_message ("gimp_image_apply_image sent illegal parameters");
|
||||||
|
@ -755,10 +756,10 @@ gimp_image_apply_image (GimpImage *gimage,
|
||||||
* we need to add the layer offset to transform coords
|
* we need to add the layer offset to transform coords
|
||||||
* into the mask coordinate system
|
* into the mask coordinate system
|
||||||
*/
|
*/
|
||||||
x1 = CLAMP (x1, -offset_x, drawable_width (GIMP_DRAWABLE(mask))-offset_x);
|
x1 = CLAMP (x1, -offset_x, drawable_width (GIMP_DRAWABLE (mask))-offset_x);
|
||||||
y1 = CLAMP (y1, -offset_y, drawable_height(GIMP_DRAWABLE(mask))-offset_y);
|
y1 = CLAMP (y1, -offset_y, drawable_height(GIMP_DRAWABLE (mask))-offset_y);
|
||||||
x2 = CLAMP (x2, -offset_x, drawable_width (GIMP_DRAWABLE(mask))-offset_x);
|
x2 = CLAMP (x2, -offset_x, drawable_width (GIMP_DRAWABLE (mask))-offset_x);
|
||||||
y2 = CLAMP (y2, -offset_y, drawable_height(GIMP_DRAWABLE(mask))-offset_y);
|
y2 = CLAMP (y2, -offset_y, drawable_height(GIMP_DRAWABLE (mask))-offset_y);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If the calling procedure specified an undo step... */
|
/* If the calling procedure specified an undo step... */
|
||||||
|
@ -800,8 +801,10 @@ gimp_image_apply_image (GimpImage *gimage,
|
||||||
opacity, mode, active, operation);
|
opacity, mode, active, operation);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
combine_regions (&src1PR, src2PR, &destPR, NULL, NULL,
|
{
|
||||||
opacity, mode, active, operation);
|
combine_regions (&src1PR, src2PR, &destPR, NULL, NULL,
|
||||||
|
opacity, mode, active, operation);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Similar to gimp_image_apply_image but works in "replace" mode (i.e.
|
/* Similar to gimp_image_apply_image but works in "replace" mode (i.e.
|
||||||
|
@ -860,10 +863,10 @@ gimp_image_replace_image (GimpImage *gimage,
|
||||||
* we need to add the layer offset to transform coords
|
* we need to add the layer offset to transform coords
|
||||||
* into the mask coordinate system
|
* into the mask coordinate system
|
||||||
*/
|
*/
|
||||||
x1 = CLAMP (x1, -offset_x, drawable_width (GIMP_DRAWABLE(mask))-offset_x);
|
x1 = CLAMP (x1, -offset_x, drawable_width (GIMP_DRAWABLE (mask))-offset_x);
|
||||||
y1 = CLAMP (y1, -offset_y, drawable_height(GIMP_DRAWABLE(mask))-offset_y);
|
y1 = CLAMP (y1, -offset_y, drawable_height(GIMP_DRAWABLE (mask))-offset_y);
|
||||||
x2 = CLAMP (x2, -offset_x, drawable_width (GIMP_DRAWABLE(mask))-offset_x);
|
x2 = CLAMP (x2, -offset_x, drawable_width (GIMP_DRAWABLE (mask))-offset_x);
|
||||||
y2 = CLAMP (y2, -offset_y, drawable_height(GIMP_DRAWABLE(mask))-offset_y);
|
y2 = CLAMP (y2, -offset_y, drawable_height(GIMP_DRAWABLE (mask))-offset_y);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If the calling procedure specified an undo step... */
|
/* If the calling procedure specified an undo step... */
|
||||||
|
@ -873,9 +876,13 @@ gimp_image_replace_image (GimpImage *gimage,
|
||||||
/* configure the pixel regions
|
/* configure the pixel regions
|
||||||
* If an alternative to using the drawable's data as src1 was provided...
|
* If an alternative to using the drawable's data as src1 was provided...
|
||||||
*/
|
*/
|
||||||
pixel_region_init (&src1PR, drawable_data (drawable), x1, y1, (x2 - x1), (y2 - y1), FALSE);
|
pixel_region_init (&src1PR, drawable_data (drawable),
|
||||||
pixel_region_init (&destPR, drawable_data (drawable), x1, y1, (x2 - x1), (y2 - y1), TRUE);
|
x1, y1, (x2 - x1), (y2 - y1), FALSE);
|
||||||
pixel_region_resize (src2PR, src2PR->x + (x1 - x), src2PR->y + (y1 - y), (x2 - x1), (y2 - y1));
|
pixel_region_init (&destPR, drawable_data (drawable),
|
||||||
|
x1, y1, (x2 - x1), (y2 - y1), TRUE);
|
||||||
|
pixel_region_resize (src2PR,
|
||||||
|
src2PR->x + (x1 - x), src2PR->y + (y1 - y),
|
||||||
|
(x2 - x1), (y2 - y1));
|
||||||
|
|
||||||
if (mask)
|
if (mask)
|
||||||
{
|
{
|
||||||
|
@ -926,8 +933,10 @@ gimp_image_replace_image (GimpImage *gimage,
|
||||||
g_free (temp_data);
|
g_free (temp_data);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
combine_regions_replace (&src1PR, src2PR, &destPR, maskPR, NULL,
|
{
|
||||||
opacity, active, operation);
|
combine_regions_replace (&src1PR, src2PR, &destPR, maskPR, NULL,
|
||||||
|
opacity, active, operation);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get rid of these! A "foreground" is an UI concept.. */
|
/* Get rid of these! A "foreground" is an UI concept.. */
|
||||||
|
@ -1536,19 +1545,19 @@ gimp_image_construct_layers (GimpImage *gimage,
|
||||||
/* only add layers that are visible and not floating selections
|
/* only add layers that are visible and not floating selections
|
||||||
to the list */
|
to the list */
|
||||||
if (!layer_is_floating_sel (layer) &&
|
if (!layer_is_floating_sel (layer) &&
|
||||||
drawable_visible (GIMP_DRAWABLE(layer)))
|
drawable_visible (GIMP_DRAWABLE (layer)))
|
||||||
reverse_list = g_slist_prepend (reverse_list, layer);
|
reverse_list = g_slist_prepend (reverse_list, layer);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (reverse_list)
|
while (reverse_list)
|
||||||
{
|
{
|
||||||
layer = (Layer *) reverse_list->data;
|
layer = (Layer *) reverse_list->data;
|
||||||
drawable_offsets (GIMP_DRAWABLE(layer), &off_x, &off_y);
|
drawable_offsets (GIMP_DRAWABLE (layer), &off_x, &off_y);
|
||||||
|
|
||||||
x1 = CLAMP (off_x, x, x + w);
|
x1 = CLAMP (off_x, x, x + w);
|
||||||
y1 = CLAMP (off_y, y, y + h);
|
y1 = CLAMP (off_y, y, y + h);
|
||||||
x2 = CLAMP (off_x + drawable_width (GIMP_DRAWABLE(layer)), x, x + w);
|
x2 = CLAMP (off_x + drawable_width (GIMP_DRAWABLE (layer)), x, x + w);
|
||||||
y2 = CLAMP (off_y + drawable_height (GIMP_DRAWABLE(layer)), y, y + h);
|
y2 = CLAMP (off_y + drawable_height (GIMP_DRAWABLE (layer)), y, y + h);
|
||||||
|
|
||||||
/* configure the pixel regions */
|
/* configure the pixel regions */
|
||||||
pixel_region_init (&src1PR, gimp_image_projection (gimage),
|
pixel_region_init (&src1PR, gimp_image_projection (gimage),
|
||||||
|
@ -1559,7 +1568,7 @@ gimp_image_construct_layers (GimpImage *gimage,
|
||||||
if (layer->mask && layer->show_mask)
|
if (layer->mask && layer->show_mask)
|
||||||
{
|
{
|
||||||
pixel_region_init (&src2PR,
|
pixel_region_init (&src2PR,
|
||||||
drawable_data (GIMP_DRAWABLE(layer->mask)),
|
drawable_data (GIMP_DRAWABLE (layer->mask)),
|
||||||
(x1 - off_x), (y1 - off_y),
|
(x1 - off_x), (y1 - off_y),
|
||||||
(x2 - x1), (y2 - y1), FALSE);
|
(x2 - x1), (y2 - y1), FALSE);
|
||||||
|
|
||||||
|
@ -1587,7 +1596,7 @@ gimp_image_construct_layers (GimpImage *gimage,
|
||||||
/* Based on the type of the layer, project the layer onto the
|
/* Based on the type of the layer, project the layer onto the
|
||||||
* projection image...
|
* projection image...
|
||||||
*/
|
*/
|
||||||
switch (drawable_type (GIMP_DRAWABLE(layer)))
|
switch (drawable_type (GIMP_DRAWABLE (layer)))
|
||||||
{
|
{
|
||||||
case RGB_GIMAGE: case GRAY_GIMAGE:
|
case RGB_GIMAGE: case GRAY_GIMAGE:
|
||||||
/* no mask possible */
|
/* no mask possible */
|
||||||
|
@ -1627,7 +1636,8 @@ gimp_image_construct_channels (GimpImage *gimage,
|
||||||
gint h)
|
gint h)
|
||||||
{
|
{
|
||||||
Channel *channel;
|
Channel *channel;
|
||||||
PixelRegion src1PR, src2PR;
|
PixelRegion src1PR;
|
||||||
|
PixelRegion src2PR;
|
||||||
GSList *list;
|
GSList *list;
|
||||||
GSList *reverse_list = NULL;
|
GSList *reverse_list = NULL;
|
||||||
|
|
||||||
|
@ -1645,7 +1655,7 @@ gimp_image_construct_channels (GimpImage *gimage,
|
||||||
pixel_region_init (&src1PR, gimp_image_projection (gimage),
|
pixel_region_init (&src1PR, gimp_image_projection (gimage),
|
||||||
x, y, w, h,
|
x, y, w, h,
|
||||||
TRUE);
|
TRUE);
|
||||||
pixel_region_init (&src2PR, drawable_data (GIMP_DRAWABLE(channel)),
|
pixel_region_init (&src2PR, drawable_data (GIMP_DRAWABLE (channel)),
|
||||||
x, y, w, h,
|
x, y, w, h,
|
||||||
FALSE);
|
FALSE);
|
||||||
|
|
||||||
|
@ -1683,14 +1693,14 @@ gimp_image_initialize_projection (GimpImage *gimage,
|
||||||
gint off_x, off_y;
|
gint off_x, off_y;
|
||||||
|
|
||||||
layer = (Layer *) list->data;
|
layer = (Layer *) list->data;
|
||||||
drawable_offsets (GIMP_DRAWABLE(layer), &off_x, &off_y);
|
drawable_offsets (GIMP_DRAWABLE (layer), &off_x, &off_y);
|
||||||
|
|
||||||
if (drawable_visible (GIMP_DRAWABLE(layer)) &&
|
if (drawable_visible (GIMP_DRAWABLE (layer)) &&
|
||||||
! layer_has_alpha (layer) &&
|
! layer_has_alpha (layer) &&
|
||||||
(off_x <= x) &&
|
(off_x <= x) &&
|
||||||
(off_y <= y) &&
|
(off_y <= y) &&
|
||||||
(off_x + drawable_width (GIMP_DRAWABLE(layer)) >= x + w) &&
|
(off_x + drawable_width (GIMP_DRAWABLE (layer)) >= x + w) &&
|
||||||
(off_y + drawable_height (GIMP_DRAWABLE(layer)) >= y + h))
|
(off_y + drawable_height (GIMP_DRAWABLE (layer)) >= y + h))
|
||||||
{
|
{
|
||||||
coverage = 1;
|
coverage = 1;
|
||||||
break;
|
break;
|
||||||
|
@ -1738,9 +1748,9 @@ gimp_image_get_active_channels (GimpImage *gimage,
|
||||||
|
|
||||||
void
|
void
|
||||||
gimp_image_construct (GimpImage *gimage,
|
gimp_image_construct (GimpImage *gimage,
|
||||||
gint x,
|
gint x,
|
||||||
gint y,
|
gint y,
|
||||||
gint w,
|
gint w,
|
||||||
gint h,
|
gint h,
|
||||||
gboolean can_use_cowproject)
|
gboolean can_use_cowproject)
|
||||||
{
|
{
|
||||||
|
@ -1757,12 +1767,11 @@ gimp_image_construct (GimpImage *gimage,
|
||||||
|
|
||||||
if (gimage->layers)
|
if (gimage->layers)
|
||||||
{
|
{
|
||||||
gimp_drawable_offsets (GIMP_DRAWABLE((Layer*)(gimage->layers->data)),
|
gimp_drawable_offsets (GIMP_DRAWABLE ((Layer*) gimage->layers->data),
|
||||||
&xoff, &yoff);
|
&xoff, &yoff);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (/*can_use_cowproject &&*/
|
if ((gimage->layers) && /* There's a layer. */
|
||||||
(gimage->layers) && /* There's a layer. */
|
|
||||||
(!g_slist_next(gimage->layers)) && /* It's the only layer. */
|
(!g_slist_next(gimage->layers)) && /* It's the only layer. */
|
||||||
(layer_has_alpha((Layer*)(gimage->layers->data))) && /* It's !flat. */
|
(layer_has_alpha((Layer*)(gimage->layers->data))) && /* It's !flat. */
|
||||||
/* It's visible. */
|
/* It's visible. */
|
||||||
|
@ -1926,15 +1935,15 @@ gimp_image_invalidate (GimpImage *gimage,
|
||||||
/* If the tile is not valid, make sure we get the entire tile
|
/* If the tile is not valid, make sure we get the entire tile
|
||||||
* in the construction extents
|
* in the construction extents
|
||||||
*/
|
*/
|
||||||
if (tile_is_valid(tile) == FALSE)
|
if (tile_is_valid (tile) == FALSE)
|
||||||
{
|
{
|
||||||
tilex = j - (j % TILE_WIDTH);
|
tilex = j - (j % TILE_WIDTH);
|
||||||
tiley = i - (i % TILE_HEIGHT);
|
tiley = i - (i % TILE_HEIGHT);
|
||||||
|
|
||||||
startx = MIN (startx, tilex);
|
startx = MIN (startx, tilex);
|
||||||
endx = MAX (endx, tilex + tile_ewidth(tile));
|
endx = MAX (endx, tilex + tile_ewidth (tile));
|
||||||
starty = MIN (starty, tiley);
|
starty = MIN (starty, tiley);
|
||||||
endy = MAX (endy, tiley + tile_eheight(tile));
|
endy = MAX (endy, tiley + tile_eheight (tile));
|
||||||
|
|
||||||
tile_mark_valid (tile); /* hmmmmmmm..... */
|
tile_mark_valid (tile); /* hmmmmmmm..... */
|
||||||
}
|
}
|
||||||
|
@ -1991,6 +2000,21 @@ gimp_image_get_layer_index (GimpImage *gimage,
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Layer *
|
||||||
|
gimp_image_get_layer_by_index (GimpImage *gimage,
|
||||||
|
gint layer_index)
|
||||||
|
{
|
||||||
|
Layer *layer;
|
||||||
|
|
||||||
|
g_return_val_if_fail (gimage != NULL, NULL);
|
||||||
|
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
|
||||||
|
|
||||||
|
layer =
|
||||||
|
(Layer *) g_slist_nth_data (gimage->layers, layer_index);
|
||||||
|
|
||||||
|
return layer;
|
||||||
|
}
|
||||||
|
|
||||||
gint
|
gint
|
||||||
gimp_image_get_channel_index (GimpImage *gimage,
|
gimp_image_get_channel_index (GimpImage *gimage,
|
||||||
Channel *channel_ID)
|
Channel *channel_ID)
|
||||||
|
@ -1999,6 +2023,7 @@ gimp_image_get_channel_index (GimpImage *gimage,
|
||||||
GSList *channels;
|
GSList *channels;
|
||||||
gint index;
|
gint index;
|
||||||
|
|
||||||
|
g_return_val_if_fail (gimage != NULL, -1);
|
||||||
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), -1);
|
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), -1);
|
||||||
|
|
||||||
for (channels = gimage->channels, index = 0;
|
for (channels = gimage->channels, index = 0;
|
||||||
|
@ -2016,6 +2041,7 @@ gimp_image_get_channel_index (GimpImage *gimage,
|
||||||
Layer *
|
Layer *
|
||||||
gimp_image_get_active_layer (GimpImage *gimage)
|
gimp_image_get_active_layer (GimpImage *gimage)
|
||||||
{
|
{
|
||||||
|
g_return_val_if_fail (gimage != NULL, NULL);
|
||||||
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
|
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
|
||||||
|
|
||||||
return gimage->active_layer;
|
return gimage->active_layer;
|
||||||
|
|
|
@ -189,6 +189,7 @@ void gimp_image_colormap_changed (GimpImage * image,
|
||||||
/* layer/channel functions */
|
/* layer/channel functions */
|
||||||
|
|
||||||
gint gimp_image_get_layer_index (GimpImage *, Layer *);
|
gint gimp_image_get_layer_index (GimpImage *, Layer *);
|
||||||
|
Layer * gimp_image_get_layer_by_index (GimpImage *, gint);
|
||||||
gint gimp_image_get_channel_index (GimpImage *, Channel *);
|
gint gimp_image_get_channel_index (GimpImage *, Channel *);
|
||||||
Layer * gimp_image_get_active_layer (GimpImage *);
|
Layer * gimp_image_get_active_layer (GimpImage *);
|
||||||
Channel * gimp_image_get_active_channel (GimpImage *);
|
Channel * gimp_image_get_active_channel (GimpImage *);
|
||||||
|
|
|
@ -435,7 +435,7 @@ gimp_image_resize (GimpImage *gimage,
|
||||||
GSList *list;
|
GSList *list;
|
||||||
GList *guide_list;
|
GList *guide_list;
|
||||||
|
|
||||||
gimp_add_busy_cursors();
|
gimp_add_busy_cursors ();
|
||||||
|
|
||||||
g_assert (new_width > 0 && new_height > 0);
|
g_assert (new_width > 0 && new_height > 0);
|
||||||
|
|
||||||
|
@ -574,8 +574,8 @@ gimp_image_scale (GimpImage *gimage,
|
||||||
old_height = gimage->height;
|
old_height = gimage->height;
|
||||||
gimage->width = new_width;
|
gimage->width = new_width;
|
||||||
gimage->height = new_height;
|
gimage->height = new_height;
|
||||||
img_scale_w = (gdouble)new_width / (gdouble)old_width;
|
img_scale_w = (gdouble) new_width / (gdouble) old_width;
|
||||||
img_scale_h = (gdouble)new_height / (gdouble)old_height;
|
img_scale_h = (gdouble) new_height / (gdouble) old_height;
|
||||||
|
|
||||||
/* Scale all channels */
|
/* Scale all channels */
|
||||||
for (list = gimage->channels; list; list = g_slist_next (list))
|
for (list = gimage->channels; list; list = g_slist_next (list))
|
||||||
|
@ -600,10 +600,11 @@ gimp_image_scale (GimpImage *gimage,
|
||||||
layer = (Layer *) list->data;
|
layer = (Layer *) list->data;
|
||||||
if (layer_scale_by_factors (layer, img_scale_w, img_scale_h) == FALSE)
|
if (layer_scale_by_factors (layer, img_scale_w, img_scale_h) == FALSE)
|
||||||
{
|
{
|
||||||
/* Since 0 < img_scale_w, img_scale_h, failure due to one or more */
|
/* Since 0 < img_scale_w, img_scale_h, failure due to one or more
|
||||||
/* vanishing scaled layer dimensions. Implicit delete implemented */
|
* vanishing scaled layer dimensions. Implicit delete implemented
|
||||||
/* here. Upstream warning implemented in resize_check_layer_scaling() */
|
* here. Upstream warning implemented in resize_check_layer_scaling()
|
||||||
/* [resize.c line 1295], which offers the user the chance to bail out.*/
|
* [resize.c line 1295], which offers the user the chance to bail out.
|
||||||
|
*/
|
||||||
|
|
||||||
remove = g_slist_append (remove, layer);
|
remove = g_slist_append (remove, layer);
|
||||||
}
|
}
|
||||||
|
@ -733,7 +734,7 @@ gimp_image_apply_image (GimpImage *gimage,
|
||||||
/* determine what sort of operation is being attempted and
|
/* determine what sort of operation is being attempted and
|
||||||
* if it's actually legal...
|
* if it's actually legal...
|
||||||
*/
|
*/
|
||||||
operation = valid_combinations [drawable_type (drawable)][src2PR->bytes];
|
operation = valid_combinations[drawable_type (drawable)][src2PR->bytes];
|
||||||
if (operation == -1)
|
if (operation == -1)
|
||||||
{
|
{
|
||||||
g_message ("gimp_image_apply_image sent illegal parameters");
|
g_message ("gimp_image_apply_image sent illegal parameters");
|
||||||
|
@ -755,10 +756,10 @@ gimp_image_apply_image (GimpImage *gimage,
|
||||||
* we need to add the layer offset to transform coords
|
* we need to add the layer offset to transform coords
|
||||||
* into the mask coordinate system
|
* into the mask coordinate system
|
||||||
*/
|
*/
|
||||||
x1 = CLAMP (x1, -offset_x, drawable_width (GIMP_DRAWABLE(mask))-offset_x);
|
x1 = CLAMP (x1, -offset_x, drawable_width (GIMP_DRAWABLE (mask))-offset_x);
|
||||||
y1 = CLAMP (y1, -offset_y, drawable_height(GIMP_DRAWABLE(mask))-offset_y);
|
y1 = CLAMP (y1, -offset_y, drawable_height(GIMP_DRAWABLE (mask))-offset_y);
|
||||||
x2 = CLAMP (x2, -offset_x, drawable_width (GIMP_DRAWABLE(mask))-offset_x);
|
x2 = CLAMP (x2, -offset_x, drawable_width (GIMP_DRAWABLE (mask))-offset_x);
|
||||||
y2 = CLAMP (y2, -offset_y, drawable_height(GIMP_DRAWABLE(mask))-offset_y);
|
y2 = CLAMP (y2, -offset_y, drawable_height(GIMP_DRAWABLE (mask))-offset_y);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If the calling procedure specified an undo step... */
|
/* If the calling procedure specified an undo step... */
|
||||||
|
@ -800,8 +801,10 @@ gimp_image_apply_image (GimpImage *gimage,
|
||||||
opacity, mode, active, operation);
|
opacity, mode, active, operation);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
combine_regions (&src1PR, src2PR, &destPR, NULL, NULL,
|
{
|
||||||
opacity, mode, active, operation);
|
combine_regions (&src1PR, src2PR, &destPR, NULL, NULL,
|
||||||
|
opacity, mode, active, operation);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Similar to gimp_image_apply_image but works in "replace" mode (i.e.
|
/* Similar to gimp_image_apply_image but works in "replace" mode (i.e.
|
||||||
|
@ -860,10 +863,10 @@ gimp_image_replace_image (GimpImage *gimage,
|
||||||
* we need to add the layer offset to transform coords
|
* we need to add the layer offset to transform coords
|
||||||
* into the mask coordinate system
|
* into the mask coordinate system
|
||||||
*/
|
*/
|
||||||
x1 = CLAMP (x1, -offset_x, drawable_width (GIMP_DRAWABLE(mask))-offset_x);
|
x1 = CLAMP (x1, -offset_x, drawable_width (GIMP_DRAWABLE (mask))-offset_x);
|
||||||
y1 = CLAMP (y1, -offset_y, drawable_height(GIMP_DRAWABLE(mask))-offset_y);
|
y1 = CLAMP (y1, -offset_y, drawable_height(GIMP_DRAWABLE (mask))-offset_y);
|
||||||
x2 = CLAMP (x2, -offset_x, drawable_width (GIMP_DRAWABLE(mask))-offset_x);
|
x2 = CLAMP (x2, -offset_x, drawable_width (GIMP_DRAWABLE (mask))-offset_x);
|
||||||
y2 = CLAMP (y2, -offset_y, drawable_height(GIMP_DRAWABLE(mask))-offset_y);
|
y2 = CLAMP (y2, -offset_y, drawable_height(GIMP_DRAWABLE (mask))-offset_y);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If the calling procedure specified an undo step... */
|
/* If the calling procedure specified an undo step... */
|
||||||
|
@ -873,9 +876,13 @@ gimp_image_replace_image (GimpImage *gimage,
|
||||||
/* configure the pixel regions
|
/* configure the pixel regions
|
||||||
* If an alternative to using the drawable's data as src1 was provided...
|
* If an alternative to using the drawable's data as src1 was provided...
|
||||||
*/
|
*/
|
||||||
pixel_region_init (&src1PR, drawable_data (drawable), x1, y1, (x2 - x1), (y2 - y1), FALSE);
|
pixel_region_init (&src1PR, drawable_data (drawable),
|
||||||
pixel_region_init (&destPR, drawable_data (drawable), x1, y1, (x2 - x1), (y2 - y1), TRUE);
|
x1, y1, (x2 - x1), (y2 - y1), FALSE);
|
||||||
pixel_region_resize (src2PR, src2PR->x + (x1 - x), src2PR->y + (y1 - y), (x2 - x1), (y2 - y1));
|
pixel_region_init (&destPR, drawable_data (drawable),
|
||||||
|
x1, y1, (x2 - x1), (y2 - y1), TRUE);
|
||||||
|
pixel_region_resize (src2PR,
|
||||||
|
src2PR->x + (x1 - x), src2PR->y + (y1 - y),
|
||||||
|
(x2 - x1), (y2 - y1));
|
||||||
|
|
||||||
if (mask)
|
if (mask)
|
||||||
{
|
{
|
||||||
|
@ -926,8 +933,10 @@ gimp_image_replace_image (GimpImage *gimage,
|
||||||
g_free (temp_data);
|
g_free (temp_data);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
combine_regions_replace (&src1PR, src2PR, &destPR, maskPR, NULL,
|
{
|
||||||
opacity, active, operation);
|
combine_regions_replace (&src1PR, src2PR, &destPR, maskPR, NULL,
|
||||||
|
opacity, active, operation);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get rid of these! A "foreground" is an UI concept.. */
|
/* Get rid of these! A "foreground" is an UI concept.. */
|
||||||
|
@ -1536,19 +1545,19 @@ gimp_image_construct_layers (GimpImage *gimage,
|
||||||
/* only add layers that are visible and not floating selections
|
/* only add layers that are visible and not floating selections
|
||||||
to the list */
|
to the list */
|
||||||
if (!layer_is_floating_sel (layer) &&
|
if (!layer_is_floating_sel (layer) &&
|
||||||
drawable_visible (GIMP_DRAWABLE(layer)))
|
drawable_visible (GIMP_DRAWABLE (layer)))
|
||||||
reverse_list = g_slist_prepend (reverse_list, layer);
|
reverse_list = g_slist_prepend (reverse_list, layer);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (reverse_list)
|
while (reverse_list)
|
||||||
{
|
{
|
||||||
layer = (Layer *) reverse_list->data;
|
layer = (Layer *) reverse_list->data;
|
||||||
drawable_offsets (GIMP_DRAWABLE(layer), &off_x, &off_y);
|
drawable_offsets (GIMP_DRAWABLE (layer), &off_x, &off_y);
|
||||||
|
|
||||||
x1 = CLAMP (off_x, x, x + w);
|
x1 = CLAMP (off_x, x, x + w);
|
||||||
y1 = CLAMP (off_y, y, y + h);
|
y1 = CLAMP (off_y, y, y + h);
|
||||||
x2 = CLAMP (off_x + drawable_width (GIMP_DRAWABLE(layer)), x, x + w);
|
x2 = CLAMP (off_x + drawable_width (GIMP_DRAWABLE (layer)), x, x + w);
|
||||||
y2 = CLAMP (off_y + drawable_height (GIMP_DRAWABLE(layer)), y, y + h);
|
y2 = CLAMP (off_y + drawable_height (GIMP_DRAWABLE (layer)), y, y + h);
|
||||||
|
|
||||||
/* configure the pixel regions */
|
/* configure the pixel regions */
|
||||||
pixel_region_init (&src1PR, gimp_image_projection (gimage),
|
pixel_region_init (&src1PR, gimp_image_projection (gimage),
|
||||||
|
@ -1559,7 +1568,7 @@ gimp_image_construct_layers (GimpImage *gimage,
|
||||||
if (layer->mask && layer->show_mask)
|
if (layer->mask && layer->show_mask)
|
||||||
{
|
{
|
||||||
pixel_region_init (&src2PR,
|
pixel_region_init (&src2PR,
|
||||||
drawable_data (GIMP_DRAWABLE(layer->mask)),
|
drawable_data (GIMP_DRAWABLE (layer->mask)),
|
||||||
(x1 - off_x), (y1 - off_y),
|
(x1 - off_x), (y1 - off_y),
|
||||||
(x2 - x1), (y2 - y1), FALSE);
|
(x2 - x1), (y2 - y1), FALSE);
|
||||||
|
|
||||||
|
@ -1587,7 +1596,7 @@ gimp_image_construct_layers (GimpImage *gimage,
|
||||||
/* Based on the type of the layer, project the layer onto the
|
/* Based on the type of the layer, project the layer onto the
|
||||||
* projection image...
|
* projection image...
|
||||||
*/
|
*/
|
||||||
switch (drawable_type (GIMP_DRAWABLE(layer)))
|
switch (drawable_type (GIMP_DRAWABLE (layer)))
|
||||||
{
|
{
|
||||||
case RGB_GIMAGE: case GRAY_GIMAGE:
|
case RGB_GIMAGE: case GRAY_GIMAGE:
|
||||||
/* no mask possible */
|
/* no mask possible */
|
||||||
|
@ -1627,7 +1636,8 @@ gimp_image_construct_channels (GimpImage *gimage,
|
||||||
gint h)
|
gint h)
|
||||||
{
|
{
|
||||||
Channel *channel;
|
Channel *channel;
|
||||||
PixelRegion src1PR, src2PR;
|
PixelRegion src1PR;
|
||||||
|
PixelRegion src2PR;
|
||||||
GSList *list;
|
GSList *list;
|
||||||
GSList *reverse_list = NULL;
|
GSList *reverse_list = NULL;
|
||||||
|
|
||||||
|
@ -1645,7 +1655,7 @@ gimp_image_construct_channels (GimpImage *gimage,
|
||||||
pixel_region_init (&src1PR, gimp_image_projection (gimage),
|
pixel_region_init (&src1PR, gimp_image_projection (gimage),
|
||||||
x, y, w, h,
|
x, y, w, h,
|
||||||
TRUE);
|
TRUE);
|
||||||
pixel_region_init (&src2PR, drawable_data (GIMP_DRAWABLE(channel)),
|
pixel_region_init (&src2PR, drawable_data (GIMP_DRAWABLE (channel)),
|
||||||
x, y, w, h,
|
x, y, w, h,
|
||||||
FALSE);
|
FALSE);
|
||||||
|
|
||||||
|
@ -1683,14 +1693,14 @@ gimp_image_initialize_projection (GimpImage *gimage,
|
||||||
gint off_x, off_y;
|
gint off_x, off_y;
|
||||||
|
|
||||||
layer = (Layer *) list->data;
|
layer = (Layer *) list->data;
|
||||||
drawable_offsets (GIMP_DRAWABLE(layer), &off_x, &off_y);
|
drawable_offsets (GIMP_DRAWABLE (layer), &off_x, &off_y);
|
||||||
|
|
||||||
if (drawable_visible (GIMP_DRAWABLE(layer)) &&
|
if (drawable_visible (GIMP_DRAWABLE (layer)) &&
|
||||||
! layer_has_alpha (layer) &&
|
! layer_has_alpha (layer) &&
|
||||||
(off_x <= x) &&
|
(off_x <= x) &&
|
||||||
(off_y <= y) &&
|
(off_y <= y) &&
|
||||||
(off_x + drawable_width (GIMP_DRAWABLE(layer)) >= x + w) &&
|
(off_x + drawable_width (GIMP_DRAWABLE (layer)) >= x + w) &&
|
||||||
(off_y + drawable_height (GIMP_DRAWABLE(layer)) >= y + h))
|
(off_y + drawable_height (GIMP_DRAWABLE (layer)) >= y + h))
|
||||||
{
|
{
|
||||||
coverage = 1;
|
coverage = 1;
|
||||||
break;
|
break;
|
||||||
|
@ -1738,9 +1748,9 @@ gimp_image_get_active_channels (GimpImage *gimage,
|
||||||
|
|
||||||
void
|
void
|
||||||
gimp_image_construct (GimpImage *gimage,
|
gimp_image_construct (GimpImage *gimage,
|
||||||
gint x,
|
gint x,
|
||||||
gint y,
|
gint y,
|
||||||
gint w,
|
gint w,
|
||||||
gint h,
|
gint h,
|
||||||
gboolean can_use_cowproject)
|
gboolean can_use_cowproject)
|
||||||
{
|
{
|
||||||
|
@ -1757,12 +1767,11 @@ gimp_image_construct (GimpImage *gimage,
|
||||||
|
|
||||||
if (gimage->layers)
|
if (gimage->layers)
|
||||||
{
|
{
|
||||||
gimp_drawable_offsets (GIMP_DRAWABLE((Layer*)(gimage->layers->data)),
|
gimp_drawable_offsets (GIMP_DRAWABLE ((Layer*) gimage->layers->data),
|
||||||
&xoff, &yoff);
|
&xoff, &yoff);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (/*can_use_cowproject &&*/
|
if ((gimage->layers) && /* There's a layer. */
|
||||||
(gimage->layers) && /* There's a layer. */
|
|
||||||
(!g_slist_next(gimage->layers)) && /* It's the only layer. */
|
(!g_slist_next(gimage->layers)) && /* It's the only layer. */
|
||||||
(layer_has_alpha((Layer*)(gimage->layers->data))) && /* It's !flat. */
|
(layer_has_alpha((Layer*)(gimage->layers->data))) && /* It's !flat. */
|
||||||
/* It's visible. */
|
/* It's visible. */
|
||||||
|
@ -1926,15 +1935,15 @@ gimp_image_invalidate (GimpImage *gimage,
|
||||||
/* If the tile is not valid, make sure we get the entire tile
|
/* If the tile is not valid, make sure we get the entire tile
|
||||||
* in the construction extents
|
* in the construction extents
|
||||||
*/
|
*/
|
||||||
if (tile_is_valid(tile) == FALSE)
|
if (tile_is_valid (tile) == FALSE)
|
||||||
{
|
{
|
||||||
tilex = j - (j % TILE_WIDTH);
|
tilex = j - (j % TILE_WIDTH);
|
||||||
tiley = i - (i % TILE_HEIGHT);
|
tiley = i - (i % TILE_HEIGHT);
|
||||||
|
|
||||||
startx = MIN (startx, tilex);
|
startx = MIN (startx, tilex);
|
||||||
endx = MAX (endx, tilex + tile_ewidth(tile));
|
endx = MAX (endx, tilex + tile_ewidth (tile));
|
||||||
starty = MIN (starty, tiley);
|
starty = MIN (starty, tiley);
|
||||||
endy = MAX (endy, tiley + tile_eheight(tile));
|
endy = MAX (endy, tiley + tile_eheight (tile));
|
||||||
|
|
||||||
tile_mark_valid (tile); /* hmmmmmmm..... */
|
tile_mark_valid (tile); /* hmmmmmmm..... */
|
||||||
}
|
}
|
||||||
|
@ -1991,6 +2000,21 @@ gimp_image_get_layer_index (GimpImage *gimage,
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Layer *
|
||||||
|
gimp_image_get_layer_by_index (GimpImage *gimage,
|
||||||
|
gint layer_index)
|
||||||
|
{
|
||||||
|
Layer *layer;
|
||||||
|
|
||||||
|
g_return_val_if_fail (gimage != NULL, NULL);
|
||||||
|
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
|
||||||
|
|
||||||
|
layer =
|
||||||
|
(Layer *) g_slist_nth_data (gimage->layers, layer_index);
|
||||||
|
|
||||||
|
return layer;
|
||||||
|
}
|
||||||
|
|
||||||
gint
|
gint
|
||||||
gimp_image_get_channel_index (GimpImage *gimage,
|
gimp_image_get_channel_index (GimpImage *gimage,
|
||||||
Channel *channel_ID)
|
Channel *channel_ID)
|
||||||
|
@ -1999,6 +2023,7 @@ gimp_image_get_channel_index (GimpImage *gimage,
|
||||||
GSList *channels;
|
GSList *channels;
|
||||||
gint index;
|
gint index;
|
||||||
|
|
||||||
|
g_return_val_if_fail (gimage != NULL, -1);
|
||||||
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), -1);
|
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), -1);
|
||||||
|
|
||||||
for (channels = gimage->channels, index = 0;
|
for (channels = gimage->channels, index = 0;
|
||||||
|
@ -2016,6 +2041,7 @@ gimp_image_get_channel_index (GimpImage *gimage,
|
||||||
Layer *
|
Layer *
|
||||||
gimp_image_get_active_layer (GimpImage *gimage)
|
gimp_image_get_active_layer (GimpImage *gimage)
|
||||||
{
|
{
|
||||||
|
g_return_val_if_fail (gimage != NULL, NULL);
|
||||||
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
|
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
|
||||||
|
|
||||||
return gimage->active_layer;
|
return gimage->active_layer;
|
||||||
|
|
|
@ -189,6 +189,7 @@ void gimp_image_colormap_changed (GimpImage * image,
|
||||||
/* layer/channel functions */
|
/* layer/channel functions */
|
||||||
|
|
||||||
gint gimp_image_get_layer_index (GimpImage *, Layer *);
|
gint gimp_image_get_layer_index (GimpImage *, Layer *);
|
||||||
|
Layer * gimp_image_get_layer_by_index (GimpImage *, gint);
|
||||||
gint gimp_image_get_channel_index (GimpImage *, Channel *);
|
gint gimp_image_get_channel_index (GimpImage *, Channel *);
|
||||||
Layer * gimp_image_get_active_layer (GimpImage *);
|
Layer * gimp_image_get_active_layer (GimpImage *);
|
||||||
Channel * gimp_image_get_active_channel (GimpImage *);
|
Channel * gimp_image_get_active_channel (GimpImage *);
|
||||||
|
|
|
@ -435,7 +435,7 @@ gimp_image_resize (GimpImage *gimage,
|
||||||
GSList *list;
|
GSList *list;
|
||||||
GList *guide_list;
|
GList *guide_list;
|
||||||
|
|
||||||
gimp_add_busy_cursors();
|
gimp_add_busy_cursors ();
|
||||||
|
|
||||||
g_assert (new_width > 0 && new_height > 0);
|
g_assert (new_width > 0 && new_height > 0);
|
||||||
|
|
||||||
|
@ -574,8 +574,8 @@ gimp_image_scale (GimpImage *gimage,
|
||||||
old_height = gimage->height;
|
old_height = gimage->height;
|
||||||
gimage->width = new_width;
|
gimage->width = new_width;
|
||||||
gimage->height = new_height;
|
gimage->height = new_height;
|
||||||
img_scale_w = (gdouble)new_width / (gdouble)old_width;
|
img_scale_w = (gdouble) new_width / (gdouble) old_width;
|
||||||
img_scale_h = (gdouble)new_height / (gdouble)old_height;
|
img_scale_h = (gdouble) new_height / (gdouble) old_height;
|
||||||
|
|
||||||
/* Scale all channels */
|
/* Scale all channels */
|
||||||
for (list = gimage->channels; list; list = g_slist_next (list))
|
for (list = gimage->channels; list; list = g_slist_next (list))
|
||||||
|
@ -600,10 +600,11 @@ gimp_image_scale (GimpImage *gimage,
|
||||||
layer = (Layer *) list->data;
|
layer = (Layer *) list->data;
|
||||||
if (layer_scale_by_factors (layer, img_scale_w, img_scale_h) == FALSE)
|
if (layer_scale_by_factors (layer, img_scale_w, img_scale_h) == FALSE)
|
||||||
{
|
{
|
||||||
/* Since 0 < img_scale_w, img_scale_h, failure due to one or more */
|
/* Since 0 < img_scale_w, img_scale_h, failure due to one or more
|
||||||
/* vanishing scaled layer dimensions. Implicit delete implemented */
|
* vanishing scaled layer dimensions. Implicit delete implemented
|
||||||
/* here. Upstream warning implemented in resize_check_layer_scaling() */
|
* here. Upstream warning implemented in resize_check_layer_scaling()
|
||||||
/* [resize.c line 1295], which offers the user the chance to bail out.*/
|
* [resize.c line 1295], which offers the user the chance to bail out.
|
||||||
|
*/
|
||||||
|
|
||||||
remove = g_slist_append (remove, layer);
|
remove = g_slist_append (remove, layer);
|
||||||
}
|
}
|
||||||
|
@ -733,7 +734,7 @@ gimp_image_apply_image (GimpImage *gimage,
|
||||||
/* determine what sort of operation is being attempted and
|
/* determine what sort of operation is being attempted and
|
||||||
* if it's actually legal...
|
* if it's actually legal...
|
||||||
*/
|
*/
|
||||||
operation = valid_combinations [drawable_type (drawable)][src2PR->bytes];
|
operation = valid_combinations[drawable_type (drawable)][src2PR->bytes];
|
||||||
if (operation == -1)
|
if (operation == -1)
|
||||||
{
|
{
|
||||||
g_message ("gimp_image_apply_image sent illegal parameters");
|
g_message ("gimp_image_apply_image sent illegal parameters");
|
||||||
|
@ -755,10 +756,10 @@ gimp_image_apply_image (GimpImage *gimage,
|
||||||
* we need to add the layer offset to transform coords
|
* we need to add the layer offset to transform coords
|
||||||
* into the mask coordinate system
|
* into the mask coordinate system
|
||||||
*/
|
*/
|
||||||
x1 = CLAMP (x1, -offset_x, drawable_width (GIMP_DRAWABLE(mask))-offset_x);
|
x1 = CLAMP (x1, -offset_x, drawable_width (GIMP_DRAWABLE (mask))-offset_x);
|
||||||
y1 = CLAMP (y1, -offset_y, drawable_height(GIMP_DRAWABLE(mask))-offset_y);
|
y1 = CLAMP (y1, -offset_y, drawable_height(GIMP_DRAWABLE (mask))-offset_y);
|
||||||
x2 = CLAMP (x2, -offset_x, drawable_width (GIMP_DRAWABLE(mask))-offset_x);
|
x2 = CLAMP (x2, -offset_x, drawable_width (GIMP_DRAWABLE (mask))-offset_x);
|
||||||
y2 = CLAMP (y2, -offset_y, drawable_height(GIMP_DRAWABLE(mask))-offset_y);
|
y2 = CLAMP (y2, -offset_y, drawable_height(GIMP_DRAWABLE (mask))-offset_y);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If the calling procedure specified an undo step... */
|
/* If the calling procedure specified an undo step... */
|
||||||
|
@ -800,8 +801,10 @@ gimp_image_apply_image (GimpImage *gimage,
|
||||||
opacity, mode, active, operation);
|
opacity, mode, active, operation);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
combine_regions (&src1PR, src2PR, &destPR, NULL, NULL,
|
{
|
||||||
opacity, mode, active, operation);
|
combine_regions (&src1PR, src2PR, &destPR, NULL, NULL,
|
||||||
|
opacity, mode, active, operation);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Similar to gimp_image_apply_image but works in "replace" mode (i.e.
|
/* Similar to gimp_image_apply_image but works in "replace" mode (i.e.
|
||||||
|
@ -860,10 +863,10 @@ gimp_image_replace_image (GimpImage *gimage,
|
||||||
* we need to add the layer offset to transform coords
|
* we need to add the layer offset to transform coords
|
||||||
* into the mask coordinate system
|
* into the mask coordinate system
|
||||||
*/
|
*/
|
||||||
x1 = CLAMP (x1, -offset_x, drawable_width (GIMP_DRAWABLE(mask))-offset_x);
|
x1 = CLAMP (x1, -offset_x, drawable_width (GIMP_DRAWABLE (mask))-offset_x);
|
||||||
y1 = CLAMP (y1, -offset_y, drawable_height(GIMP_DRAWABLE(mask))-offset_y);
|
y1 = CLAMP (y1, -offset_y, drawable_height(GIMP_DRAWABLE (mask))-offset_y);
|
||||||
x2 = CLAMP (x2, -offset_x, drawable_width (GIMP_DRAWABLE(mask))-offset_x);
|
x2 = CLAMP (x2, -offset_x, drawable_width (GIMP_DRAWABLE (mask))-offset_x);
|
||||||
y2 = CLAMP (y2, -offset_y, drawable_height(GIMP_DRAWABLE(mask))-offset_y);
|
y2 = CLAMP (y2, -offset_y, drawable_height(GIMP_DRAWABLE (mask))-offset_y);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If the calling procedure specified an undo step... */
|
/* If the calling procedure specified an undo step... */
|
||||||
|
@ -873,9 +876,13 @@ gimp_image_replace_image (GimpImage *gimage,
|
||||||
/* configure the pixel regions
|
/* configure the pixel regions
|
||||||
* If an alternative to using the drawable's data as src1 was provided...
|
* If an alternative to using the drawable's data as src1 was provided...
|
||||||
*/
|
*/
|
||||||
pixel_region_init (&src1PR, drawable_data (drawable), x1, y1, (x2 - x1), (y2 - y1), FALSE);
|
pixel_region_init (&src1PR, drawable_data (drawable),
|
||||||
pixel_region_init (&destPR, drawable_data (drawable), x1, y1, (x2 - x1), (y2 - y1), TRUE);
|
x1, y1, (x2 - x1), (y2 - y1), FALSE);
|
||||||
pixel_region_resize (src2PR, src2PR->x + (x1 - x), src2PR->y + (y1 - y), (x2 - x1), (y2 - y1));
|
pixel_region_init (&destPR, drawable_data (drawable),
|
||||||
|
x1, y1, (x2 - x1), (y2 - y1), TRUE);
|
||||||
|
pixel_region_resize (src2PR,
|
||||||
|
src2PR->x + (x1 - x), src2PR->y + (y1 - y),
|
||||||
|
(x2 - x1), (y2 - y1));
|
||||||
|
|
||||||
if (mask)
|
if (mask)
|
||||||
{
|
{
|
||||||
|
@ -926,8 +933,10 @@ gimp_image_replace_image (GimpImage *gimage,
|
||||||
g_free (temp_data);
|
g_free (temp_data);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
combine_regions_replace (&src1PR, src2PR, &destPR, maskPR, NULL,
|
{
|
||||||
opacity, active, operation);
|
combine_regions_replace (&src1PR, src2PR, &destPR, maskPR, NULL,
|
||||||
|
opacity, active, operation);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get rid of these! A "foreground" is an UI concept.. */
|
/* Get rid of these! A "foreground" is an UI concept.. */
|
||||||
|
@ -1536,19 +1545,19 @@ gimp_image_construct_layers (GimpImage *gimage,
|
||||||
/* only add layers that are visible and not floating selections
|
/* only add layers that are visible and not floating selections
|
||||||
to the list */
|
to the list */
|
||||||
if (!layer_is_floating_sel (layer) &&
|
if (!layer_is_floating_sel (layer) &&
|
||||||
drawable_visible (GIMP_DRAWABLE(layer)))
|
drawable_visible (GIMP_DRAWABLE (layer)))
|
||||||
reverse_list = g_slist_prepend (reverse_list, layer);
|
reverse_list = g_slist_prepend (reverse_list, layer);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (reverse_list)
|
while (reverse_list)
|
||||||
{
|
{
|
||||||
layer = (Layer *) reverse_list->data;
|
layer = (Layer *) reverse_list->data;
|
||||||
drawable_offsets (GIMP_DRAWABLE(layer), &off_x, &off_y);
|
drawable_offsets (GIMP_DRAWABLE (layer), &off_x, &off_y);
|
||||||
|
|
||||||
x1 = CLAMP (off_x, x, x + w);
|
x1 = CLAMP (off_x, x, x + w);
|
||||||
y1 = CLAMP (off_y, y, y + h);
|
y1 = CLAMP (off_y, y, y + h);
|
||||||
x2 = CLAMP (off_x + drawable_width (GIMP_DRAWABLE(layer)), x, x + w);
|
x2 = CLAMP (off_x + drawable_width (GIMP_DRAWABLE (layer)), x, x + w);
|
||||||
y2 = CLAMP (off_y + drawable_height (GIMP_DRAWABLE(layer)), y, y + h);
|
y2 = CLAMP (off_y + drawable_height (GIMP_DRAWABLE (layer)), y, y + h);
|
||||||
|
|
||||||
/* configure the pixel regions */
|
/* configure the pixel regions */
|
||||||
pixel_region_init (&src1PR, gimp_image_projection (gimage),
|
pixel_region_init (&src1PR, gimp_image_projection (gimage),
|
||||||
|
@ -1559,7 +1568,7 @@ gimp_image_construct_layers (GimpImage *gimage,
|
||||||
if (layer->mask && layer->show_mask)
|
if (layer->mask && layer->show_mask)
|
||||||
{
|
{
|
||||||
pixel_region_init (&src2PR,
|
pixel_region_init (&src2PR,
|
||||||
drawable_data (GIMP_DRAWABLE(layer->mask)),
|
drawable_data (GIMP_DRAWABLE (layer->mask)),
|
||||||
(x1 - off_x), (y1 - off_y),
|
(x1 - off_x), (y1 - off_y),
|
||||||
(x2 - x1), (y2 - y1), FALSE);
|
(x2 - x1), (y2 - y1), FALSE);
|
||||||
|
|
||||||
|
@ -1587,7 +1596,7 @@ gimp_image_construct_layers (GimpImage *gimage,
|
||||||
/* Based on the type of the layer, project the layer onto the
|
/* Based on the type of the layer, project the layer onto the
|
||||||
* projection image...
|
* projection image...
|
||||||
*/
|
*/
|
||||||
switch (drawable_type (GIMP_DRAWABLE(layer)))
|
switch (drawable_type (GIMP_DRAWABLE (layer)))
|
||||||
{
|
{
|
||||||
case RGB_GIMAGE: case GRAY_GIMAGE:
|
case RGB_GIMAGE: case GRAY_GIMAGE:
|
||||||
/* no mask possible */
|
/* no mask possible */
|
||||||
|
@ -1627,7 +1636,8 @@ gimp_image_construct_channels (GimpImage *gimage,
|
||||||
gint h)
|
gint h)
|
||||||
{
|
{
|
||||||
Channel *channel;
|
Channel *channel;
|
||||||
PixelRegion src1PR, src2PR;
|
PixelRegion src1PR;
|
||||||
|
PixelRegion src2PR;
|
||||||
GSList *list;
|
GSList *list;
|
||||||
GSList *reverse_list = NULL;
|
GSList *reverse_list = NULL;
|
||||||
|
|
||||||
|
@ -1645,7 +1655,7 @@ gimp_image_construct_channels (GimpImage *gimage,
|
||||||
pixel_region_init (&src1PR, gimp_image_projection (gimage),
|
pixel_region_init (&src1PR, gimp_image_projection (gimage),
|
||||||
x, y, w, h,
|
x, y, w, h,
|
||||||
TRUE);
|
TRUE);
|
||||||
pixel_region_init (&src2PR, drawable_data (GIMP_DRAWABLE(channel)),
|
pixel_region_init (&src2PR, drawable_data (GIMP_DRAWABLE (channel)),
|
||||||
x, y, w, h,
|
x, y, w, h,
|
||||||
FALSE);
|
FALSE);
|
||||||
|
|
||||||
|
@ -1683,14 +1693,14 @@ gimp_image_initialize_projection (GimpImage *gimage,
|
||||||
gint off_x, off_y;
|
gint off_x, off_y;
|
||||||
|
|
||||||
layer = (Layer *) list->data;
|
layer = (Layer *) list->data;
|
||||||
drawable_offsets (GIMP_DRAWABLE(layer), &off_x, &off_y);
|
drawable_offsets (GIMP_DRAWABLE (layer), &off_x, &off_y);
|
||||||
|
|
||||||
if (drawable_visible (GIMP_DRAWABLE(layer)) &&
|
if (drawable_visible (GIMP_DRAWABLE (layer)) &&
|
||||||
! layer_has_alpha (layer) &&
|
! layer_has_alpha (layer) &&
|
||||||
(off_x <= x) &&
|
(off_x <= x) &&
|
||||||
(off_y <= y) &&
|
(off_y <= y) &&
|
||||||
(off_x + drawable_width (GIMP_DRAWABLE(layer)) >= x + w) &&
|
(off_x + drawable_width (GIMP_DRAWABLE (layer)) >= x + w) &&
|
||||||
(off_y + drawable_height (GIMP_DRAWABLE(layer)) >= y + h))
|
(off_y + drawable_height (GIMP_DRAWABLE (layer)) >= y + h))
|
||||||
{
|
{
|
||||||
coverage = 1;
|
coverage = 1;
|
||||||
break;
|
break;
|
||||||
|
@ -1738,9 +1748,9 @@ gimp_image_get_active_channels (GimpImage *gimage,
|
||||||
|
|
||||||
void
|
void
|
||||||
gimp_image_construct (GimpImage *gimage,
|
gimp_image_construct (GimpImage *gimage,
|
||||||
gint x,
|
gint x,
|
||||||
gint y,
|
gint y,
|
||||||
gint w,
|
gint w,
|
||||||
gint h,
|
gint h,
|
||||||
gboolean can_use_cowproject)
|
gboolean can_use_cowproject)
|
||||||
{
|
{
|
||||||
|
@ -1757,12 +1767,11 @@ gimp_image_construct (GimpImage *gimage,
|
||||||
|
|
||||||
if (gimage->layers)
|
if (gimage->layers)
|
||||||
{
|
{
|
||||||
gimp_drawable_offsets (GIMP_DRAWABLE((Layer*)(gimage->layers->data)),
|
gimp_drawable_offsets (GIMP_DRAWABLE ((Layer*) gimage->layers->data),
|
||||||
&xoff, &yoff);
|
&xoff, &yoff);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (/*can_use_cowproject &&*/
|
if ((gimage->layers) && /* There's a layer. */
|
||||||
(gimage->layers) && /* There's a layer. */
|
|
||||||
(!g_slist_next(gimage->layers)) && /* It's the only layer. */
|
(!g_slist_next(gimage->layers)) && /* It's the only layer. */
|
||||||
(layer_has_alpha((Layer*)(gimage->layers->data))) && /* It's !flat. */
|
(layer_has_alpha((Layer*)(gimage->layers->data))) && /* It's !flat. */
|
||||||
/* It's visible. */
|
/* It's visible. */
|
||||||
|
@ -1926,15 +1935,15 @@ gimp_image_invalidate (GimpImage *gimage,
|
||||||
/* If the tile is not valid, make sure we get the entire tile
|
/* If the tile is not valid, make sure we get the entire tile
|
||||||
* in the construction extents
|
* in the construction extents
|
||||||
*/
|
*/
|
||||||
if (tile_is_valid(tile) == FALSE)
|
if (tile_is_valid (tile) == FALSE)
|
||||||
{
|
{
|
||||||
tilex = j - (j % TILE_WIDTH);
|
tilex = j - (j % TILE_WIDTH);
|
||||||
tiley = i - (i % TILE_HEIGHT);
|
tiley = i - (i % TILE_HEIGHT);
|
||||||
|
|
||||||
startx = MIN (startx, tilex);
|
startx = MIN (startx, tilex);
|
||||||
endx = MAX (endx, tilex + tile_ewidth(tile));
|
endx = MAX (endx, tilex + tile_ewidth (tile));
|
||||||
starty = MIN (starty, tiley);
|
starty = MIN (starty, tiley);
|
||||||
endy = MAX (endy, tiley + tile_eheight(tile));
|
endy = MAX (endy, tiley + tile_eheight (tile));
|
||||||
|
|
||||||
tile_mark_valid (tile); /* hmmmmmmm..... */
|
tile_mark_valid (tile); /* hmmmmmmm..... */
|
||||||
}
|
}
|
||||||
|
@ -1991,6 +2000,21 @@ gimp_image_get_layer_index (GimpImage *gimage,
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Layer *
|
||||||
|
gimp_image_get_layer_by_index (GimpImage *gimage,
|
||||||
|
gint layer_index)
|
||||||
|
{
|
||||||
|
Layer *layer;
|
||||||
|
|
||||||
|
g_return_val_if_fail (gimage != NULL, NULL);
|
||||||
|
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
|
||||||
|
|
||||||
|
layer =
|
||||||
|
(Layer *) g_slist_nth_data (gimage->layers, layer_index);
|
||||||
|
|
||||||
|
return layer;
|
||||||
|
}
|
||||||
|
|
||||||
gint
|
gint
|
||||||
gimp_image_get_channel_index (GimpImage *gimage,
|
gimp_image_get_channel_index (GimpImage *gimage,
|
||||||
Channel *channel_ID)
|
Channel *channel_ID)
|
||||||
|
@ -1999,6 +2023,7 @@ gimp_image_get_channel_index (GimpImage *gimage,
|
||||||
GSList *channels;
|
GSList *channels;
|
||||||
gint index;
|
gint index;
|
||||||
|
|
||||||
|
g_return_val_if_fail (gimage != NULL, -1);
|
||||||
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), -1);
|
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), -1);
|
||||||
|
|
||||||
for (channels = gimage->channels, index = 0;
|
for (channels = gimage->channels, index = 0;
|
||||||
|
@ -2016,6 +2041,7 @@ gimp_image_get_channel_index (GimpImage *gimage,
|
||||||
Layer *
|
Layer *
|
||||||
gimp_image_get_active_layer (GimpImage *gimage)
|
gimp_image_get_active_layer (GimpImage *gimage)
|
||||||
{
|
{
|
||||||
|
g_return_val_if_fail (gimage != NULL, NULL);
|
||||||
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
|
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
|
||||||
|
|
||||||
return gimage->active_layer;
|
return gimage->active_layer;
|
||||||
|
|
|
@ -189,6 +189,7 @@ void gimp_image_colormap_changed (GimpImage * image,
|
||||||
/* layer/channel functions */
|
/* layer/channel functions */
|
||||||
|
|
||||||
gint gimp_image_get_layer_index (GimpImage *, Layer *);
|
gint gimp_image_get_layer_index (GimpImage *, Layer *);
|
||||||
|
Layer * gimp_image_get_layer_by_index (GimpImage *, gint);
|
||||||
gint gimp_image_get_channel_index (GimpImage *, Channel *);
|
gint gimp_image_get_channel_index (GimpImage *, Channel *);
|
||||||
Layer * gimp_image_get_active_layer (GimpImage *);
|
Layer * gimp_image_get_active_layer (GimpImage *);
|
||||||
Channel * gimp_image_get_active_channel (GimpImage *);
|
Channel * gimp_image_get_active_channel (GimpImage *);
|
||||||
|
|
|
@ -63,6 +63,7 @@ void gimage_foreach (GFunc func,
|
||||||
#define gimage_remove_guide gimp_image_remove_guide
|
#define gimage_remove_guide gimp_image_remove_guide
|
||||||
#define gimage_delete_guide gimp_image_delete_guide
|
#define gimage_delete_guide gimp_image_delete_guide
|
||||||
#define gimage_get_layer_index gimp_image_get_layer_index
|
#define gimage_get_layer_index gimp_image_get_layer_index
|
||||||
|
#define gimage_get_layer_by_index gimp_image_get_layer_by_index
|
||||||
#define gimage_get_channel_index gimp_image_get_channel_index
|
#define gimage_get_channel_index gimp_image_get_channel_index
|
||||||
#define gimage_get_active_layer gimp_image_get_active_layer
|
#define gimage_get_active_layer gimp_image_get_active_layer
|
||||||
#define gimage_get_active_channel gimp_image_get_active_channel
|
#define gimage_get_active_channel gimp_image_get_active_channel
|
||||||
|
|
114
app/gimpimage.c
114
app/gimpimage.c
|
@ -435,7 +435,7 @@ gimp_image_resize (GimpImage *gimage,
|
||||||
GSList *list;
|
GSList *list;
|
||||||
GList *guide_list;
|
GList *guide_list;
|
||||||
|
|
||||||
gimp_add_busy_cursors();
|
gimp_add_busy_cursors ();
|
||||||
|
|
||||||
g_assert (new_width > 0 && new_height > 0);
|
g_assert (new_width > 0 && new_height > 0);
|
||||||
|
|
||||||
|
@ -574,8 +574,8 @@ gimp_image_scale (GimpImage *gimage,
|
||||||
old_height = gimage->height;
|
old_height = gimage->height;
|
||||||
gimage->width = new_width;
|
gimage->width = new_width;
|
||||||
gimage->height = new_height;
|
gimage->height = new_height;
|
||||||
img_scale_w = (gdouble)new_width / (gdouble)old_width;
|
img_scale_w = (gdouble) new_width / (gdouble) old_width;
|
||||||
img_scale_h = (gdouble)new_height / (gdouble)old_height;
|
img_scale_h = (gdouble) new_height / (gdouble) old_height;
|
||||||
|
|
||||||
/* Scale all channels */
|
/* Scale all channels */
|
||||||
for (list = gimage->channels; list; list = g_slist_next (list))
|
for (list = gimage->channels; list; list = g_slist_next (list))
|
||||||
|
@ -600,10 +600,11 @@ gimp_image_scale (GimpImage *gimage,
|
||||||
layer = (Layer *) list->data;
|
layer = (Layer *) list->data;
|
||||||
if (layer_scale_by_factors (layer, img_scale_w, img_scale_h) == FALSE)
|
if (layer_scale_by_factors (layer, img_scale_w, img_scale_h) == FALSE)
|
||||||
{
|
{
|
||||||
/* Since 0 < img_scale_w, img_scale_h, failure due to one or more */
|
/* Since 0 < img_scale_w, img_scale_h, failure due to one or more
|
||||||
/* vanishing scaled layer dimensions. Implicit delete implemented */
|
* vanishing scaled layer dimensions. Implicit delete implemented
|
||||||
/* here. Upstream warning implemented in resize_check_layer_scaling() */
|
* here. Upstream warning implemented in resize_check_layer_scaling()
|
||||||
/* [resize.c line 1295], which offers the user the chance to bail out.*/
|
* [resize.c line 1295], which offers the user the chance to bail out.
|
||||||
|
*/
|
||||||
|
|
||||||
remove = g_slist_append (remove, layer);
|
remove = g_slist_append (remove, layer);
|
||||||
}
|
}
|
||||||
|
@ -733,7 +734,7 @@ gimp_image_apply_image (GimpImage *gimage,
|
||||||
/* determine what sort of operation is being attempted and
|
/* determine what sort of operation is being attempted and
|
||||||
* if it's actually legal...
|
* if it's actually legal...
|
||||||
*/
|
*/
|
||||||
operation = valid_combinations [drawable_type (drawable)][src2PR->bytes];
|
operation = valid_combinations[drawable_type (drawable)][src2PR->bytes];
|
||||||
if (operation == -1)
|
if (operation == -1)
|
||||||
{
|
{
|
||||||
g_message ("gimp_image_apply_image sent illegal parameters");
|
g_message ("gimp_image_apply_image sent illegal parameters");
|
||||||
|
@ -755,10 +756,10 @@ gimp_image_apply_image (GimpImage *gimage,
|
||||||
* we need to add the layer offset to transform coords
|
* we need to add the layer offset to transform coords
|
||||||
* into the mask coordinate system
|
* into the mask coordinate system
|
||||||
*/
|
*/
|
||||||
x1 = CLAMP (x1, -offset_x, drawable_width (GIMP_DRAWABLE(mask))-offset_x);
|
x1 = CLAMP (x1, -offset_x, drawable_width (GIMP_DRAWABLE (mask))-offset_x);
|
||||||
y1 = CLAMP (y1, -offset_y, drawable_height(GIMP_DRAWABLE(mask))-offset_y);
|
y1 = CLAMP (y1, -offset_y, drawable_height(GIMP_DRAWABLE (mask))-offset_y);
|
||||||
x2 = CLAMP (x2, -offset_x, drawable_width (GIMP_DRAWABLE(mask))-offset_x);
|
x2 = CLAMP (x2, -offset_x, drawable_width (GIMP_DRAWABLE (mask))-offset_x);
|
||||||
y2 = CLAMP (y2, -offset_y, drawable_height(GIMP_DRAWABLE(mask))-offset_y);
|
y2 = CLAMP (y2, -offset_y, drawable_height(GIMP_DRAWABLE (mask))-offset_y);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If the calling procedure specified an undo step... */
|
/* If the calling procedure specified an undo step... */
|
||||||
|
@ -800,8 +801,10 @@ gimp_image_apply_image (GimpImage *gimage,
|
||||||
opacity, mode, active, operation);
|
opacity, mode, active, operation);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
combine_regions (&src1PR, src2PR, &destPR, NULL, NULL,
|
{
|
||||||
opacity, mode, active, operation);
|
combine_regions (&src1PR, src2PR, &destPR, NULL, NULL,
|
||||||
|
opacity, mode, active, operation);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Similar to gimp_image_apply_image but works in "replace" mode (i.e.
|
/* Similar to gimp_image_apply_image but works in "replace" mode (i.e.
|
||||||
|
@ -860,10 +863,10 @@ gimp_image_replace_image (GimpImage *gimage,
|
||||||
* we need to add the layer offset to transform coords
|
* we need to add the layer offset to transform coords
|
||||||
* into the mask coordinate system
|
* into the mask coordinate system
|
||||||
*/
|
*/
|
||||||
x1 = CLAMP (x1, -offset_x, drawable_width (GIMP_DRAWABLE(mask))-offset_x);
|
x1 = CLAMP (x1, -offset_x, drawable_width (GIMP_DRAWABLE (mask))-offset_x);
|
||||||
y1 = CLAMP (y1, -offset_y, drawable_height(GIMP_DRAWABLE(mask))-offset_y);
|
y1 = CLAMP (y1, -offset_y, drawable_height(GIMP_DRAWABLE (mask))-offset_y);
|
||||||
x2 = CLAMP (x2, -offset_x, drawable_width (GIMP_DRAWABLE(mask))-offset_x);
|
x2 = CLAMP (x2, -offset_x, drawable_width (GIMP_DRAWABLE (mask))-offset_x);
|
||||||
y2 = CLAMP (y2, -offset_y, drawable_height(GIMP_DRAWABLE(mask))-offset_y);
|
y2 = CLAMP (y2, -offset_y, drawable_height(GIMP_DRAWABLE (mask))-offset_y);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If the calling procedure specified an undo step... */
|
/* If the calling procedure specified an undo step... */
|
||||||
|
@ -873,9 +876,13 @@ gimp_image_replace_image (GimpImage *gimage,
|
||||||
/* configure the pixel regions
|
/* configure the pixel regions
|
||||||
* If an alternative to using the drawable's data as src1 was provided...
|
* If an alternative to using the drawable's data as src1 was provided...
|
||||||
*/
|
*/
|
||||||
pixel_region_init (&src1PR, drawable_data (drawable), x1, y1, (x2 - x1), (y2 - y1), FALSE);
|
pixel_region_init (&src1PR, drawable_data (drawable),
|
||||||
pixel_region_init (&destPR, drawable_data (drawable), x1, y1, (x2 - x1), (y2 - y1), TRUE);
|
x1, y1, (x2 - x1), (y2 - y1), FALSE);
|
||||||
pixel_region_resize (src2PR, src2PR->x + (x1 - x), src2PR->y + (y1 - y), (x2 - x1), (y2 - y1));
|
pixel_region_init (&destPR, drawable_data (drawable),
|
||||||
|
x1, y1, (x2 - x1), (y2 - y1), TRUE);
|
||||||
|
pixel_region_resize (src2PR,
|
||||||
|
src2PR->x + (x1 - x), src2PR->y + (y1 - y),
|
||||||
|
(x2 - x1), (y2 - y1));
|
||||||
|
|
||||||
if (mask)
|
if (mask)
|
||||||
{
|
{
|
||||||
|
@ -926,8 +933,10 @@ gimp_image_replace_image (GimpImage *gimage,
|
||||||
g_free (temp_data);
|
g_free (temp_data);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
combine_regions_replace (&src1PR, src2PR, &destPR, maskPR, NULL,
|
{
|
||||||
opacity, active, operation);
|
combine_regions_replace (&src1PR, src2PR, &destPR, maskPR, NULL,
|
||||||
|
opacity, active, operation);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get rid of these! A "foreground" is an UI concept.. */
|
/* Get rid of these! A "foreground" is an UI concept.. */
|
||||||
|
@ -1536,19 +1545,19 @@ gimp_image_construct_layers (GimpImage *gimage,
|
||||||
/* only add layers that are visible and not floating selections
|
/* only add layers that are visible and not floating selections
|
||||||
to the list */
|
to the list */
|
||||||
if (!layer_is_floating_sel (layer) &&
|
if (!layer_is_floating_sel (layer) &&
|
||||||
drawable_visible (GIMP_DRAWABLE(layer)))
|
drawable_visible (GIMP_DRAWABLE (layer)))
|
||||||
reverse_list = g_slist_prepend (reverse_list, layer);
|
reverse_list = g_slist_prepend (reverse_list, layer);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (reverse_list)
|
while (reverse_list)
|
||||||
{
|
{
|
||||||
layer = (Layer *) reverse_list->data;
|
layer = (Layer *) reverse_list->data;
|
||||||
drawable_offsets (GIMP_DRAWABLE(layer), &off_x, &off_y);
|
drawable_offsets (GIMP_DRAWABLE (layer), &off_x, &off_y);
|
||||||
|
|
||||||
x1 = CLAMP (off_x, x, x + w);
|
x1 = CLAMP (off_x, x, x + w);
|
||||||
y1 = CLAMP (off_y, y, y + h);
|
y1 = CLAMP (off_y, y, y + h);
|
||||||
x2 = CLAMP (off_x + drawable_width (GIMP_DRAWABLE(layer)), x, x + w);
|
x2 = CLAMP (off_x + drawable_width (GIMP_DRAWABLE (layer)), x, x + w);
|
||||||
y2 = CLAMP (off_y + drawable_height (GIMP_DRAWABLE(layer)), y, y + h);
|
y2 = CLAMP (off_y + drawable_height (GIMP_DRAWABLE (layer)), y, y + h);
|
||||||
|
|
||||||
/* configure the pixel regions */
|
/* configure the pixel regions */
|
||||||
pixel_region_init (&src1PR, gimp_image_projection (gimage),
|
pixel_region_init (&src1PR, gimp_image_projection (gimage),
|
||||||
|
@ -1559,7 +1568,7 @@ gimp_image_construct_layers (GimpImage *gimage,
|
||||||
if (layer->mask && layer->show_mask)
|
if (layer->mask && layer->show_mask)
|
||||||
{
|
{
|
||||||
pixel_region_init (&src2PR,
|
pixel_region_init (&src2PR,
|
||||||
drawable_data (GIMP_DRAWABLE(layer->mask)),
|
drawable_data (GIMP_DRAWABLE (layer->mask)),
|
||||||
(x1 - off_x), (y1 - off_y),
|
(x1 - off_x), (y1 - off_y),
|
||||||
(x2 - x1), (y2 - y1), FALSE);
|
(x2 - x1), (y2 - y1), FALSE);
|
||||||
|
|
||||||
|
@ -1587,7 +1596,7 @@ gimp_image_construct_layers (GimpImage *gimage,
|
||||||
/* Based on the type of the layer, project the layer onto the
|
/* Based on the type of the layer, project the layer onto the
|
||||||
* projection image...
|
* projection image...
|
||||||
*/
|
*/
|
||||||
switch (drawable_type (GIMP_DRAWABLE(layer)))
|
switch (drawable_type (GIMP_DRAWABLE (layer)))
|
||||||
{
|
{
|
||||||
case RGB_GIMAGE: case GRAY_GIMAGE:
|
case RGB_GIMAGE: case GRAY_GIMAGE:
|
||||||
/* no mask possible */
|
/* no mask possible */
|
||||||
|
@ -1627,7 +1636,8 @@ gimp_image_construct_channels (GimpImage *gimage,
|
||||||
gint h)
|
gint h)
|
||||||
{
|
{
|
||||||
Channel *channel;
|
Channel *channel;
|
||||||
PixelRegion src1PR, src2PR;
|
PixelRegion src1PR;
|
||||||
|
PixelRegion src2PR;
|
||||||
GSList *list;
|
GSList *list;
|
||||||
GSList *reverse_list = NULL;
|
GSList *reverse_list = NULL;
|
||||||
|
|
||||||
|
@ -1645,7 +1655,7 @@ gimp_image_construct_channels (GimpImage *gimage,
|
||||||
pixel_region_init (&src1PR, gimp_image_projection (gimage),
|
pixel_region_init (&src1PR, gimp_image_projection (gimage),
|
||||||
x, y, w, h,
|
x, y, w, h,
|
||||||
TRUE);
|
TRUE);
|
||||||
pixel_region_init (&src2PR, drawable_data (GIMP_DRAWABLE(channel)),
|
pixel_region_init (&src2PR, drawable_data (GIMP_DRAWABLE (channel)),
|
||||||
x, y, w, h,
|
x, y, w, h,
|
||||||
FALSE);
|
FALSE);
|
||||||
|
|
||||||
|
@ -1683,14 +1693,14 @@ gimp_image_initialize_projection (GimpImage *gimage,
|
||||||
gint off_x, off_y;
|
gint off_x, off_y;
|
||||||
|
|
||||||
layer = (Layer *) list->data;
|
layer = (Layer *) list->data;
|
||||||
drawable_offsets (GIMP_DRAWABLE(layer), &off_x, &off_y);
|
drawable_offsets (GIMP_DRAWABLE (layer), &off_x, &off_y);
|
||||||
|
|
||||||
if (drawable_visible (GIMP_DRAWABLE(layer)) &&
|
if (drawable_visible (GIMP_DRAWABLE (layer)) &&
|
||||||
! layer_has_alpha (layer) &&
|
! layer_has_alpha (layer) &&
|
||||||
(off_x <= x) &&
|
(off_x <= x) &&
|
||||||
(off_y <= y) &&
|
(off_y <= y) &&
|
||||||
(off_x + drawable_width (GIMP_DRAWABLE(layer)) >= x + w) &&
|
(off_x + drawable_width (GIMP_DRAWABLE (layer)) >= x + w) &&
|
||||||
(off_y + drawable_height (GIMP_DRAWABLE(layer)) >= y + h))
|
(off_y + drawable_height (GIMP_DRAWABLE (layer)) >= y + h))
|
||||||
{
|
{
|
||||||
coverage = 1;
|
coverage = 1;
|
||||||
break;
|
break;
|
||||||
|
@ -1738,9 +1748,9 @@ gimp_image_get_active_channels (GimpImage *gimage,
|
||||||
|
|
||||||
void
|
void
|
||||||
gimp_image_construct (GimpImage *gimage,
|
gimp_image_construct (GimpImage *gimage,
|
||||||
gint x,
|
gint x,
|
||||||
gint y,
|
gint y,
|
||||||
gint w,
|
gint w,
|
||||||
gint h,
|
gint h,
|
||||||
gboolean can_use_cowproject)
|
gboolean can_use_cowproject)
|
||||||
{
|
{
|
||||||
|
@ -1757,12 +1767,11 @@ gimp_image_construct (GimpImage *gimage,
|
||||||
|
|
||||||
if (gimage->layers)
|
if (gimage->layers)
|
||||||
{
|
{
|
||||||
gimp_drawable_offsets (GIMP_DRAWABLE((Layer*)(gimage->layers->data)),
|
gimp_drawable_offsets (GIMP_DRAWABLE ((Layer*) gimage->layers->data),
|
||||||
&xoff, &yoff);
|
&xoff, &yoff);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (/*can_use_cowproject &&*/
|
if ((gimage->layers) && /* There's a layer. */
|
||||||
(gimage->layers) && /* There's a layer. */
|
|
||||||
(!g_slist_next(gimage->layers)) && /* It's the only layer. */
|
(!g_slist_next(gimage->layers)) && /* It's the only layer. */
|
||||||
(layer_has_alpha((Layer*)(gimage->layers->data))) && /* It's !flat. */
|
(layer_has_alpha((Layer*)(gimage->layers->data))) && /* It's !flat. */
|
||||||
/* It's visible. */
|
/* It's visible. */
|
||||||
|
@ -1926,15 +1935,15 @@ gimp_image_invalidate (GimpImage *gimage,
|
||||||
/* If the tile is not valid, make sure we get the entire tile
|
/* If the tile is not valid, make sure we get the entire tile
|
||||||
* in the construction extents
|
* in the construction extents
|
||||||
*/
|
*/
|
||||||
if (tile_is_valid(tile) == FALSE)
|
if (tile_is_valid (tile) == FALSE)
|
||||||
{
|
{
|
||||||
tilex = j - (j % TILE_WIDTH);
|
tilex = j - (j % TILE_WIDTH);
|
||||||
tiley = i - (i % TILE_HEIGHT);
|
tiley = i - (i % TILE_HEIGHT);
|
||||||
|
|
||||||
startx = MIN (startx, tilex);
|
startx = MIN (startx, tilex);
|
||||||
endx = MAX (endx, tilex + tile_ewidth(tile));
|
endx = MAX (endx, tilex + tile_ewidth (tile));
|
||||||
starty = MIN (starty, tiley);
|
starty = MIN (starty, tiley);
|
||||||
endy = MAX (endy, tiley + tile_eheight(tile));
|
endy = MAX (endy, tiley + tile_eheight (tile));
|
||||||
|
|
||||||
tile_mark_valid (tile); /* hmmmmmmm..... */
|
tile_mark_valid (tile); /* hmmmmmmm..... */
|
||||||
}
|
}
|
||||||
|
@ -1991,6 +2000,21 @@ gimp_image_get_layer_index (GimpImage *gimage,
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Layer *
|
||||||
|
gimp_image_get_layer_by_index (GimpImage *gimage,
|
||||||
|
gint layer_index)
|
||||||
|
{
|
||||||
|
Layer *layer;
|
||||||
|
|
||||||
|
g_return_val_if_fail (gimage != NULL, NULL);
|
||||||
|
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
|
||||||
|
|
||||||
|
layer =
|
||||||
|
(Layer *) g_slist_nth_data (gimage->layers, layer_index);
|
||||||
|
|
||||||
|
return layer;
|
||||||
|
}
|
||||||
|
|
||||||
gint
|
gint
|
||||||
gimp_image_get_channel_index (GimpImage *gimage,
|
gimp_image_get_channel_index (GimpImage *gimage,
|
||||||
Channel *channel_ID)
|
Channel *channel_ID)
|
||||||
|
@ -1999,6 +2023,7 @@ gimp_image_get_channel_index (GimpImage *gimage,
|
||||||
GSList *channels;
|
GSList *channels;
|
||||||
gint index;
|
gint index;
|
||||||
|
|
||||||
|
g_return_val_if_fail (gimage != NULL, -1);
|
||||||
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), -1);
|
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), -1);
|
||||||
|
|
||||||
for (channels = gimage->channels, index = 0;
|
for (channels = gimage->channels, index = 0;
|
||||||
|
@ -2016,6 +2041,7 @@ gimp_image_get_channel_index (GimpImage *gimage,
|
||||||
Layer *
|
Layer *
|
||||||
gimp_image_get_active_layer (GimpImage *gimage)
|
gimp_image_get_active_layer (GimpImage *gimage)
|
||||||
{
|
{
|
||||||
|
g_return_val_if_fail (gimage != NULL, NULL);
|
||||||
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
|
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
|
||||||
|
|
||||||
return gimage->active_layer;
|
return gimage->active_layer;
|
||||||
|
|
|
@ -189,6 +189,7 @@ void gimp_image_colormap_changed (GimpImage * image,
|
||||||
/* layer/channel functions */
|
/* layer/channel functions */
|
||||||
|
|
||||||
gint gimp_image_get_layer_index (GimpImage *, Layer *);
|
gint gimp_image_get_layer_index (GimpImage *, Layer *);
|
||||||
|
Layer * gimp_image_get_layer_by_index (GimpImage *, gint);
|
||||||
gint gimp_image_get_channel_index (GimpImage *, Channel *);
|
gint gimp_image_get_channel_index (GimpImage *, Channel *);
|
||||||
Layer * gimp_image_get_active_layer (GimpImage *);
|
Layer * gimp_image_get_active_layer (GimpImage *);
|
||||||
Channel * gimp_image_get_active_channel (GimpImage *);
|
Channel * gimp_image_get_active_channel (GimpImage *);
|
||||||
|
|
|
@ -894,11 +894,7 @@ layers_previous_cmd_callback (GtkWidget *widget,
|
||||||
current_layer =
|
current_layer =
|
||||||
gimage_get_layer_index (gdisp->gimage, gdisp->gimage->active_layer);
|
gimage_get_layer_index (gdisp->gimage, gdisp->gimage->active_layer);
|
||||||
|
|
||||||
/* FIXME: don't use internal knowledge about layer lists
|
new_layer = gimage_get_layer_by_index (gdisp->gimage, current_layer - 1);
|
||||||
* TODO : implement gimage_get_layer_by_index()
|
|
||||||
*/
|
|
||||||
new_layer =
|
|
||||||
(Layer *) g_slist_nth_data (gdisp->gimage->layers, current_layer - 1);
|
|
||||||
|
|
||||||
if (new_layer)
|
if (new_layer)
|
||||||
{
|
{
|
||||||
|
@ -920,11 +916,7 @@ layers_next_cmd_callback (GtkWidget *widget,
|
||||||
current_layer =
|
current_layer =
|
||||||
gimage_get_layer_index (gdisp->gimage, gdisp->gimage->active_layer);
|
gimage_get_layer_index (gdisp->gimage, gdisp->gimage->active_layer);
|
||||||
|
|
||||||
/* FIXME: don't use internal knowledge about layer lists
|
new_layer = gimage_get_layer_by_index (gdisp->gimage, current_layer + 1);
|
||||||
* TODO : implement gimage_get_layer_by_index()
|
|
||||||
*/
|
|
||||||
new_layer =
|
|
||||||
(Layer *) g_slist_nth_data (gdisp->gimage->layers, current_layer + 1);
|
|
||||||
|
|
||||||
if (new_layer)
|
if (new_layer)
|
||||||
{
|
{
|
||||||
|
|
|
@ -894,11 +894,7 @@ layers_previous_cmd_callback (GtkWidget *widget,
|
||||||
current_layer =
|
current_layer =
|
||||||
gimage_get_layer_index (gdisp->gimage, gdisp->gimage->active_layer);
|
gimage_get_layer_index (gdisp->gimage, gdisp->gimage->active_layer);
|
||||||
|
|
||||||
/* FIXME: don't use internal knowledge about layer lists
|
new_layer = gimage_get_layer_by_index (gdisp->gimage, current_layer - 1);
|
||||||
* TODO : implement gimage_get_layer_by_index()
|
|
||||||
*/
|
|
||||||
new_layer =
|
|
||||||
(Layer *) g_slist_nth_data (gdisp->gimage->layers, current_layer - 1);
|
|
||||||
|
|
||||||
if (new_layer)
|
if (new_layer)
|
||||||
{
|
{
|
||||||
|
@ -920,11 +916,7 @@ layers_next_cmd_callback (GtkWidget *widget,
|
||||||
current_layer =
|
current_layer =
|
||||||
gimage_get_layer_index (gdisp->gimage, gdisp->gimage->active_layer);
|
gimage_get_layer_index (gdisp->gimage, gdisp->gimage->active_layer);
|
||||||
|
|
||||||
/* FIXME: don't use internal knowledge about layer lists
|
new_layer = gimage_get_layer_by_index (gdisp->gimage, current_layer + 1);
|
||||||
* TODO : implement gimage_get_layer_by_index()
|
|
||||||
*/
|
|
||||||
new_layer =
|
|
||||||
(Layer *) g_slist_nth_data (gdisp->gimage->layers, current_layer + 1);
|
|
||||||
|
|
||||||
if (new_layer)
|
if (new_layer)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1529,11 +1529,7 @@ layers_dialog_previous_layer_callback (GtkWidget *widget,
|
||||||
current_layer =
|
current_layer =
|
||||||
gimp_image_get_layer_index (gimage, gimage->active_layer);
|
gimp_image_get_layer_index (gimage, gimage->active_layer);
|
||||||
|
|
||||||
/* FIXME: don't use internal knowledge about layer lists
|
new_layer = gimp_image_get_layer_by_index (gimage, current_layer - 1);
|
||||||
* TODO : implement gimp_image_get_layer_by_index()
|
|
||||||
*/
|
|
||||||
new_layer =
|
|
||||||
(Layer *) g_slist_nth_data (gimage->layers, current_layer - 1);
|
|
||||||
|
|
||||||
if (new_layer)
|
if (new_layer)
|
||||||
{
|
{
|
||||||
|
@ -1556,11 +1552,7 @@ layers_dialog_next_layer_callback (GtkWidget *widget,
|
||||||
current_layer =
|
current_layer =
|
||||||
gimp_image_get_layer_index (gimage, gimage->active_layer);
|
gimp_image_get_layer_index (gimage, gimage->active_layer);
|
||||||
|
|
||||||
/* FIXME: don't use internal knowledge about layer lists
|
new_layer = gimp_image_get_layer_by_index (gimage, current_layer + 1);
|
||||||
* TODO : implement gimp_image_get_layer_by_index()
|
|
||||||
*/
|
|
||||||
new_layer =
|
|
||||||
(Layer *) g_slist_nth_data (gimage->layers, current_layer + 1);
|
|
||||||
|
|
||||||
if (new_layer)
|
if (new_layer)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1529,11 +1529,7 @@ layers_dialog_previous_layer_callback (GtkWidget *widget,
|
||||||
current_layer =
|
current_layer =
|
||||||
gimp_image_get_layer_index (gimage, gimage->active_layer);
|
gimp_image_get_layer_index (gimage, gimage->active_layer);
|
||||||
|
|
||||||
/* FIXME: don't use internal knowledge about layer lists
|
new_layer = gimp_image_get_layer_by_index (gimage, current_layer - 1);
|
||||||
* TODO : implement gimp_image_get_layer_by_index()
|
|
||||||
*/
|
|
||||||
new_layer =
|
|
||||||
(Layer *) g_slist_nth_data (gimage->layers, current_layer - 1);
|
|
||||||
|
|
||||||
if (new_layer)
|
if (new_layer)
|
||||||
{
|
{
|
||||||
|
@ -1556,11 +1552,7 @@ layers_dialog_next_layer_callback (GtkWidget *widget,
|
||||||
current_layer =
|
current_layer =
|
||||||
gimp_image_get_layer_index (gimage, gimage->active_layer);
|
gimp_image_get_layer_index (gimage, gimage->active_layer);
|
||||||
|
|
||||||
/* FIXME: don't use internal knowledge about layer lists
|
new_layer = gimp_image_get_layer_by_index (gimage, current_layer + 1);
|
||||||
* TODO : implement gimp_image_get_layer_by_index()
|
|
||||||
*/
|
|
||||||
new_layer =
|
|
||||||
(Layer *) g_slist_nth_data (gimage->layers, current_layer + 1);
|
|
||||||
|
|
||||||
if (new_layer)
|
if (new_layer)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue