app/actions/channels-commands.c app/actions/colormap-actions.c

2007-12-25  Michael Natterer  <mitch@gimp.org>

	* app/actions/channels-commands.c
	* app/actions/colormap-actions.c
	* app/actions/colormap-commands.c
	* app/actions/image-commands.c
	* app/core/gimp-edit.c
	* app/core/gimpdrawable-preview.c
	* app/core/gimpimage-colorhash.c
	* app/core/gimpimage-colormap.c
	* app/core/gimpimage-convert.c
	* app/core/gimpimage-crop.c
	* app/core/gimpimage-duplicate.c
	* app/core/gimpimage-flip.c
	* app/core/gimpimage-guides.c
	* app/core/gimpimage-merge.c
	* app/core/gimpimage-preview.c
	* app/core/gimpimage-quick-mask.c
	* app/core/gimpimage-resize.c
	* app/core/gimpimage-rotate.c
	* app/core/gimpimage-sample-points.c
	* app/core/gimpimage-scale.c
	* app/core/gimpimage-snap.c
	* app/core/gimpimage.c
	* app/core/gimpimagefile.c
	* app/core/gimpimageundo.c
	* app/core/gimpitem-preview.c
	* app/core/gimpitem.c
	* app/core/gimplayer.c
	* app/core/gimppalette-import.c
	* app/core/gimpprojection-construct.c
	* app/core/gimpprojection.c
	* app/core/gimpselection.c
	* app/core/gimpundo.c
	* app/dialogs/layer-options-dialog.c
	* app/dialogs/print-size-dialog.c
	* app/display/gimpdisplay.c
	* app/display/gimpdisplayshell-draw.c
	* app/display/gimpdisplayshell-scale.c
	* app/display/gimpdisplayshell-scroll.c
	* app/display/gimpdisplayshell-title.c
	* app/display/gimpdisplayshell-transform.c
	* app/display/gimpdisplayshell.c
	* app/display/gimpstatusbar.c
	* app/file/file-open.c
	* app/paint/gimppaintoptions.c
	* app/tools/gimpaligntool.c
	* app/tools/gimpcolortool.c
	* app/tools/gimpeditselectiontool.c
	* app/tools/gimpiscissorstool.c
	* app/tools/gimpmeasuretool.c
	* app/tools/gimpmovetool.c
	* app/tools/gimpperspectiveclonetool.c
	* app/tools/gimprectangleselecttool.c
	* app/tools/gimprectangletool.c
	* app/tools/gimprotatetool.c
	* app/vectors/gimpvectors-export.c
	* app/vectors/gimpvectors-import.c
	* app/vectors/gimpvectors.c
	* app/widgets/gimpimagepropview.c
	* app/widgets/gimpnavigationview.c
	* app/widgets/gimpselectioneditor.c
	* app/widgets/gimpviewrendererdrawable.c
	* app/widgets/gimpviewrendererimage.c
	* app/xcf/xcf-load.c
	* app/xcf/xcf-save.c
	* tools/pdbgen/pdb/guides.pdb
	* tools/pdbgen/pdb/image.pdb: use accessors for many image properties.

	* app/pdb/guides_cmds.c
	* app/pdb/image_cmds.c: regenerated.


svn path=/trunk/; revision=24432
This commit is contained in:
Michael Natterer 2007-12-25 16:21:40 +00:00 committed by Michael Natterer
parent 9b551273ab
commit 75061fccfd
69 changed files with 646 additions and 444 deletions

View file

@ -1,3 +1,75 @@
2007-12-25 Michael Natterer <mitch@gimp.org>
* app/actions/channels-commands.c
* app/actions/colormap-actions.c
* app/actions/colormap-commands.c
* app/actions/image-commands.c
* app/core/gimp-edit.c
* app/core/gimpdrawable-preview.c
* app/core/gimpimage-colorhash.c
* app/core/gimpimage-colormap.c
* app/core/gimpimage-convert.c
* app/core/gimpimage-crop.c
* app/core/gimpimage-duplicate.c
* app/core/gimpimage-flip.c
* app/core/gimpimage-guides.c
* app/core/gimpimage-merge.c
* app/core/gimpimage-preview.c
* app/core/gimpimage-quick-mask.c
* app/core/gimpimage-resize.c
* app/core/gimpimage-rotate.c
* app/core/gimpimage-sample-points.c
* app/core/gimpimage-scale.c
* app/core/gimpimage-snap.c
* app/core/gimpimage.c
* app/core/gimpimagefile.c
* app/core/gimpimageundo.c
* app/core/gimpitem-preview.c
* app/core/gimpitem.c
* app/core/gimplayer.c
* app/core/gimppalette-import.c
* app/core/gimpprojection-construct.c
* app/core/gimpprojection.c
* app/core/gimpselection.c
* app/core/gimpundo.c
* app/dialogs/layer-options-dialog.c
* app/dialogs/print-size-dialog.c
* app/display/gimpdisplay.c
* app/display/gimpdisplayshell-draw.c
* app/display/gimpdisplayshell-scale.c
* app/display/gimpdisplayshell-scroll.c
* app/display/gimpdisplayshell-title.c
* app/display/gimpdisplayshell-transform.c
* app/display/gimpdisplayshell.c
* app/display/gimpstatusbar.c
* app/file/file-open.c
* app/paint/gimppaintoptions.c
* app/tools/gimpaligntool.c
* app/tools/gimpcolortool.c
* app/tools/gimpeditselectiontool.c
* app/tools/gimpiscissorstool.c
* app/tools/gimpmeasuretool.c
* app/tools/gimpmovetool.c
* app/tools/gimpperspectiveclonetool.c
* app/tools/gimprectangleselecttool.c
* app/tools/gimprectangletool.c
* app/tools/gimprotatetool.c
* app/vectors/gimpvectors-export.c
* app/vectors/gimpvectors-import.c
* app/vectors/gimpvectors.c
* app/widgets/gimpimagepropview.c
* app/widgets/gimpnavigationview.c
* app/widgets/gimpselectioneditor.c
* app/widgets/gimpviewrendererdrawable.c
* app/widgets/gimpviewrendererimage.c
* app/xcf/xcf-load.c
* app/xcf/xcf-save.c
* tools/pdbgen/pdb/guides.pdb
* tools/pdbgen/pdb/image.pdb: use accessors for many image properties.
* app/pdb/guides_cmds.c
* app/pdb/image_cmds.c: regenerated.
2007-12-25 Michael Natterer <mitch@gimp.org> 2007-12-25 Michael Natterer <mitch@gimp.org>
* app/dialogs/file-save-dialog.c: forgot to port some debug output * app/dialogs/file-save-dialog.c: forgot to port some debug output

View file

@ -348,8 +348,8 @@ channels_new_channel_response (GtkWidget *widget,
else else
{ {
new_channel = gimp_channel_new (options->image, new_channel = gimp_channel_new (options->image,
options->image->width, gimp_image_get_width (options->image),
options->image->height, gimp_image_get_height (options->image),
channel_name, channel_name,
&channel_color); &channel_color);

View file

@ -26,6 +26,7 @@
#include "core/gimpcontext.h" #include "core/gimpcontext.h"
#include "core/gimpimage.h" #include "core/gimpimage.h"
#include "core/gimpimage-colormap.h"
#include "widgets/gimpactiongroup.h" #include "widgets/gimpactiongroup.h"
#include "widgets/gimphelp-ids.h" #include "widgets/gimphelp-ids.h"
@ -93,7 +94,7 @@ colormap_actions_update (GimpActionGroup *group,
if (image) if (image)
{ {
indexed = gimp_image_base_type (image) == GIMP_INDEXED; indexed = gimp_image_base_type (image) == GIMP_INDEXED;
num_colors = image->num_cols; num_colors = gimp_image_get_colormap_size (image);
} }
if (context) if (context)

View file

@ -55,16 +55,19 @@ colormap_edit_color_cmd_callback (GtkAction *action,
{ {
GimpColormapEditor *editor; GimpColormapEditor *editor;
GimpImage *image; GimpImage *image;
const guchar *colormap;
GimpRGB color; GimpRGB color;
gchar *desc; gchar *desc;
return_if_no_image (image, data); return_if_no_image (image, data);
editor = GIMP_COLORMAP_EDITOR (data); editor = GIMP_COLORMAP_EDITOR (data);
colormap = gimp_image_get_colormap (image);
gimp_rgba_set_uchar (&color, gimp_rgba_set_uchar (&color,
image->cmap[editor->col_index * 3], colormap[editor->col_index * 3],
image->cmap[editor->col_index * 3 + 1], colormap[editor->col_index * 3 + 1],
image->cmap[editor->col_index * 3 + 2], colormap[editor->col_index * 3 + 2],
OPAQUE_OPACITY); OPAQUE_OPACITY);
desc = g_strdup_printf (_("Edit colormap entry #%d"), editor->col_index); desc = g_strdup_printf (_("Edit colormap entry #%d"), editor->col_index);
@ -116,7 +119,7 @@ colormap_add_color_cmd_callback (GtkAction *action,
return_if_no_context (context, data); return_if_no_context (context, data);
return_if_no_image (image, data); return_if_no_image (image, data);
if (image->num_cols < 256) if (gimp_image_get_colormap_size (image) < 256)
{ {
GimpRGB color; GimpRGB color;

View file

@ -571,8 +571,8 @@ image_resize_callback (GtkWidget *dialog,
gtk_widget_destroy (dialog); gtk_widget_destroy (dialog);
if (width == image->width && if (width == gimp_image_get_width (image) &&
height == image->height) height == gimp_image_get_height (image))
return; return;
progress = gimp_progress_start (GIMP_PROGRESS (display), progress = gimp_progress_start (GIMP_PROGRESS (display),
@ -614,7 +614,7 @@ image_print_size_callback (GtkWidget *dialog,
if (xresolution == image->xresolution && if (xresolution == image->xresolution &&
yresolution == image->yresolution && yresolution == image->yresolution &&
resolution_unit == image->resolution_unit) resolution_unit == gimp_image_get_unit (image))
return; return;
gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_IMAGE_SCALE, gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_IMAGE_SCALE,
@ -647,11 +647,11 @@ image_scale_callback (GtkWidget *dialog,
if (width > 0 && height > 0) if (width > 0 && height > 0)
{ {
if (width == image->width && if (width == gimp_image_get_width (image) &&
height == image->height && height == gimp_image_get_height (image) &&
xresolution == image->xresolution && xresolution == image->xresolution &&
yresolution == image->yresolution && yresolution == image->yresolution &&
resolution_unit == image->resolution_unit) resolution_unit == gimp_image_get_unit (image))
return; return;
gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_IMAGE_SCALE, gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_IMAGE_SCALE,
@ -660,8 +660,8 @@ image_scale_callback (GtkWidget *dialog,
gimp_image_set_resolution (image, xresolution, yresolution); gimp_image_set_resolution (image, xresolution, yresolution);
gimp_image_set_unit (image, resolution_unit); gimp_image_set_unit (image, resolution_unit);
if (width != image->width || if (width != gimp_image_get_width (image) ||
height != image->height) height != gimp_image_get_height (image))
{ {
GimpProgress *progress; GimpProgress *progress;

View file

@ -236,8 +236,8 @@ gimp_edit_paste (GimpImage *image,
{ {
/* otherwise the offsets to the center of the image */ /* otherwise the offsets to the center of the image */
center_x = image->width / 2; center_x = gimp_image_get_width (image) / 2;
center_y = image->height / 2; center_y = gimp_image_get_height (image) / 2;
} }
width = gimp_item_width (GIMP_ITEM (layer)); width = gimp_item_width (GIMP_ITEM (layer));
@ -249,8 +249,8 @@ gimp_edit_paste (GimpImage *image,
/* Ensure that the pasted layer is always within the image, if it /* Ensure that the pasted layer is always within the image, if it
* fits and aligned at top left if it doesn't. (See bug #142944). * fits and aligned at top left if it doesn't. (See bug #142944).
*/ */
offset_x = MIN (offset_x, image->width - width); offset_x = MIN (offset_x, gimp_image_get_width (image) - width);
offset_y = MIN (offset_y, image->height - height); offset_y = MIN (offset_y, gimp_image_get_height (image) - height);
offset_x = MAX (offset_x, 0); offset_x = MAX (offset_x, 0);
offset_y = MAX (offset_y, 0); offset_y = MAX (offset_y, 0);
@ -517,7 +517,8 @@ gimp_edit_fade (GimpImage *image,
gimp_image_undo (image); gimp_image_undo (image);
pixel_region_init (&src2PR, src2_tiles, pixel_region_init (&src2PR, src2_tiles,
0, 0, undo->width, undo->height, 0, 0,
undo->width, undo->height,
FALSE); FALSE);
gimp_drawable_apply_region (drawable, &src2PR, gimp_drawable_apply_region (drawable, &src2PR,

View file

@ -80,8 +80,8 @@ gimp_drawable_get_preview (GimpViewable *viewable,
width <= PREVIEW_CACHE_PRIME_WIDTH && width <= PREVIEW_CACHE_PRIME_WIDTH &&
height <= PREVIEW_CACHE_PRIME_HEIGHT && height <= PREVIEW_CACHE_PRIME_HEIGHT &&
image && image &&
image->width > PREVIEW_CACHE_PRIME_WIDTH && gimp_image_get_width (image) > PREVIEW_CACHE_PRIME_WIDTH &&
image->height > PREVIEW_CACHE_PRIME_HEIGHT) gimp_image_get_height (image) > PREVIEW_CACHE_PRIME_HEIGHT)
{ {
TempBuf *tb = gimp_drawable_preview_private (drawable, TempBuf *tb = gimp_drawable_preview_private (drawable,
PREVIEW_CACHE_PRIME_WIDTH, PREVIEW_CACHE_PRIME_WIDTH,

View file

@ -24,6 +24,7 @@
#include "gimpimage.h" #include "gimpimage.h"
#include "gimpimage-colorhash.h" #include "gimpimage-colorhash.h"
#include "gimpimage-colormap.h"
#define MAXDIFF 195076 #define MAXDIFF 195076
@ -113,14 +114,14 @@ gimp_image_color_hash_rgb_to_indexed (const GimpImage *image,
gint g, gint g,
gint b) gint b)
{ {
guchar *cmap; const guchar *cmap;
gint num_cols; gint num_cols;
guint pixel; guint pixel;
gint hash_index; gint hash_index;
gint cmap_index; gint cmap_index;
cmap = image->cmap; cmap = gimp_image_get_colormap (image);
num_cols = image->num_cols; num_cols = gimp_image_get_colormap_size (image);
pixel = (r << 16) | (g << 8) | b; pixel = (r << 16) | (g << 8) | b;
hash_index = pixel % HASH_TABLE_SIZE; hash_index = pixel % HASH_TABLE_SIZE;

View file

@ -72,7 +72,7 @@ gimp_image_set_colormap (GimpImage *image,
memcpy (image->cmap, cmap, n_colors * 3); memcpy (image->cmap, cmap, n_colors * 3);
} }
else if (! image->base_type == GIMP_INDEXED) else if (! gimp_image_base_type (image) == GIMP_INDEXED)
{ {
if (image->cmap) if (image->cmap)
g_free (image->cmap); g_free (image->cmap);

View file

@ -825,7 +825,7 @@ gimp_image_convert (GimpImage *image,
gimp_image_undo_push_image_type (image, NULL); gimp_image_undo_push_image_type (image, NULL);
/* Set the new base type */ /* Set the new base type */
old_type = image->base_type; old_type = gimp_image_base_type (image);
g_object_set (image, "base-type", new_type, NULL); g_object_set (image, "base-type", new_type, NULL);
@ -1004,12 +1004,9 @@ gimp_image_convert (GimpImage *image,
break; break;
case GIMP_INDEXED: case GIMP_INDEXED:
gimp_image_undo_push_image_colormap (image, NULL);
image->cmap = g_new0 (guchar, GIMP_IMAGE_COLORMAP_SIZE);
if (remove_dups && (palette_type != GIMP_MAKE_PALETTE)) if (remove_dups && (palette_type != GIMP_MAKE_PALETTE))
{ {
guchar colormap[GIMP_IMAGE_COLORMAP_SIZE];
gint i, j; gint i, j;
guchar old_palette[256 * 3]; guchar old_palette[256 * 3];
guchar new_palette[256 * 3]; guchar new_palette[256 * 3];
@ -1044,28 +1041,28 @@ gimp_image_convert (GimpImage *image,
for (i = 0, j = 0; i < num_entries; i++) for (i = 0, j = 0; i < num_entries; i++)
{ {
image->cmap[j] = new_palette[j]; j++; colormap[j] = new_palette[j]; j++;
image->cmap[j] = new_palette[j]; j++; colormap[j] = new_palette[j]; j++;
image->cmap[j] = new_palette[j]; j++; colormap[j] = new_palette[j]; j++;
} }
image->num_cols = num_entries; gimp_image_set_colormap (image, colormap, num_entries, TRUE);
} }
else else
{ {
guchar colormap[GIMP_IMAGE_COLORMAP_SIZE];
gint i, j; gint i, j;
for (i = 0, j = 0; i < quantobj->actual_number_of_colors; i++) for (i = 0, j = 0; i < quantobj->actual_number_of_colors; i++)
{ {
image->cmap[j++] = quantobj->cmap[i].red; colormap[j++] = quantobj->cmap[i].red;
image->cmap[j++] = quantobj->cmap[i].green; colormap[j++] = quantobj->cmap[i].green;
image->cmap[j++] = quantobj->cmap[i].blue; colormap[j++] = quantobj->cmap[i].blue;
} }
image->num_cols = quantobj->actual_number_of_colors; gimp_image_set_colormap (image, colormap,
quantobj->actual_number_of_colors, TRUE);
} }
gimp_image_colormap_changed (image, -1);
break; break;
} }

View file

@ -179,12 +179,12 @@ gimp_image_crop (GimpImage *image,
gimp_item_offsets (item, &off_x, &off_y); gimp_item_offsets (item, &off_x, &off_y);
lx1 = CLAMP (off_x, 0, image->width); lx1 = CLAMP (off_x, 0, gimp_image_get_width (image));
ly1 = CLAMP (off_y, 0, image->height); ly1 = CLAMP (off_y, 0, gimp_image_get_height (image));
lx2 = CLAMP (gimp_item_width (item) + off_x, lx2 = CLAMP (gimp_item_width (item) + off_x,
0, image->width); 0, gimp_image_get_width (image));
ly2 = CLAMP (gimp_item_height (item) + off_y, ly2 = CLAMP (gimp_item_height (item) + off_y,
0, image->height); 0, gimp_image_get_height (image));
width = lx2 - lx1; width = lx2 - lx1;
height = ly2 - ly1; height = ly2 - ly1;
@ -262,7 +262,10 @@ gimp_image_crop (GimpImage *image,
gimp_image_undo_group_end (image); gimp_image_undo_group_end (image);
gimp_image_update (image, 0, 0, image->width, image->height); gimp_image_update (image,
0, 0,
gimp_image_get_width (image),
gimp_image_get_height (image));
gimp_viewable_size_changed (GIMP_VIEWABLE (image)); gimp_viewable_size_changed (GIMP_VIEWABLE (image));
g_object_thaw_notify (G_OBJECT (image)); g_object_thaw_notify (G_OBJECT (image));

View file

@ -64,8 +64,9 @@ gimp_image_duplicate (GimpImage *image)
/* Create a new image */ /* Create a new image */
new_image = gimp_create_image (image->gimp, new_image = gimp_create_image (image->gimp,
image->width, image->height, gimp_image_get_width (image),
image->base_type, gimp_image_get_height (image),
gimp_image_base_type (image),
FALSE); FALSE);
gimp_image_undo_disable (new_image); gimp_image_undo_disable (new_image);
@ -80,7 +81,7 @@ gimp_image_duplicate (GimpImage *image)
} }
/* Copy the colormap if necessary */ /* Copy the colormap if necessary */
if (new_image->base_type == GIMP_INDEXED) if (gimp_image_base_type (new_image) == GIMP_INDEXED)
gimp_image_set_colormap (new_image, gimp_image_set_colormap (new_image,
gimp_image_get_colormap (image), gimp_image_get_colormap (image),
gimp_image_get_colormap_size (image), gimp_image_get_colormap_size (image),
@ -89,7 +90,7 @@ gimp_image_duplicate (GimpImage *image)
/* Copy resolution information */ /* Copy resolution information */
new_image->xresolution = image->xresolution; new_image->xresolution = image->xresolution;
new_image->yresolution = image->yresolution; new_image->yresolution = image->yresolution;
new_image->resolution_unit = image->resolution_unit; new_image->resolution_unit = gimp_image_get_unit (image);
/* Copy floating layer */ /* Copy floating layer */
floating_layer = gimp_image_floating_sel (image); floating_layer = gimp_image_floating_sel (image);
@ -196,14 +197,20 @@ gimp_image_duplicate (GimpImage *image)
PixelRegion srcPR, destPR; PixelRegion srcPR, destPR;
src_tiles = src_tiles =
gimp_drawable_get_tiles (GIMP_DRAWABLE (image->selection_mask)); gimp_drawable_get_tiles (GIMP_DRAWABLE (gimp_image_get_mask (image)));
dest_tiles = dest_tiles =
gimp_drawable_get_tiles (GIMP_DRAWABLE (new_image->selection_mask)); gimp_drawable_get_tiles (GIMP_DRAWABLE (gimp_image_get_mask (new_image)));
pixel_region_init (&srcPR, src_tiles, pixel_region_init (&srcPR, src_tiles,
0, 0, image->width, image->height, FALSE); 0, 0,
gimp_image_get_width (image),
gimp_image_get_height (image),
FALSE);
pixel_region_init (&destPR, dest_tiles, pixel_region_init (&destPR, dest_tiles,
0, 0, image->width, image->height, TRUE); 0, 0,
gimp_image_get_width (image),
gimp_image_get_height (image),
TRUE);
copy_region (&srcPR, &destPR); copy_region (&srcPR, &destPR);

View file

@ -57,11 +57,11 @@ gimp_image_flip (GimpImage *image,
switch (flip_type) switch (flip_type)
{ {
case GIMP_ORIENTATION_HORIZONTAL: case GIMP_ORIENTATION_HORIZONTAL:
axis = (gdouble) image->width / 2.0; axis = (gdouble) gimp_image_get_width (image) / 2.0;
break; break;
case GIMP_ORIENTATION_VERTICAL: case GIMP_ORIENTATION_VERTICAL:
axis = (gdouble) image->height / 2.0; axis = (gdouble) gimp_image_get_height (image) / 2.0;
break; break;
default: default:
@ -133,13 +133,15 @@ gimp_image_flip (GimpImage *image,
case GIMP_ORIENTATION_HORIZONTAL: case GIMP_ORIENTATION_HORIZONTAL:
if (flip_type == GIMP_ORIENTATION_VERTICAL) if (flip_type == GIMP_ORIENTATION_VERTICAL)
gimp_image_move_guide (image, guide, gimp_image_move_guide (image, guide,
image->height - position, TRUE); gimp_image_get_height (image) - position,
TRUE);
break; break;
case GIMP_ORIENTATION_VERTICAL: case GIMP_ORIENTATION_VERTICAL:
if (flip_type == GIMP_ORIENTATION_HORIZONTAL) if (flip_type == GIMP_ORIENTATION_HORIZONTAL)
gimp_image_move_guide (image, guide, gimp_image_move_guide (image, guide,
image->width - position, TRUE); gimp_image_get_width (image) - position,
TRUE);
break; break;
default: default:
@ -155,12 +157,14 @@ gimp_image_flip (GimpImage *image,
if (flip_type == GIMP_ORIENTATION_VERTICAL) if (flip_type == GIMP_ORIENTATION_VERTICAL)
gimp_image_move_sample_point (image, sample_point, gimp_image_move_sample_point (image, sample_point,
sample_point->x, sample_point->x,
image->height - sample_point->y, gimp_image_get_height (image) -
sample_point->y,
TRUE); TRUE);
if (flip_type == GIMP_ORIENTATION_HORIZONTAL) if (flip_type == GIMP_ORIENTATION_HORIZONTAL)
gimp_image_move_sample_point (image, sample_point, gimp_image_move_sample_point (image, sample_point,
image->width - sample_point->x, gimp_image_get_width (image) -
sample_point->x,
sample_point->y, sample_point->y,
TRUE); TRUE);
} }

View file

@ -41,7 +41,8 @@ gimp_image_add_hguide (GimpImage *image,
GimpGuide *guide; GimpGuide *guide;
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL); g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
g_return_val_if_fail (position >= 0 && position <= image->height, NULL); g_return_val_if_fail (position >= 0 &&
position <= gimp_image_get_height (image), NULL);
guide = gimp_guide_new (GIMP_ORIENTATION_HORIZONTAL, guide = gimp_guide_new (GIMP_ORIENTATION_HORIZONTAL,
image->gimp->next_guide_ID++); image->gimp->next_guide_ID++);
@ -63,7 +64,8 @@ gimp_image_add_vguide (GimpImage *image,
GimpGuide *guide; GimpGuide *guide;
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL); g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
g_return_val_if_fail (position >= 0 && position <= image->width, NULL); g_return_val_if_fail (position >= 0 &&
position <= gimp_image_get_width (image), NULL);
guide = gimp_guide_new (GIMP_ORIENTATION_VERTICAL, guide = gimp_guide_new (GIMP_ORIENTATION_VERTICAL,
image->gimp->next_guide_ID++); image->gimp->next_guide_ID++);
@ -87,9 +89,9 @@ gimp_image_add_guide (GimpImage *image,
g_return_if_fail (position >= 0); g_return_if_fail (position >= 0);
if (gimp_guide_get_orientation (guide) == GIMP_ORIENTATION_HORIZONTAL) if (gimp_guide_get_orientation (guide) == GIMP_ORIENTATION_HORIZONTAL)
g_return_if_fail (position <= image->height); g_return_if_fail (position <= gimp_image_get_height (image));
else else
g_return_if_fail (position <= image->width); g_return_if_fail (position <= gimp_image_get_width (image));
image->guides = g_list_prepend (image->guides, guide); image->guides = g_list_prepend (image->guides, guide);
@ -130,9 +132,9 @@ gimp_image_move_guide (GimpImage *image,
g_return_if_fail (position >= 0); g_return_if_fail (position >= 0);
if (gimp_guide_get_orientation (guide) == GIMP_ORIENTATION_HORIZONTAL) if (gimp_guide_get_orientation (guide) == GIMP_ORIENTATION_HORIZONTAL)
g_return_if_fail (position <= image->height); g_return_if_fail (position <= gimp_image_get_height (image));
else else
g_return_if_fail (position <= image->width); g_return_if_fail (position <= gimp_image_get_width (image));
if (push_undo) if (push_undo)
gimp_image_undo_push_guide (image, _("Move Guide"), guide); gimp_image_undo_push_guide (image, _("Move Guide"), guide);
@ -210,8 +212,8 @@ gimp_image_find_guide (GimpImage *image,
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL); g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
g_return_val_if_fail (epsilon_x > 0 && epsilon_y > 0, NULL); g_return_val_if_fail (epsilon_x > 0 && epsilon_y > 0, NULL);
if (x < 0 || x >= image->width || if (x < 0 || x >= gimp_image_get_width (image) ||
y < 0 || y >= image->height) y < 0 || y >= gimp_image_get_height (image))
{ {
return NULL; return NULL;
} }

View file

@ -131,7 +131,7 @@ gimp_image_merge_visible_layers (GimpImage *image,
return layer; return layer;
} }
return image->active_layer; return gimp_image_get_active_layer (image);
} }
GimpLayer * GimpLayer *
@ -374,10 +374,10 @@ gimp_image_merge_layers (GimpImage *image,
if (merge_type == GIMP_CLIP_TO_IMAGE) if (merge_type == GIMP_CLIP_TO_IMAGE)
{ {
x1 = CLAMP (x1, 0, image->width); x1 = CLAMP (x1, 0, gimp_image_get_width (image));
y1 = CLAMP (y1, 0, image->height); y1 = CLAMP (y1, 0, gimp_image_get_height (image));
x2 = CLAMP (x2, 0, image->width); x2 = CLAMP (x2, 0, gimp_image_get_width (image));
y2 = CLAMP (y2, 0, image->height); y2 = CLAMP (y2, 0, gimp_image_get_height (image));
} }
break; break;
@ -396,8 +396,8 @@ gimp_image_merge_layers (GimpImage *image,
{ {
x1 = 0; x1 = 0;
y1 = 0; y1 = 0;
x2 = image->width; x2 = gimp_image_get_width (image);
y2 = image->height; y2 = gimp_image_get_height (image);
} }
break; break;
} }

View file

@ -40,8 +40,8 @@ gimp_image_get_preview_size (GimpViewable *viewable,
{ {
GimpImage *image = GIMP_IMAGE (viewable); GimpImage *image = GIMP_IMAGE (viewable);
gimp_viewable_calc_preview_size (image->width, gimp_viewable_calc_preview_size (gimp_image_get_width (image),
image->height, gimp_image_get_height (image),
size, size,
size, size,
dot_for_dot, dot_for_dot,
@ -62,12 +62,13 @@ gimp_image_get_popup_size (GimpViewable *viewable,
{ {
GimpImage *image = GIMP_IMAGE (viewable); GimpImage *image = GIMP_IMAGE (viewable);
if (image->width > width || image->height > height) if (gimp_image_get_width (image) > width ||
gimp_image_get_height (image) > height)
{ {
gboolean scaling_up; gboolean scaling_up;
gimp_viewable_calc_preview_size (image->width, gimp_viewable_calc_preview_size (gimp_image_get_width (image),
image->height, gimp_image_get_height (image),
width * 2, width * 2,
height * 2, height * 2,
dot_for_dot, 1.0, 1.0, dot_for_dot, 1.0, 1.0,
@ -77,8 +78,8 @@ gimp_image_get_popup_size (GimpViewable *viewable,
if (scaling_up) if (scaling_up)
{ {
*popup_width = image->width; *popup_width = gimp_image_get_width (image);
*popup_height = image->height; *popup_height = gimp_image_get_height (image);
} }
return TRUE; return TRUE;
@ -129,8 +130,8 @@ gimp_image_get_new_preview (GimpViewable *viewable,
gint level; gint level;
gboolean is_premult; gboolean is_premult;
scale_x = (gdouble) width / (gdouble) image->width; scale_x = (gdouble) width / (gdouble) gimp_image_get_width (image);
scale_y = (gdouble) height / (gdouble) image->height; scale_y = (gdouble) height / (gdouble) gimp_image_get_height (image);
level = gimp_projection_get_level (image->projection, scale_x, scale_y); level = gimp_projection_get_level (image->projection, scale_x, scale_y);

View file

@ -91,8 +91,8 @@ gimp_image_set_quick_mask_state (GimpImage *image,
floating_sel_to_layer (floating_sel, NULL); floating_sel_to_layer (floating_sel, NULL);
mask = gimp_channel_new (image, mask = gimp_channel_new (image,
image->width, gimp_image_get_width (image),
image->height, gimp_image_get_height (image),
GIMP_IMAGE_QUICK_MASK_NAME, GIMP_IMAGE_QUICK_MASK_NAME,
&image->quick_mask_color); &image->quick_mask_color);

View file

@ -93,8 +93,8 @@ gimp_image_resize_with_layers (GimpImage *image,
GIMP_ITEM_TYPE_LAYERS, GIMP_ITEM_TYPE_LAYERS,
layer_set); layer_set);
old_width = image->width; old_width = gimp_image_get_width (image);
old_height = image->height; old_height = gimp_image_get_height (image);
/* Push the image size to the stack */ /* Push the image size to the stack */
gimp_image_undo_push_image_size (image, NULL); gimp_image_undo_push_image_size (image, NULL);

View file

@ -69,8 +69,8 @@ gimp_image_rotate (GimpImage *image,
gimp_set_busy (image->gimp); gimp_set_busy (image->gimp);
center_x = (gdouble) image->width / 2.0; center_x = (gdouble) gimp_image_get_width (image) / 2.0;
center_y = (gdouble) image->height / 2.0; center_y = (gdouble) gimp_image_get_height (image) / 2.0;
progress_max = (image->channels->num_children + progress_max = (image->channels->num_children +
image->layers->num_children + image->layers->num_children +
@ -86,14 +86,14 @@ gimp_image_rotate (GimpImage *image,
{ {
case GIMP_ROTATE_90: case GIMP_ROTATE_90:
case GIMP_ROTATE_270: case GIMP_ROTATE_270:
new_image_width = image->height; new_image_width = gimp_image_get_height (image);
new_image_height = image->width; new_image_height = gimp_image_get_width (image);
size_changed = TRUE; size_changed = TRUE;
break; break;
case GIMP_ROTATE_180: case GIMP_ROTATE_180:
new_image_width = image->width; new_image_width = gimp_image_get_width (image);
new_image_height = image->height; new_image_height = gimp_image_get_height (image);
size_changed = FALSE; size_changed = FALSE;
break; break;
@ -133,8 +133,8 @@ gimp_image_rotate (GimpImage *image,
item->offset_y = 0; item->offset_y = 0;
gimp_item_translate (item, gimp_item_translate (item,
(new_image_width - image->width) / 2, (new_image_width - gimp_image_get_width (image)) / 2,
(new_image_height - image->height) / 2, (new_image_height - gimp_image_get_height (image)) / 2,
FALSE); FALSE);
if (progress) if (progress)
@ -142,14 +142,18 @@ gimp_image_rotate (GimpImage *image,
} }
/* Don't forget the selection mask! */ /* Don't forget the selection mask! */
gimp_item_rotate (GIMP_ITEM (gimp_image_get_mask (image)), context, {
GimpChannel *mask = gimp_image_get_mask (image);
gimp_item_rotate (GIMP_ITEM (mask), context,
rotate_type, center_x, center_y, FALSE); rotate_type, center_x, center_y, FALSE);
GIMP_ITEM (image->selection_mask)->offset_x = 0; GIMP_ITEM (mask)->offset_x = 0;
GIMP_ITEM (image->selection_mask)->offset_y = 0; GIMP_ITEM (mask)->offset_y = 0;
if (progress) if (progress)
gimp_progress_set_value (progress, progress_current++ / progress_max); gimp_progress_set_value (progress, progress_current++ / progress_max);
}
/* Rotate all layers */ /* Rotate all layers */
for (list = GIMP_LIST (image->layers)->list; for (list = GIMP_LIST (image->layers)->list;
@ -222,13 +226,13 @@ gimp_image_rotate_item_offset (GimpImage *image,
switch (rotate_type) switch (rotate_type)
{ {
case GIMP_ROTATE_90: case GIMP_ROTATE_90:
x = image->height - off_y - gimp_item_width (item); x = gimp_image_get_height (image) - off_y - gimp_item_width (item);
y = off_x; y = off_x;
break; break;
case GIMP_ROTATE_270: case GIMP_ROTATE_270:
x = off_y; x = off_y;
y = image->width - off_x - gimp_item_height (item); y = gimp_image_get_width (image) - off_x - gimp_item_height (item);
break; break;
case GIMP_ROTATE_180: case GIMP_ROTATE_180:
@ -265,7 +269,8 @@ gimp_image_rotate_guides (GimpImage *image,
case GIMP_ORIENTATION_HORIZONTAL: case GIMP_ORIENTATION_HORIZONTAL:
gimp_image_undo_push_guide (image, NULL, guide); gimp_image_undo_push_guide (image, NULL, guide);
gimp_guide_set_orientation (guide, GIMP_ORIENTATION_VERTICAL); gimp_guide_set_orientation (guide, GIMP_ORIENTATION_VERTICAL);
gimp_guide_set_position (guide, image->height - position); gimp_guide_set_position (guide,
gimp_image_get_height (image) - position);
break; break;
case GIMP_ORIENTATION_VERTICAL: case GIMP_ORIENTATION_VERTICAL:
@ -283,12 +288,14 @@ gimp_image_rotate_guides (GimpImage *image,
{ {
case GIMP_ORIENTATION_HORIZONTAL: case GIMP_ORIENTATION_HORIZONTAL:
gimp_image_move_guide (image, guide, gimp_image_move_guide (image, guide,
image->height - position, TRUE); gimp_image_get_height (image) - position,
TRUE);
break; break;
case GIMP_ORIENTATION_VERTICAL: case GIMP_ORIENTATION_VERTICAL:
gimp_image_move_guide (image, guide, gimp_image_move_guide (image, guide,
image->width - position, TRUE); gimp_image_get_width (image) - position,
TRUE);
break; break;
default: default:
@ -307,7 +314,8 @@ gimp_image_rotate_guides (GimpImage *image,
case GIMP_ORIENTATION_VERTICAL: case GIMP_ORIENTATION_VERTICAL:
gimp_image_undo_push_guide (image, NULL, guide); gimp_image_undo_push_guide (image, NULL, guide);
gimp_guide_set_orientation (guide, GIMP_ORIENTATION_HORIZONTAL); gimp_guide_set_orientation (guide, GIMP_ORIENTATION_HORIZONTAL);
gimp_guide_set_position (guide, image->width - position); gimp_guide_set_position (guide,
gimp_image_get_width (image) - position);
break; break;
default: default:
@ -341,16 +349,16 @@ gimp_image_rotate_sample_points (GimpImage *image,
{ {
case GIMP_ROTATE_90: case GIMP_ROTATE_90:
sample_point->x = old_y; sample_point->x = old_y;
sample_point->y = image->height - old_x; sample_point->y = gimp_image_get_height (image) - old_x;
break; break;
case GIMP_ROTATE_180: case GIMP_ROTATE_180:
sample_point->x = image->height - old_x; sample_point->x = gimp_image_get_height (image) - old_x;
sample_point->y = image->width - old_y; sample_point->y = gimp_image_get_width (image) - old_y;
break; break;
case GIMP_ROTATE_270: case GIMP_ROTATE_270:
sample_point->x = image->width - old_y; sample_point->x = gimp_image_get_width (image) - old_y;
sample_point->y = old_x; sample_point->y = old_x;
break; break;
} }

View file

@ -44,8 +44,8 @@ gimp_image_add_sample_point_at_pos (GimpImage *image,
GimpSamplePoint *sample_point; GimpSamplePoint *sample_point;
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL); g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
g_return_val_if_fail (x >= 0 && x < image->width, NULL); g_return_val_if_fail (x >= 0 && x < gimp_image_get_width (image), NULL);
g_return_val_if_fail (y >= 0 && y < image->height, NULL); g_return_val_if_fail (y >= 0 && y < gimp_image_get_height (image), NULL);
sample_point = gimp_sample_point_new (image->gimp->next_sample_point_ID++); sample_point = gimp_sample_point_new (image->gimp->next_sample_point_ID++);
@ -69,8 +69,8 @@ gimp_image_add_sample_point (GimpImage *image,
g_return_if_fail (sample_point != NULL); g_return_if_fail (sample_point != NULL);
g_return_if_fail (x >= 0); g_return_if_fail (x >= 0);
g_return_if_fail (y >= 0); g_return_if_fail (y >= 0);
g_return_if_fail (x < image->width); g_return_if_fail (x < gimp_image_get_width (image));
g_return_if_fail (y < image->height); g_return_if_fail (y < gimp_image_get_height (image));
image->sample_points = g_list_append (image->sample_points, sample_point); image->sample_points = g_list_append (image->sample_points, sample_point);
@ -128,8 +128,8 @@ gimp_image_move_sample_point (GimpImage *image,
g_return_if_fail (sample_point != NULL); g_return_if_fail (sample_point != NULL);
g_return_if_fail (x >= 0); g_return_if_fail (x >= 0);
g_return_if_fail (y >= 0); g_return_if_fail (y >= 0);
g_return_if_fail (x < image->width); g_return_if_fail (x < gimp_image_get_width (image));
g_return_if_fail (y < image->height); g_return_if_fail (y < gimp_image_get_height (image));
if (push_undo) if (push_undo)
gimp_image_undo_push_sample_point (image, _("Move Sample Point"), gimp_image_undo_push_sample_point (image, _("Move Sample Point"),
@ -155,8 +155,8 @@ gimp_image_find_sample_point (GimpImage *image,
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL); g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
g_return_val_if_fail (epsilon_x > 0 && epsilon_y > 0, NULL); g_return_val_if_fail (epsilon_x > 0 && epsilon_y > 0, NULL);
if (x < 0 || x >= image->width || if (x < 0 || x >= gimp_image_get_width (image) ||
y < 0 || y >= image->height) y < 0 || y >= gimp_image_get_height (image))
{ {
return NULL; return NULL;
} }

View file

@ -82,8 +82,8 @@ gimp_image_scale (GimpImage *image,
/* Push the image size to the stack */ /* Push the image size to the stack */
gimp_image_undo_push_image_size (image, NULL); gimp_image_undo_push_image_size (image, NULL);
old_width = image->width; old_width = gimp_image_get_width (image);
old_height = image->height; old_height = gimp_image_get_height (image);
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;
@ -257,7 +257,7 @@ gimp_image_scale_check (const GimpImage *image,
GIMP_ITEM_TYPE_LAYERS | GIMP_ITEM_TYPE_LAYERS |
GIMP_ITEM_TYPE_CHANNELS, GIMP_ITEM_TYPE_CHANNELS,
GIMP_ITEM_SET_ALL); GIMP_ITEM_SET_ALL);
drawables = g_list_prepend (drawables, image->selection_mask); drawables = g_list_prepend (drawables, gimp_image_get_mask (image));
scalable_size = 0; scalable_size = 0;
scaled_size = 0; scaled_size = 0;

View file

@ -64,7 +64,7 @@ gimp_image_snap_x (GimpImage *image,
if (! (snap_to_guides || snap_to_grid || snap_to_canvas)) if (! (snap_to_guides || snap_to_grid || snap_to_canvas))
return FALSE; return FALSE;
if (x < -epsilon_x || x >= (image->width + epsilon_x)) if (x < -epsilon_x || x >= (gimp_image_get_width (image) + epsilon_x))
return FALSE; return FALSE;
if (snap_to_guides) if (snap_to_guides)
@ -108,7 +108,7 @@ gimp_image_snap_x (GimpImage *image,
while (xoffset > xspacing) while (xoffset > xspacing)
xoffset -= xspacing; xoffset -= xspacing;
for (i = xoffset; i <= image->width; i += xspacing) for (i = xoffset; i <= gimp_image_get_width (image); i += xspacing)
{ {
if (i < 0) if (i < 0)
continue; continue;
@ -135,12 +135,12 @@ gimp_image_snap_x (GimpImage *image,
snapped = TRUE; snapped = TRUE;
} }
dist = ABS (image->width - x); dist = ABS (gimp_image_get_width (image) - x);
if (dist < MIN (epsilon_x, mindist)) if (dist < MIN (epsilon_x, mindist))
{ {
mindist = dist; mindist = dist;
*tx = image->width; *tx = gimp_image_get_width (image);
snapped = TRUE; snapped = TRUE;
} }
} }
@ -172,7 +172,7 @@ gimp_image_snap_y (GimpImage *image,
if (! (snap_to_guides || snap_to_grid || snap_to_canvas)) if (! (snap_to_guides || snap_to_grid || snap_to_canvas))
return FALSE; return FALSE;
if (y < -epsilon_y || y >= (image->height + epsilon_y)) if (y < -epsilon_y || y >= (gimp_image_get_height (image) + epsilon_y))
return FALSE; return FALSE;
if (snap_to_guides) if (snap_to_guides)
@ -216,7 +216,7 @@ gimp_image_snap_y (GimpImage *image,
while (yoffset > yspacing) while (yoffset > yspacing)
yoffset -= yspacing; yoffset -= yspacing;
for (i = yoffset; i <= image->height; i += yspacing) for (i = yoffset; i <= gimp_image_get_height (image); i += yspacing)
{ {
if (i < 0) if (i < 0)
continue; continue;
@ -243,12 +243,12 @@ gimp_image_snap_y (GimpImage *image,
snapped = TRUE; snapped = TRUE;
} }
dist = ABS (image->height - y); dist = ABS (gimp_image_get_height (image) - y);
if (dist < MIN (epsilon_y, mindist)) if (dist < MIN (epsilon_y, mindist))
{ {
mindist = dist; mindist = dist;
*ty = image->height; *ty = gimp_image_get_height (image);
snapped = TRUE; snapped = TRUE;
} }
} }
@ -282,14 +282,14 @@ gimp_image_snap_point (GimpImage *image,
*ty = y; *ty = y;
if (! image->guides) snap_to_guides = FALSE; if (! image->guides) snap_to_guides = FALSE;
if (! image->grid) snap_to_grid = FALSE; if (! gimp_image_get_grid (image)) snap_to_grid = FALSE;
if (! image->active_vectors) snap_to_vectors = FALSE; if (! gimp_image_get_active_vectors (image)) snap_to_vectors = FALSE;
if (! (snap_to_guides || snap_to_grid || snap_to_canvas || snap_to_vectors)) if (! (snap_to_guides || snap_to_grid || snap_to_canvas || snap_to_vectors))
return FALSE; return FALSE;
if (x < -epsilon_x || x >= (image->width + epsilon_x) || if (x < -epsilon_x || x >= (gimp_image_get_width (image) + epsilon_x) ||
y < -epsilon_y || y >= (image->height + epsilon_y)) y < -epsilon_y || y >= (gimp_image_get_height (image) + epsilon_y))
{ {
return FALSE; return FALSE;
} }
@ -356,7 +356,7 @@ gimp_image_snap_point (GimpImage *image,
while (yoffset > yspacing) while (yoffset > yspacing)
yoffset -= yspacing; yoffset -= yspacing;
for (i = xoffset; i <= image->width; i += xspacing) for (i = xoffset; i <= gimp_image_get_width (image); i += xspacing)
{ {
if (i < 0) if (i < 0)
continue; continue;
@ -371,7 +371,7 @@ gimp_image_snap_point (GimpImage *image,
} }
} }
for (i = yoffset; i <= image->height; i += yspacing) for (i = yoffset; i <= gimp_image_get_height (image); i += yspacing)
{ {
if (i < 0) if (i < 0)
continue; continue;
@ -398,12 +398,12 @@ gimp_image_snap_point (GimpImage *image,
snapped = TRUE; snapped = TRUE;
} }
dist = ABS (image->width - x); dist = ABS (gimp_image_get_width (image) - x);
if (dist < MIN (epsilon_x, mindist_x)) if (dist < MIN (epsilon_x, mindist_x))
{ {
mindist_x = dist; mindist_x = dist;
*tx = image->width; *tx = gimp_image_get_width (image);
snapped = TRUE; snapped = TRUE;
} }
@ -416,12 +416,12 @@ gimp_image_snap_point (GimpImage *image,
snapped = TRUE; snapped = TRUE;
} }
dist = ABS (image->height - y); dist = ABS (gimp_image_get_height (image) - y);
if (dist < MIN (epsilon_y, mindist_y)) if (dist < MIN (epsilon_y, mindist_y))
{ {
mindist_y = dist; mindist_y = dist;
*ty = image->height; *ty = gimp_image_get_height (image);
snapped = TRUE; snapped = TRUE;
} }
} }
@ -495,8 +495,8 @@ gimp_image_snap_rectangle (GimpImage *image,
*ty1 = y1; *ty1 = y1;
if (! image->guides) snap_to_guides = FALSE; if (! image->guides) snap_to_guides = FALSE;
if (! image->grid) snap_to_grid = FALSE; if (! gimp_image_get_grid (image)) snap_to_grid = FALSE;
if (! image->active_vectors) snap_to_vectors = FALSE; if (! gimp_image_get_active_vectors (image)) snap_to_vectors = FALSE;
if (! (snap_to_guides || snap_to_grid || snap_to_canvas || snap_to_vectors)) if (! (snap_to_guides || snap_to_grid || snap_to_canvas || snap_to_vectors))
return FALSE; return FALSE;

View file

@ -729,8 +729,8 @@ gimp_image_constructor (GType type,
/* create the selection mask */ /* create the selection mask */
image->selection_mask = gimp_selection_new (image, image->selection_mask = gimp_selection_new (image,
image->width, gimp_image_get_width (image),
image->height); gimp_image_get_height (image));
g_object_ref_sink (image->selection_mask); g_object_ref_sink (image->selection_mask);
g_signal_connect (image->selection_mask, "update", g_signal_connect (image->selection_mask, "update",
@ -1031,8 +1031,8 @@ gimp_image_get_size (GimpViewable *viewable,
{ {
GimpImage *image = GIMP_IMAGE (viewable); GimpImage *image = GIMP_IMAGE (viewable);
*width = image->width; *width = gimp_image_get_width (image);
*height = image->height; *height = gimp_image_get_height (image);
return TRUE; return TRUE;
} }
@ -1114,7 +1114,10 @@ gimp_image_real_colormap_changed (GimpImage *image,
gimp_image_color_hash_invalidate (image, color_index); gimp_image_color_hash_invalidate (image, color_index);
/* A colormap alteration affects the whole image */ /* A colormap alteration affects the whole image */
gimp_image_update (image, 0, 0, image->width, image->height); gimp_image_update (image,
0, 0,
gimp_image_get_width (image),
gimp_image_get_height (image));
gimp_image_invalidate_layer_previews (image); gimp_image_invalidate_layer_previews (image);
} }
@ -1700,7 +1703,10 @@ gimp_image_set_component_visible (GimpImage *image,
gimp_image_signals[COMPONENT_VISIBILITY_CHANGED], 0, gimp_image_signals[COMPONENT_VISIBILITY_CHANGED], 0,
channel); channel);
gimp_image_update (image, 0, 0, image->width, image->height); gimp_image_update (image,
0, 0,
gimp_image_get_width (image),
gimp_image_get_height (image));
} }
} }
@ -3720,8 +3726,8 @@ gimp_image_coords_in_active_pickable (GimpImage *image,
if (sample_merged) if (sample_merged)
{ {
if (x >= 0 && x < image->width && if (x >= 0 && x < gimp_image_get_width (image) &&
y >= 0 && y < image->height) y >= 0 && y < gimp_image_get_height (image))
in_pickable = TRUE; in_pickable = TRUE;
} }
else else

View file

@ -758,24 +758,27 @@ gimp_imagefile_save_thumb (GimpImagefile *imagefile,
if (size < 1) if (size < 1)
return TRUE; return TRUE;
if (image->width <= size && image->height <= size) if (gimp_image_get_width (image) <= size &&
gimp_image_get_height (image) <= size)
{ {
width = image->width; width = gimp_image_get_width (image);
height = image->height; height = gimp_image_get_height (image);
size = MAX (width, height); size = MAX (width, height);
} }
else else
{ {
if (image->width < image->height) if (gimp_image_get_width (image) < gimp_image_get_height (image))
{ {
height = size; height = size;
width = MAX (1, (size * image->width) / image->height); width = MAX (1, (size * gimp_image_get_width (image) /
gimp_image_get_height (image)));
} }
else else
{ {
width = size; width = size;
height = MAX (1, (size * image->height) / image->width); height = MAX (1, (size * gimp_image_get_height (image) /
gimp_image_get_width (image)));
} }
} }

View file

@ -126,18 +126,18 @@ gimp_image_undo_constructor (GType type,
switch (GIMP_UNDO (object)->undo_type) switch (GIMP_UNDO (object)->undo_type)
{ {
case GIMP_UNDO_IMAGE_TYPE: case GIMP_UNDO_IMAGE_TYPE:
image_undo->base_type = image->base_type; image_undo->base_type = gimp_image_base_type (image);
break; break;
case GIMP_UNDO_IMAGE_SIZE: case GIMP_UNDO_IMAGE_SIZE:
image_undo->width = image->width; image_undo->width = gimp_image_get_width (image);
image_undo->height = image->height; image_undo->height = gimp_image_get_height (image);
break; break;
case GIMP_UNDO_IMAGE_RESOLUTION: case GIMP_UNDO_IMAGE_RESOLUTION:
image_undo->xresolution = image->xresolution; image_undo->xresolution = image->xresolution;
image_undo->yresolution = image->yresolution; image_undo->yresolution = image->yresolution;
image_undo->resolution_unit = image->resolution_unit; image_undo->resolution_unit = gimp_image_get_unit (image);
break; break;
case GIMP_UNDO_IMAGE_GRID: case GIMP_UNDO_IMAGE_GRID:
@ -252,12 +252,12 @@ gimp_image_undo_pop (GimpUndo *undo,
GimpImageBaseType base_type; GimpImageBaseType base_type;
base_type = image_undo->base_type; base_type = image_undo->base_type;
image_undo->base_type = image->base_type; image_undo->base_type = gimp_image_base_type (image);
g_object_set (image, "base-type", base_type, NULL); g_object_set (image, "base-type", base_type, NULL);
gimp_image_colormap_changed (image, -1); gimp_image_colormap_changed (image, -1);
if (image_undo->base_type != image->base_type) if (image_undo->base_type != gimp_image_base_type (image))
accum->mode_changed = TRUE; accum->mode_changed = TRUE;
} }
break; break;
@ -270,8 +270,8 @@ gimp_image_undo_pop (GimpUndo *undo,
width = image_undo->width; width = image_undo->width;
height = image_undo->height; height = image_undo->height;
image_undo->width = image->width; image_undo->width = gimp_image_get_width (image);
image_undo->height = image->height; image_undo->height = gimp_image_get_height (image);
g_object_set (image, g_object_set (image,
"width", width, "width", width,
@ -281,8 +281,8 @@ gimp_image_undo_pop (GimpUndo *undo,
gimp_drawable_invalidate_boundary gimp_drawable_invalidate_boundary
(GIMP_DRAWABLE (gimp_image_get_mask (image))); (GIMP_DRAWABLE (gimp_image_get_mask (image)));
if (image->width != image_undo->width || if (gimp_image_get_width (image) != image_undo->width ||
image->height != image_undo->height) gimp_image_get_height (image) != image_undo->height)
accum->size_changed = TRUE; accum->size_changed = TRUE;
} }
break; break;
@ -306,11 +306,11 @@ gimp_image_undo_pop (GimpUndo *undo,
accum->resolution_changed = TRUE; accum->resolution_changed = TRUE;
} }
if (image_undo->resolution_unit != image->resolution_unit) if (image_undo->resolution_unit != gimp_image_get_unit (image))
{ {
GimpUnit unit; GimpUnit unit;
unit = image->resolution_unit; unit = gimp_image_get_unit (image);
image->resolution_unit = image_undo->resolution_unit; image->resolution_unit = image_undo->resolution_unit;
image_undo->resolution_unit = unit; image_undo->resolution_unit = unit;

View file

@ -56,8 +56,8 @@ gimp_item_get_preview_size (GimpViewable *viewable,
if (image && ! is_popup) if (image && ! is_popup)
{ {
gimp_viewable_calc_preview_size (image->width, gimp_viewable_calc_preview_size (gimp_image_get_width (image),
image->height, gimp_image_get_height (image),
size, size,
size, size,
dot_for_dot, dot_for_dot,

View file

@ -718,8 +718,10 @@ gimp_item_check_scaling (const GimpItem *item,
image = gimp_item_get_image (item); image = gimp_item_get_image (item);
img_scale_w = (gdouble) new_width / (gdouble) image->width; img_scale_w = ((gdouble) new_width /
img_scale_h = (gdouble) new_height / (gdouble) image->height; (gdouble) gimp_image_get_width (image));
img_scale_h = ((gdouble) new_height /
(gdouble) gimp_image_get_height (image));
new_item_width = ROUND (img_scale_w * (gdouble) gimp_item_width (item)); new_item_width = ROUND (img_scale_w * (gdouble) gimp_item_width (item));
new_item_height = ROUND (img_scale_h * (gdouble) gimp_item_height (item)); new_item_height = ROUND (img_scale_h * (gdouble) gimp_item_height (item));
@ -872,18 +874,20 @@ gimp_item_scale_by_origin (GimpItem *item,
if (local_origin) if (local_origin)
{ {
new_offset_x = item->offset_x + ((item->width - new_width) / 2.0); new_offset_x = (item->offset_x +
new_offset_y = item->offset_y + ((item->height - new_height) / 2.0); ((gimp_item_width (item) - new_width) / 2.0));
new_offset_y = (item->offset_y +
((gimp_item_height (item) - new_height) / 2.0));
} }
else else
{ {
new_offset_x = (gint) (((gdouble) new_width * new_offset_x = (gint) (((gdouble) new_width *
(gdouble) item->offset_x / (gdouble) item->offset_x /
(gdouble) item->width)); (gdouble) gimp_item_width (item)));
new_offset_y = (gint) (((gdouble) new_height * new_offset_y = (gint) (((gdouble) new_height *
(gdouble) item->offset_y / (gdouble) item->offset_y /
(gdouble) item->height)); (gdouble) gimp_item_height (item)));
} }
gimp_item_scale (item, gimp_item_scale (item,
@ -1317,8 +1321,8 @@ gimp_item_is_in_set (GimpItem *item,
return TRUE; return TRUE;
case GIMP_ITEM_SET_IMAGE_SIZED: case GIMP_ITEM_SET_IMAGE_SIZED:
return (gimp_item_width (item) == item->image->width && return (gimp_item_width (item) == gimp_image_get_width (item->image) &&
gimp_item_height (item) == item->image->height); gimp_item_height (item) == gimp_image_get_height (item->image));
case GIMP_ITEM_SET_VISIBLE: case GIMP_ITEM_SET_VISIBLE:
return gimp_item_get_visible (item); return gimp_item_get_visible (item);

View file

@ -1428,7 +1428,8 @@ gimp_layer_create_mask (const GimpLayer *layer,
channel_empty = gimp_channel_is_empty (channel); channel_empty = gimp_channel_is_empty (channel);
gimp_rectangle_intersect (0, 0, gimp_rectangle_intersect (0, 0,
image->width, image->height, gimp_image_get_width (image),
gimp_image_get_height (image),
item->offset_x, item->offset_y, item->offset_x, item->offset_y,
gimp_item_width (item), gimp_item_width (item),
gimp_item_height (item), gimp_item_height (item),
@ -1744,7 +1745,9 @@ gimp_layer_resize_to_image (GimpLayer *layer,
gimp_item_offsets (GIMP_ITEM (layer), &offset_x, &offset_y); gimp_item_offsets (GIMP_ITEM (layer), &offset_x, &offset_y);
gimp_item_resize (GIMP_ITEM (layer), context, gimp_item_resize (GIMP_ITEM (layer), context,
image->width, image->height, offset_x, offset_y); gimp_image_get_width (image),
gimp_image_get_height (image),
offset_x, offset_y);
gimp_image_undo_group_end (image); gimp_image_undo_group_end (image);
} }

View file

@ -34,6 +34,7 @@
#include "gimpcontext.h" #include "gimpcontext.h"
#include "gimpgradient.h" #include "gimpgradient.h"
#include "gimpimage.h" #include "gimpimage.h"
#include "gimpimage-colormap.h"
#include "gimppalette.h" #include "gimppalette.h"
#include "gimppalette-import.h" #include "gimppalette-import.h"
#include "gimppalette-load.h" #include "gimppalette-load.h"
@ -384,8 +385,8 @@ gimp_palette_import_from_image (GimpImage *image,
{ {
x = 0; x = 0;
y = 0; y = 0;
width = image->width; width = gimp_image_get_width (image);
height = image->height; height = gimp_image_get_height (image);
} }
colors = gimp_palette_import_extract (image, colors = gimp_palette_import_extract (image,
@ -406,6 +407,8 @@ gimp_palette_import_from_indexed_image (GimpImage *image,
const gchar *palette_name) const gchar *palette_name)
{ {
GimpPalette *palette; GimpPalette *palette;
const guchar *colormap;
guint n_colors;
gint count; gint count;
GimpRGB color; GimpRGB color;
@ -415,16 +418,19 @@ gimp_palette_import_from_indexed_image (GimpImage *image,
palette = GIMP_PALETTE (gimp_palette_new (palette_name)); palette = GIMP_PALETTE (gimp_palette_new (palette_name));
for (count = 0; count < image->num_cols; ++count) colormap = gimp_image_get_colormap (image);
n_colors = gimp_image_get_colormap_size (image);
for (count = 0; count < n_colors; ++count)
{ {
gchar name[256]; gchar name[256];
g_snprintf (name, sizeof (name), _("Index %d"), count); g_snprintf (name, sizeof (name), _("Index %d"), count);
gimp_rgba_set_uchar (&color, gimp_rgba_set_uchar (&color,
image->cmap[count * 3 + 0], colormap[count * 3 + 0],
image->cmap[count * 3 + 1], colormap[count * 3 + 1],
image->cmap[count * 3 + 2], colormap[count * 3 + 2],
255); 255);
gimp_palette_add_entry (palette, -1, name, &color); gimp_palette_add_entry (palette, -1, name, &color);

View file

@ -31,6 +31,7 @@
#include "gimpdrawable.h" #include "gimpdrawable.h"
#include "gimpimage.h" #include "gimpimage.h"
#include "gimpimage-colormap.h"
#include "gimplayer.h" #include "gimplayer.h"
#include "gimplayer-floating-sel.h" #include "gimplayer-floating-sel.h"
#include "gimplayermask.h" #include "gimplayermask.h"
@ -441,11 +442,13 @@ project_indexed (GimpProjection *proj,
PixelRegion *dest, PixelRegion *dest,
PixelRegion *mask) PixelRegion *mask)
{ {
g_return_if_fail (proj->image->cmap != NULL); const guchar *colormap = gimp_image_get_colormap (proj->image);
g_return_if_fail (colormap != NULL);
if (proj->construct_flag) if (proj->construct_flag)
{ {
combine_regions (dest, src, dest, mask, proj->image->cmap, combine_regions (dest, src, dest, mask, colormap,
gimp_layer_get_opacity (layer) * 255.999, gimp_layer_get_opacity (layer) * 255.999,
gimp_layer_get_mode (layer), gimp_layer_get_mode (layer),
proj->image->visible, proj->image->visible,
@ -453,7 +456,7 @@ project_indexed (GimpProjection *proj,
} }
else else
{ {
initial_region (src, dest, mask, proj->image->cmap, initial_region (src, dest, mask, colormap,
gimp_layer_get_opacity (layer) * 255.999, gimp_layer_get_opacity (layer) * 255.999,
gimp_layer_get_mode (layer), gimp_layer_get_mode (layer),
proj->image->visible, proj->image->visible,
@ -468,11 +471,13 @@ project_indexed_alpha (GimpProjection *proj,
PixelRegion *dest, PixelRegion *dest,
PixelRegion *mask) PixelRegion *mask)
{ {
g_return_if_fail (proj->image->cmap != NULL); const guchar *colormap = gimp_image_get_colormap (proj->image);
g_return_if_fail (colormap != NULL);
if (proj->construct_flag) if (proj->construct_flag)
{ {
combine_regions (dest, src, dest, mask, proj->image->cmap, combine_regions (dest, src, dest, mask, colormap,
gimp_layer_get_opacity (layer) * 255.999, gimp_layer_get_opacity (layer) * 255.999,
gimp_layer_get_mode (layer), gimp_layer_get_mode (layer),
proj->image->visible, proj->image->visible,
@ -480,7 +485,7 @@ project_indexed_alpha (GimpProjection *proj,
} }
else else
{ {
initial_region (src, dest, mask, proj->image->cmap, initial_region (src, dest, mask, colormap,
gimp_layer_get_opacity (layer) * 255.999, gimp_layer_get_opacity (layer) * 255.999,
gimp_layer_get_mode (layer), gimp_layer_get_mode (layer),
proj->image->visible, proj->image->visible,

View file

@ -260,7 +260,10 @@ gimp_projection_get_pixel_at (GimpPickable *pickable,
{ {
GimpProjection *proj = GIMP_PROJECTION (pickable); GimpProjection *proj = GIMP_PROJECTION (pickable);
if (x < 0 || y < 0 || x >= proj->image->width || y >= proj->image->height) if (x < 0 ||
y < 0 ||
x >= gimp_image_get_width (proj->image) ||
y >= gimp_image_get_height (proj->image))
return FALSE; return FALSE;
read_pixel_data_1 (gimp_projection_get_tiles (proj), x, y, pixel); read_pixel_data_1 (gimp_projection_get_tiles (proj), x, y, pixel);
@ -320,8 +323,8 @@ gimp_projection_get_tiles_at_level (GimpProjection *proj,
if (! proj->pyramid) if (! proj->pyramid)
{ {
proj->pyramid = tile_pyramid_new (gimp_projection_get_image_type (proj), proj->pyramid = tile_pyramid_new (gimp_projection_get_image_type (proj),
proj->image->width, gimp_image_get_width (proj->image),
proj->image->height); gimp_image_get_height (proj->image));
tile_pyramid_set_validate_proc (proj->pyramid, tile_pyramid_set_validate_proc (proj->pyramid,
(TileValidateProc) gimp_projection_validate_tile, (TileValidateProc) gimp_projection_validate_tile,
@ -346,8 +349,8 @@ gimp_projection_get_level (GimpProjection *proj,
gdouble scale_x, gdouble scale_x,
gdouble scale_y) gdouble scale_y)
{ {
return tile_pyramid_get_level (proj->image->width, return tile_pyramid_get_level (gimp_image_get_width (proj->image),
proj->image->height, gimp_image_get_height (proj->image),
MAX (scale_x, scale_y)); MAX (scale_x, scale_y));
} }
@ -375,6 +378,8 @@ gimp_projection_get_image_type (const GimpProjection *proj)
} }
g_assert_not_reached (); g_assert_not_reached ();
return 0;
} }
gint gint
@ -435,10 +440,10 @@ gimp_projection_add_update_area (GimpProjection *proj,
g_return_if_fail (GIMP_IS_PROJECTION (proj)); g_return_if_fail (GIMP_IS_PROJECTION (proj));
area = gimp_area_new (CLAMP (x, 0, proj->image->width), area = gimp_area_new (CLAMP (x, 0, gimp_image_get_width (proj->image)),
CLAMP (y, 0, proj->image->height), CLAMP (y, 0, gimp_image_get_height (proj->image)),
CLAMP (x + w, 0, proj->image->width), CLAMP (x + w, 0, gimp_image_get_width (proj->image)),
CLAMP (y + h, 0, proj->image->height)); CLAMP (y + h, 0, gimp_image_get_height (proj->image)));
proj->update_areas = gimp_area_list_process (proj->update_areas, area); proj->update_areas = gimp_area_list_process (proj->update_areas, area);
} }
@ -646,10 +651,10 @@ gimp_projection_paint_area (GimpProjection *proj,
gint h) gint h)
{ {
/* Bounds check */ /* Bounds check */
gint x1 = CLAMP (x, 0, proj->image->width); gint x1 = CLAMP (x, 0, gimp_image_get_width (proj->image));
gint y1 = CLAMP (y, 0, proj->image->height); gint y1 = CLAMP (y, 0, gimp_image_get_height (proj->image));
gint x2 = CLAMP (x + w, 0, proj->image->width); gint x2 = CLAMP (x + w, 0, gimp_image_get_width (proj->image));
gint y2 = CLAMP (y + h, 0, proj->image->height); gint y2 = CLAMP (y + h, 0, gimp_image_get_height (proj->image));
gimp_projection_invalidate (proj, x1, y1, x2 - x1, y2 - y1); gimp_projection_invalidate (proj, x1, y1, x2 - x1, y2 - y1);
@ -706,7 +711,10 @@ gimp_projection_image_size_changed (GimpImage *image,
proj->pyramid = NULL; proj->pyramid = NULL;
} }
gimp_projection_add_update_area (proj, 0, 0, image->width, image->height); gimp_projection_add_update_area (proj,
0, 0,
gimp_image_get_width (image),
gimp_image_get_height (image));
} }
static void static void
@ -719,7 +727,10 @@ gimp_projection_image_mode_changed (GimpImage *image,
proj->pyramid = NULL; proj->pyramid = NULL;
} }
gimp_projection_add_update_area (proj, 0, 0, image->width, image->height); gimp_projection_add_update_area (proj,
0, 0,
gimp_image_get_width (image),
gimp_image_get_height (image));
} }
static void static void

View file

@ -360,8 +360,8 @@ gimp_selection_boundary (GimpChannel *channel,
num_segs_in, num_segs_in,
num_segs_out, num_segs_out,
0, 0, 0, 0,
image->width, gimp_image_get_width (image),
image->height); gimp_image_get_height (image));
} }
else if ((layer = gimp_image_get_active_layer (image))) else if ((layer = gimp_image_get_active_layer (image)))
{ {
@ -375,12 +375,12 @@ gimp_selection_boundary (GimpChannel *channel,
gimp_item_offsets (GIMP_ITEM (layer), &off_x, &off_y); gimp_item_offsets (GIMP_ITEM (layer), &off_x, &off_y);
x1 = CLAMP (off_x, 0, image->width); x1 = CLAMP (off_x, 0, gimp_image_get_width (image));
y1 = CLAMP (off_y, 0, image->height); y1 = CLAMP (off_y, 0, gimp_image_get_height (image));
x2 = CLAMP (off_x + gimp_item_width (GIMP_ITEM (layer)), 0, x2 = CLAMP (off_x + gimp_item_width (GIMP_ITEM (layer)),
image->width); 0, gimp_image_get_width (image));
y2 = CLAMP (off_y + gimp_item_height (GIMP_ITEM (layer)), 0, y2 = CLAMP (off_y + gimp_item_height (GIMP_ITEM (layer)),
image->height); 0, gimp_image_get_height (image));
return GIMP_CHANNEL_CLASS (parent_class)->boundary (channel, return GIMP_CHANNEL_CLASS (parent_class)->boundary (channel,
segs_in, segs_out, segs_in, segs_out,

View file

@ -477,22 +477,25 @@ gimp_undo_create_preview_private (GimpUndo *undo,
preview_size = image->gimp->config->undo_preview_size; preview_size = image->gimp->config->undo_preview_size;
if (image->width <= preview_size && image->height <= preview_size) if (gimp_image_get_width (image) <= preview_size &&
gimp_image_get_height (image) <= preview_size)
{ {
width = image->width; width = gimp_image_get_width (image);
height = image->height; height = gimp_image_get_height (image);
} }
else else
{ {
if (image->width > image->height) if (gimp_image_get_width (image) > gimp_image_get_height (image))
{ {
width = preview_size; width = preview_size;
height = MAX (1, (image->height * preview_size / image->width)); height = MAX (1, (gimp_image_get_height (image) * preview_size /
gimp_image_get_width (image)));
} }
else else
{ {
height = preview_size; height = preview_size;
width = MAX (1, (image->width * preview_size / image->height)); width = MAX (1, (gimp_image_get_width (image) * preview_size /
gimp_image_get_height (image)));
} }
} }

View file

@ -181,14 +181,14 @@ layer_options_dialog_new (GimpImage *image,
GIMP_MAX_IMAGE_SIZE); GIMP_MAX_IMAGE_SIZE);
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (options->size_se), 0, gimp_size_entry_set_size (GIMP_SIZE_ENTRY (options->size_se), 0,
0, image->width); 0, gimp_image_get_width (image));
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (options->size_se), 1, gimp_size_entry_set_size (GIMP_SIZE_ENTRY (options->size_se), 1,
0, image->height); 0, gimp_image_get_height (image));
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (options->size_se), 0, gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (options->size_se), 0,
image->width); gimp_image_get_width (image));
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (options->size_se), 1, gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (options->size_se), 1,
image->height); gimp_image_get_height (image));
/* The radio frame */ /* The radio frame */
frame = gimp_enum_radio_frame_new_with_range (GIMP_TYPE_FILL_TYPE, frame = gimp_enum_radio_frame_new_with_range (GIMP_TYPE_FILL_TYPE,

View file

@ -206,8 +206,10 @@ print_size_dialog_new (GimpImage *image,
gimp_size_entry_set_refval_boundaries gimp_size_entry_set_refval_boundaries
(GIMP_SIZE_ENTRY (entry), 1, GIMP_MIN_IMAGE_SIZE, GIMP_MAX_IMAGE_SIZE); (GIMP_SIZE_ENTRY (entry), 1, GIMP_MIN_IMAGE_SIZE, GIMP_MAX_IMAGE_SIZE);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (entry), 0, image->width); gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (entry), 0,
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (entry), 1, image->height); gimp_image_get_width (image));
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (entry), 1,
gimp_image_get_height (image));
/* the resolution entry */ /* the resolution entry */
@ -348,14 +350,16 @@ print_size_dialog_size_changed (GtkWidget *widget,
width = gimp_size_entry_get_value (private->size_entry, 0); width = gimp_size_entry_get_value (private->size_entry, 0);
height = gimp_size_entry_get_value (private->size_entry, 1); height = gimp_size_entry_get_value (private->size_entry, 1);
xres = scale * image->width / MAX (0.001, width); xres = scale * gimp_image_get_width (image) / MAX (0.001, width);
yres = scale * image->height / MAX (0.001, height); yres = scale * gimp_image_get_height (image) / MAX (0.001, height);
xres = CLAMP (xres, GIMP_MIN_RESOLUTION, GIMP_MAX_RESOLUTION); xres = CLAMP (xres, GIMP_MIN_RESOLUTION, GIMP_MAX_RESOLUTION);
yres = CLAMP (yres, GIMP_MIN_RESOLUTION, GIMP_MAX_RESOLUTION); yres = CLAMP (yres, GIMP_MIN_RESOLUTION, GIMP_MAX_RESOLUTION);
print_size_dialog_set_resolution (private, xres, yres); print_size_dialog_set_resolution (private, xres, yres);
print_size_dialog_set_size (private, image->width, image->height); print_size_dialog_set_size (private,
gimp_image_get_width (image),
gimp_image_get_height (image));
} }
static void static void

View file

@ -475,10 +475,14 @@ gimp_display_update_area (GimpDisplay *display,
} }
else else
{ {
GimpArea *area = gimp_area_new (CLAMP (x, 0, display->image->width), GimpArea *area;
CLAMP (y, 0, display->image->height), gint image_width = gimp_image_get_width (display->image);
CLAMP (x + w, 0, display->image->width), gint image_height = gimp_image_get_height (display->image);
CLAMP (y + h, 0, display->image->height));
area = gimp_area_new (CLAMP (x, 0, image_width),
CLAMP (y, 0, image_height),
CLAMP (x + w, 0, image_width),
CLAMP (y + h, 0, image_height));
display->update_areas = gimp_area_list_process (display->update_areas, display->update_areas = gimp_area_list_process (display->update_areas,
area); area);
@ -541,14 +545,16 @@ gimp_display_paint_area (GimpDisplay *display,
gint h) gint h)
{ {
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (display->shell); GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (display->shell);
gint image_width = gimp_image_get_width (display->image);
gint image_height = gimp_image_get_height (display->image);
gint x1, y1, x2, y2; gint x1, y1, x2, y2;
gdouble x1_f, y1_f, x2_f, y2_f; gdouble x1_f, y1_f, x2_f, y2_f;
/* Bounds check */ /* Bounds check */
x1 = CLAMP (x, 0, display->image->width); x1 = CLAMP (x, 0, image_width);
y1 = CLAMP (y, 0, display->image->height); y1 = CLAMP (y, 0, image_height);
x2 = CLAMP (x + w, 0, display->image->width); x2 = CLAMP (x + w, 0, image_width);
y2 = CLAMP (y + h, 0, display->image->height); y2 = CLAMP (y + h, 0, image_height);
x = x1; x = x1;
y = y1; y = y1;

View file

@ -80,8 +80,8 @@ gimp_display_shell_draw_guide (GimpDisplayShell *shell,
gimp_display_shell_transform_xy (shell, 0, 0, &x1, &y1, FALSE); gimp_display_shell_transform_xy (shell, 0, 0, &x1, &y1, FALSE);
gimp_display_shell_transform_xy (shell, gimp_display_shell_transform_xy (shell,
shell->display->image->width, gimp_image_get_width (shell->display->image),
shell->display->image->height, gimp_image_get_height (shell->display->image),
&x2, &y2, FALSE); &x2, &y2, FALSE);
gdk_drawable_get_size (shell->canvas->window, &w, &h); gdk_drawable_get_size (shell->canvas->window, &w, &h);
@ -164,8 +164,8 @@ gimp_display_shell_draw_grid (GimpDisplayShell *shell,
x2 = area->x + area->width; x2 = area->x + area->width;
y2 = area->y + area->height; y2 = area->y + area->height;
width = shell->display->image->width; width = gimp_image_get_width (shell->display->image);
height = shell->display->image->height; height = gimp_image_get_height (shell->display->image);
x_offset = grid->xoffset; x_offset = grid->xoffset;
while (x_offset > 0) while (x_offset > 0)

View file

@ -98,8 +98,8 @@ gimp_display_shell_scale_setup (GimpDisplayShell *shell)
if (! shell->display) if (! shell->display)
return; return;
image_width = shell->display->image->width; image_width = gimp_image_get_width (shell->display->image);
image_height = shell->display->image->height; image_height = gimp_image_get_height (shell->display->image);
sx = SCALEX (shell, image_width); sx = SCALEX (shell, image_width);
sy = SCALEY (shell, image_height); sy = SCALEY (shell, image_height);
@ -400,8 +400,8 @@ gimp_display_shell_scale_fit_in (GimpDisplayShell *shell)
image = shell->display->image; image = shell->display->image;
image_width = image->width; image_width = gimp_image_get_width (image);
image_height = image->height; image_height = gimp_image_get_height (image);
if (! shell->dot_for_dot) if (! shell->dot_for_dot)
{ {
@ -436,8 +436,8 @@ gimp_display_shell_scale_fill (GimpDisplayShell *shell)
image = shell->display->image; image = shell->display->image;
image_width = image->width; image_width = gimp_image_get_width (image);
image_height = image->height; image_height = gimp_image_get_height (image);
if (! shell->dot_for_dot) if (! shell->dot_for_dot)
{ {

View file

@ -94,8 +94,8 @@ gimp_display_shell_scroll_clamp_offsets (GimpDisplayShell *shell)
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell)); g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
sx = SCALEX (shell, shell->display->image->width); sx = SCALEX (shell, gimp_image_get_width (shell->display->image));
sy = SCALEY (shell, shell->display->image->height); sy = SCALEY (shell, gimp_image_get_height (shell->display->image));
shell->offset_x = CLAMP (shell->offset_x, 0, shell->offset_x = CLAMP (shell->offset_x, 0,
MAX (sx - shell->disp_width, 0)); MAX (sx - shell->disp_width, 0));

View file

@ -351,14 +351,15 @@ gimp_display_shell_format_title (GimpDisplayShell *shell,
g_snprintf (unit_format, sizeof (unit_format), "%%.%df", g_snprintf (unit_format, sizeof (unit_format), "%%.%df",
_gimp_unit_get_digits (gimp, shell->unit) + 1); _gimp_unit_get_digits (gimp, shell->unit) + 1);
i += print (title, title_len, i, unit_format, i += print (title, title_len, i, unit_format,
(image->width * (gimp_image_get_width (image) *
_gimp_unit_get_factor (gimp, shell->unit) / _gimp_unit_get_factor (gimp, shell->unit) /
image->xresolution)); image->xresolution));
break; break;
} }
/* else fallthru */ /* else fallthru */
case 'w': /* width in pixels */ case 'w': /* width in pixels */
i += print (title, title_len, i, "%d", image->width); i += print (title, title_len, i, "%d",
gimp_image_get_width (image));
break; break;
case 'H': /* height in real-world units */ case 'H': /* height in real-world units */
@ -369,14 +370,15 @@ gimp_display_shell_format_title (GimpDisplayShell *shell,
g_snprintf (unit_format, sizeof (unit_format), "%%.%df", g_snprintf (unit_format, sizeof (unit_format), "%%.%df",
_gimp_unit_get_digits (gimp, shell->unit) + 1); _gimp_unit_get_digits (gimp, shell->unit) + 1);
i += print (title, title_len, i, unit_format, i += print (title, title_len, i, unit_format,
(image->height * (gimp_image_get_height (image) *
_gimp_unit_get_factor (gimp, shell->unit) / _gimp_unit_get_factor (gimp, shell->unit) /
image->yresolution)); image->yresolution));
break; break;
} }
/* else fallthru */ /* else fallthru */
case 'h': /* height in pixels */ case 'h': /* height in pixels */
i += print (title, title_len, i, "%d", image->height); i += print (title, title_len, i, "%d",
gimp_image_get_height (image));
break; break;
case 'u': /* unit symbol */ case 'u': /* unit symbol */

View file

@ -474,8 +474,10 @@ gimp_display_shell_untransform_viewport (GimpDisplayShell *shell,
if (x1 < 0) x1 = 0; if (x1 < 0) x1 = 0;
if (y1 < 0) y1 = 0; if (y1 < 0) y1 = 0;
if (x2 > shell->display->image->width) x2 = shell->display->image->width; if (x2 > gimp_image_get_width (shell->display->image))
if (y2 > shell->display->image->height) y2 = shell->display->image->height; x2 = gimp_image_get_width (shell->display->image);
if (y2 > gimp_image_get_height (shell->display->image))
y2 = gimp_image_get_height (shell->display->image);
if (x) *x = x1; if (x) *x = x1;
if (y) *y = y1; if (y) *y = y1;

View file

@ -663,8 +663,8 @@ gimp_display_shell_new (GimpDisplay *display,
shell->display = display; shell->display = display;
image_width = display->image->width; image_width = gimp_image_get_width (display->image);
image_height = display->image->height; image_height = gimp_image_get_height (display->image);
gimp = display->image->gimp; gimp = display->image->gimp;
display_config = GIMP_DISPLAY_CONFIG (gimp->config); display_config = GIMP_DISPLAY_CONFIG (gimp->config);
@ -1166,16 +1166,16 @@ gimp_display_shell_scale_changed (GimpDisplayShell *shell)
image = shell->display->image; image = shell->display->image;
shell->scale_x = (gimp_zoom_model_get_factor (shell->zoom) shell->scale_x = (gimp_zoom_model_get_factor (shell->zoom) *
* SCREEN_XRES (shell) / image->xresolution); SCREEN_XRES (shell) / image->xresolution);
shell->scale_y = (gimp_zoom_model_get_factor (shell->zoom) shell->scale_y = (gimp_zoom_model_get_factor (shell->zoom) *
* SCREEN_YRES (shell) / image->yresolution); SCREEN_YRES (shell) / image->yresolution);
shell->x_dest_inc = image->width; shell->x_dest_inc = gimp_image_get_width (image);
shell->y_dest_inc = image->height; shell->y_dest_inc = gimp_image_get_height (image);
shell->x_src_dec = ceil (image->width * shell->scale_x); shell->x_src_dec = ceil (gimp_image_get_width (image) * shell->scale_x);
shell->y_src_dec = ceil (image->height * shell->scale_y); shell->y_src_dec = ceil (gimp_image_get_height (image) * shell->scale_y);
} }
void void
@ -1593,8 +1593,8 @@ gimp_display_shell_shrink_wrap (GimpDisplayShell *shell)
monitor = gdk_screen_get_monitor_at_window (screen, widget->window); monitor = gdk_screen_get_monitor_at_window (screen, widget->window);
gdk_screen_get_monitor_geometry (screen, monitor, &rect); gdk_screen_get_monitor_geometry (screen, monitor, &rect);
width = SCALEX (shell, shell->display->image->width); width = SCALEX (shell, gimp_image_get_width (shell->display->image));
height = SCALEY (shell, shell->display->image->height); height = SCALEY (shell, gimp_image_get_height (shell->display->image));
disp_width = shell->disp_width; disp_width = shell->disp_width;
disp_height = shell->disp_height; disp_height = shell->disp_height;

View file

@ -904,8 +904,8 @@ gimp_statusbar_update_cursor (GimpStatusbar *statusbar,
if (x < 0 || if (x < 0 ||
y < 0 || y < 0 ||
x >= shell->display->image->width || x >= gimp_image_get_width (shell->display->image) ||
y >= shell->display->image->height) y >= gimp_image_get_height (shell->display->image))
{ {
gtk_widget_set_sensitive (statusbar->cursor_label, FALSE); gtk_widget_set_sensitive (statusbar->cursor_label, FALSE);
} }
@ -1080,7 +1080,9 @@ gimp_statusbar_shell_scaled (GimpDisplayShell *shell,
_gimp_unit_get_digits (image->gimp, shell->unit)); _gimp_unit_get_digits (image->gimp, shell->unit));
} }
gimp_statusbar_update_cursor (statusbar, -image->width, -image->height); gimp_statusbar_update_cursor (statusbar,
- gimp_image_get_width (image),
- gimp_image_get_height (image));
text = gtk_label_get_text (GTK_LABEL (statusbar->cursor_label)); text = gtk_label_get_text (GTK_LABEL (statusbar->cursor_label));

View file

@ -281,7 +281,8 @@ file_open_thumbnail (Gimp *gimp,
#ifdef GIMP_UNSTABLE #ifdef GIMP_UNSTABLE
g_printerr ("opened thumbnail at %d x %d\n", g_printerr ("opened thumbnail at %d x %d\n",
image->width, image->height); gimp_image_get_width (image),
gimp_image_get_height (image));
#endif #endif
} }
} }
@ -568,7 +569,10 @@ file_open_sanitize_image (GimpImage *image,
* load plug-ins are not required to call gimp_drawable_update() or * load plug-ins are not required to call gimp_drawable_update() or
* anything. * anything.
*/ */
gimp_image_update (image, 0, 0, image->width, image->height); gimp_image_update (image,
0, 0,
gimp_image_get_width (image),
gimp_image_get_height (image));
gimp_image_flush (image); gimp_image_flush (image);
/* same for drawable previews */ /* same for drawable previews */

View file

@ -575,7 +575,8 @@ gimp_paint_options_get_fade (GimpPaintOptions *paint_options,
fade_out = fade_options->fade_length; fade_out = fade_options->fade_length;
break; break;
case GIMP_UNIT_PERCENT: case GIMP_UNIT_PERCENT:
fade_out = (MAX (image->width, image->height) * fade_out = (MAX (gimp_image_get_width (image),
gimp_image_get_height (image)) *
fade_options->fade_length / 100); fade_options->fade_length / 100);
break; break;
default: default:
@ -658,7 +659,8 @@ gimp_paint_options_get_gradient_color (GimpPaintOptions *paint_options,
gradient_length = gradient_options->gradient_length; gradient_length = gradient_options->gradient_length;
break; break;
case GIMP_UNIT_PERCENT: case GIMP_UNIT_PERCENT:
gradient_length = (MAX (image->width, image->height) * gradient_length = (MAX (gimp_image_get_width (image),
gimp_image_get_height (image)) *
gradient_options->gradient_length / 100); gradient_options->gradient_length / 100);
break; break;
default: default:

View file

@ -55,7 +55,7 @@ image_add_hguide_invoker (GimpProcedure *procedure,
if (success) if (success)
{ {
if (yposition <= image->height) if (yposition <= gimp_image_get_height (image))
{ {
GimpGuide *g; GimpGuide *g;
@ -93,7 +93,7 @@ image_add_vguide_invoker (GimpProcedure *procedure,
if (success) if (success)
{ {
if (xposition <= image->width) if (xposition <= gimp_image_get_width (image))
{ {
GimpGuide *g; GimpGuide *g;

View file

@ -422,10 +422,10 @@ image_crop_invoker (GimpProcedure *procedure,
if (success) if (success)
{ {
if (new_width > image->width || if (new_width > gimp_image_get_width (image) ||
new_height > image->height || new_height > gimp_image_get_height (image) ||
offx > (image->width - new_width) || offx > (gimp_image_get_width (image) - new_width) ||
offy > (image->height - new_height)) offy > (gimp_image_get_height (image) - new_height))
success = FALSE; success = FALSE;
else else
gimp_image_crop (image, context, gimp_image_crop (image, context,

View file

@ -967,34 +967,25 @@ do_alignment (GtkWidget *widget,
break; break;
case GIMP_ALIGN_REFERENCE_SELECTION: case GIMP_ALIGN_REFERENCE_SELECTION:
if (image->selection_mask) reference_object = G_OBJECT (gimp_image_get_mask (image));
{
reference_object = G_OBJECT (image->selection_mask);
}
else
return;
break; break;
case GIMP_ALIGN_REFERENCE_ACTIVE_LAYER: case GIMP_ALIGN_REFERENCE_ACTIVE_LAYER:
if (image->active_layer) reference_object = G_OBJECT (gimp_image_get_active_layer (image));
reference_object = G_OBJECT (image->active_layer);
else
return;
break; break;
case GIMP_ALIGN_REFERENCE_ACTIVE_CHANNEL: case GIMP_ALIGN_REFERENCE_ACTIVE_CHANNEL:
if (image->active_channel) reference_object = G_OBJECT (gimp_image_get_active_channel (image));
reference_object = G_OBJECT (image->active_channel);
else
return;
break; break;
case GIMP_ALIGN_REFERENCE_ACTIVE_PATH: case GIMP_ALIGN_REFERENCE_ACTIVE_PATH:
g_print ("reference = active path not yet handled.\n"); g_print ("reference = active path not yet handled.\n");
return;
break; break;
} }
if (! reference_object)
return;
gimp_draw_tool_pause (GIMP_DRAW_TOOL (align_tool)); gimp_draw_tool_pause (GIMP_DRAW_TOOL (align_tool));
gimp_image_arrange_objects (image, list, gimp_image_arrange_objects (image, list,

View file

@ -558,15 +558,17 @@ gimp_color_tool_draw (GimpDrawTool *draw_tool)
if (color_tool->sample_point_x != -1 && if (color_tool->sample_point_x != -1 &&
color_tool->sample_point_y != -1) color_tool->sample_point_y != -1)
{ {
GimpImage *image = draw_tool->display->image;
gimp_draw_tool_draw_line (draw_tool, gimp_draw_tool_draw_line (draw_tool,
0, color_tool->sample_point_y + 0.5, 0, color_tool->sample_point_y + 0.5,
draw_tool->display->image->width, gimp_image_get_width (image),
color_tool->sample_point_y + 0.5, color_tool->sample_point_y + 0.5,
FALSE); FALSE);
gimp_draw_tool_draw_line (draw_tool, gimp_draw_tool_draw_line (draw_tool,
color_tool->sample_point_x + 0.5, 0, color_tool->sample_point_x + 0.5, 0,
color_tool->sample_point_x + 0.5, color_tool->sample_point_x + 0.5,
draw_tool->display->image->height, gimp_image_get_height (image),
FALSE); FALSE);
} }
} }

View file

@ -236,8 +236,8 @@ gimp_edit_selection_tool_start (GimpTool *parent_tool,
{ {
edit_select->x1 = 0; edit_select->x1 = 0;
edit_select->y1 = 0; edit_select->y1 = 0;
edit_select->x2 = display->image->width; edit_select->x2 = gimp_image_get_width (display->image);
edit_select->y2 = display->image->height; edit_select->y2 = gimp_image_get_height (display->image);
} }
else else
{ {

View file

@ -440,8 +440,10 @@ gimp_iscissors_tool_button_press (GimpTool *tool,
&iscissors->x, &iscissors->x,
&iscissors->y); &iscissors->y);
iscissors->x = CLAMP (iscissors->x, 0, display->image->width - 1); iscissors->x = CLAMP (iscissors->x,
iscissors->y = CLAMP (iscissors->y, 0, display->image->height - 1); 0, gimp_image_get_width (display->image) - 1);
iscissors->y = CLAMP (iscissors->y,
0, gimp_image_get_height (display->image) - 1);
iscissors->ix = iscissors->x; iscissors->ix = iscissors->x;
iscissors->iy = iscissors->y; iscissors->iy = iscissors->y;
@ -530,8 +532,8 @@ iscissors_convert (GimpIscissorsTool *iscissors,
g_object_unref (iscissors->mask); g_object_unref (iscissors->mask);
iscissors->mask = gimp_channel_new_mask (display->image, iscissors->mask = gimp_channel_new_mask (display->image,
display->image->width, gimp_image_get_width (display->image),
display->image->height); gimp_image_get_height (display->image));
gimp_scan_convert_render (sc, gimp_scan_convert_render (sc,
gimp_drawable_get_tiles (GIMP_DRAWABLE (iscissors->mask)), gimp_drawable_get_tiles (GIMP_DRAWABLE (iscissors->mask)),
0, 0, options->antialias); 0, 0, options->antialias);
@ -693,8 +695,10 @@ gimp_iscissors_tool_motion (GimpTool *tool,
find_max_gradient (iscissors, display->image, find_max_gradient (iscissors, display->image,
&iscissors->x, &iscissors->y); &iscissors->x, &iscissors->y);
iscissors->x = CLAMP (iscissors->x, 0, display->image->width - 1); iscissors->x = CLAMP (iscissors->x,
iscissors->y = CLAMP (iscissors->y, 0, display->image->height - 1); 0, gimp_image_get_width (display->image) - 1);
iscissors->y = CLAMP (iscissors->y,
0, gimp_image_get_height (display->image) - 1);
if (iscissors->first_point) if (iscissors->first_point)
{ {
@ -709,8 +713,10 @@ gimp_iscissors_tool_motion (GimpTool *tool,
find_max_gradient (iscissors, display->image, find_max_gradient (iscissors, display->image,
&iscissors->x, &iscissors->y); &iscissors->x, &iscissors->y);
iscissors->x = CLAMP (iscissors->x, 0, display->image->width - 1); iscissors->x = CLAMP (iscissors->x,
iscissors->y = CLAMP (iscissors->y, 0, display->image->height - 1); 0, gimp_image_get_width (display->image) - 1);
iscissors->y = CLAMP (iscissors->y,
0, gimp_image_get_height (display->image) - 1);
iscissors->nx = iscissors->x; iscissors->nx = iscissors->x;
iscissors->ny = iscissors->y; iscissors->ny = iscissors->y;
@ -1358,10 +1364,10 @@ calculate_curve (GimpTool *tool,
display = tool->display; display = tool->display;
/* Get the bounding box */ /* Get the bounding box */
xs = CLAMP (curve->x1, 0, display->image->width - 1); xs = CLAMP (curve->x1, 0, gimp_image_get_width (display->image) - 1);
ys = CLAMP (curve->y1, 0, display->image->height - 1); ys = CLAMP (curve->y1, 0, gimp_image_get_height (display->image) - 1);
xe = CLAMP (curve->x2, 0, display->image->width - 1); xe = CLAMP (curve->x2, 0, gimp_image_get_width (display->image) - 1);
ye = CLAMP (curve->y2, 0, display->image->height - 1); ye = CLAMP (curve->y2, 0, gimp_image_get_height (display->image) - 1);
x1 = MIN (xs, xe); x1 = MIN (xs, xe);
y1 = MIN (ys, ye); y1 = MIN (ys, ye);
x2 = MAX (xs, xe) + 1; /* +1 because if xe = 199 & xs = 0, x2 - x1, width = 200 */ x2 = MAX (xs, xe) + 1; /* +1 because if xe = 199 & xs = 0, x2 - x1, width = 200 */
@ -1378,11 +1384,12 @@ calculate_curve (GimpTool *tool,
eheight = (y2 - y1) * EXTEND_BY + FIXED; eheight = (y2 - y1) * EXTEND_BY + FIXED;
if (xe >= xs) if (xe >= xs)
x2 += CLAMP (ewidth, 0, display->image->width - x2); x2 += CLAMP (ewidth, 0, gimp_image_get_width (display->image) - x2);
else else
x1 -= CLAMP (ewidth, 0, x1); x1 -= CLAMP (ewidth, 0, x1);
if (ye >= ys) if (ye >= ys)
y2 += CLAMP (eheight, 0, display->image->height - y2); y2 += CLAMP (eheight, 0, gimp_image_get_height (display->image) - y2);
else else
y1 -= CLAMP (eheight, 0, y1); y1 -= CLAMP (eheight, 0, y1);
@ -1861,7 +1868,8 @@ gradient_map_new (GimpImage *image)
{ {
TileManager *tm; TileManager *tm;
tm = tile_manager_new (image->width, image->height, tm = tile_manager_new (gimp_image_get_width (image),
gimp_image_get_height (image),
sizeof (guint8) * COST_WIDTH); sizeof (guint8) * COST_WIDTH);
tile_manager_set_validate_proc (tm, tile_manager_set_validate_proc (tm,
@ -1894,14 +1902,14 @@ find_max_gradient (GimpIscissorsTool *iscissors,
radius = GRADIENT_SEARCH >> 1; radius = GRADIENT_SEARCH >> 1;
/* calculate the extent of the search */ /* calculate the extent of the search */
cx = CLAMP (*x, 0, image->width); cx = CLAMP (*x, 0, gimp_image_get_width (image));
cy = CLAMP (*y, 0, image->height); cy = CLAMP (*y, 0, gimp_image_get_height (image));
sx = cx - radius; sx = cx - radius;
sy = cy - radius; sy = cy - radius;
x1 = CLAMP (cx - radius, 0, image->width); x1 = CLAMP (cx - radius, 0, gimp_image_get_width (image));
y1 = CLAMP (cy - radius, 0, image->height); y1 = CLAMP (cy - radius, 0, gimp_image_get_height (image));
x2 = CLAMP (cx + radius, 0, image->width); x2 = CLAMP (cx + radius, 0, gimp_image_get_width (image));
y2 = CLAMP (cy + radius, 0, image->height); y2 = CLAMP (cy + radius, 0, gimp_image_get_height (image));
/* calculate the factor to multiply the distance from the cursor by */ /* calculate the factor to multiply the distance from the cursor by */
max_gradient = 0; max_gradient = 0;

View file

@ -224,13 +224,13 @@ gimp_measure_tool_button_press (GimpTool *tool,
(measure->y[i] == (measure->y[i] ==
CLAMP (measure->y[i], CLAMP (measure->y[i],
0, 0,
display->image->height))); gimp_image_get_height (display->image))));
create_vguide = ((state & GDK_MOD1_MASK) && create_vguide = ((state & GDK_MOD1_MASK) &&
(measure->x[i] == (measure->x[i] ==
CLAMP (measure->x[i], CLAMP (measure->x[i],
0, 0,
display->image->width))); gimp_image_get_width (display->image))));
if (create_hguide && create_vguide) if (create_hguide && create_vguide)
gimp_image_undo_group_start (display->image, gimp_image_undo_group_start (display->image,

View file

@ -762,12 +762,14 @@ gimp_move_tool_draw (GimpDrawTool *draw_tool)
if (move->moving_guide && move->guide_position != -1) if (move->moving_guide && move->guide_position != -1)
{ {
GimpImage *image = draw_tool->display->image;
switch (move->guide_orientation) switch (move->guide_orientation)
{ {
case GIMP_ORIENTATION_HORIZONTAL: case GIMP_ORIENTATION_HORIZONTAL:
gimp_draw_tool_draw_line (draw_tool, gimp_draw_tool_draw_line (draw_tool,
0, move->guide_position, 0, move->guide_position,
draw_tool->display->image->width, gimp_image_get_width (image),
move->guide_position, move->guide_position,
FALSE); FALSE);
break; break;
@ -776,7 +778,7 @@ gimp_move_tool_draw (GimpDrawTool *draw_tool)
gimp_draw_tool_draw_line (draw_tool, gimp_draw_tool_draw_line (draw_tool,
move->guide_position, 0, move->guide_position, 0,
move->guide_position, move->guide_position,
draw_tool->display->image->height, gimp_image_get_height (image),
FALSE); FALSE);
break; break;

View file

@ -876,8 +876,8 @@ gimp_perspective_clone_tool_bounds (GimpPerspectiveCloneTool *tool,
tool->x1 = 0; tool->x1 = 0;
tool->y1 = 0; tool->y1 = 0;
tool->x2 = display->image->width; tool->x2 = gimp_image_get_width (display->image);
tool->y2 = display->image->height; tool->y2 = gimp_image_get_height (display->image);
} }
static void static void

View file

@ -579,9 +579,12 @@ gimp_rect_select_tool_select (GimpRectangleTool *rectangle,
gimp_tool_pop_status (tool, tool->display); gimp_tool_pop_status (tool, tool->display);
rectangle_exists = (x <= image->width && y <= image->height && rectangle_exists = (x <= gimp_image_get_width (image) &&
x + w >= 0 && y + h >= 0 && y <= gimp_image_get_height (image) &&
w > 0 && h > 0); x + w >= 0 &&
y + h >= 0 &&
w > 0 &&
h > 0);
if (priv->use_saved_op) if (priv->use_saved_op)
operation = priv->operation; operation = priv->operation;

View file

@ -611,8 +611,8 @@ gimp_rectangle_tool_constraint_size_set (GimpRectangleTool *rect_tool,
case GIMP_RECTANGLE_CONSTRAIN_IMAGE: case GIMP_RECTANGLE_CONSTRAIN_IMAGE:
default: default:
{ {
width = image->width; width = gimp_image_get_width (image);
height = image->height; height = gimp_image_get_height (image);
} }
break; break;
} }
@ -1935,7 +1935,7 @@ gimp_rectangle_tool_start (GimpRectangleTool *rect_tool,
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (options_private->fixed_width_entry), gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (options_private->fixed_width_entry),
0, display->image->xresolution, FALSE); 0, display->image->xresolution, FALSE);
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (options_private->fixed_width_entry), gimp_size_entry_set_size (GIMP_SIZE_ENTRY (options_private->fixed_width_entry),
0, 0, display->image->width); 0, 0, gimp_image_get_width (display->image));
} }
if (options_private->fixed_height_entry) if (options_private->fixed_height_entry)
@ -1943,7 +1943,7 @@ gimp_rectangle_tool_start (GimpRectangleTool *rect_tool,
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (options_private->fixed_height_entry), gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (options_private->fixed_height_entry),
0, display->image->yresolution, FALSE); 0, display->image->yresolution, FALSE);
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (options_private->fixed_height_entry), gimp_size_entry_set_size (GIMP_SIZE_ENTRY (options_private->fixed_height_entry),
0, 0, display->image->height); 0, 0, gimp_image_get_height (display->image));
} }
if (options_private->x_entry) if (options_private->x_entry)
@ -1951,7 +1951,7 @@ gimp_rectangle_tool_start (GimpRectangleTool *rect_tool,
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (options_private->x_entry), gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (options_private->x_entry),
0, display->image->xresolution, FALSE); 0, display->image->xresolution, FALSE);
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (options_private->x_entry), gimp_size_entry_set_size (GIMP_SIZE_ENTRY (options_private->x_entry),
0, 0, display->image->width); 0, 0, gimp_image_get_width (display->image));
} }
if (options_private->y_entry) if (options_private->y_entry)
@ -1959,7 +1959,7 @@ gimp_rectangle_tool_start (GimpRectangleTool *rect_tool,
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (options_private->y_entry), gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (options_private->y_entry),
0, display->image->yresolution, FALSE); 0, display->image->yresolution, FALSE);
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (options_private->y_entry), gimp_size_entry_set_size (GIMP_SIZE_ENTRY (options_private->y_entry),
0, 0, display->image->height); 0, 0, gimp_image_get_height (display->image));
} }
if (options_private->width_entry) if (options_private->width_entry)
@ -1967,7 +1967,7 @@ gimp_rectangle_tool_start (GimpRectangleTool *rect_tool,
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (options_private->width_entry), gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (options_private->width_entry),
0, display->image->xresolution, FALSE); 0, display->image->xresolution, FALSE);
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (options_private->width_entry), gimp_size_entry_set_size (GIMP_SIZE_ENTRY (options_private->width_entry),
0, 0, display->image->width); 0, 0, gimp_image_get_width (display->image));
} }
if (options_private->height_entry) if (options_private->height_entry)
@ -1975,7 +1975,7 @@ gimp_rectangle_tool_start (GimpRectangleTool *rect_tool,
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (options_private->height_entry), gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (options_private->height_entry),
0, display->image->yresolution, FALSE); 0, display->image->yresolution, FALSE);
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (options_private->height_entry), gimp_size_entry_set_size (GIMP_SIZE_ENTRY (options_private->height_entry),
0, 0, display->image->height); 0, 0, gimp_image_get_height (display->image));
} }
if (options_private->auto_shrink_button) if (options_private->auto_shrink_button)
@ -2409,8 +2409,8 @@ gimp_rectangle_tool_auto_shrink (GimpRectangleTool *rect_tool)
if (! display) if (! display)
return; return;
width = display->image->width; width = gimp_image_get_width (display->image);
height = display->image->height; height = gimp_image_get_height (display->image);
g_object_get (gimp_tool_get_options (tool), g_object_get (gimp_tool_get_options (tool),
"shrink-merged", &shrink_merged, "shrink-merged", &shrink_merged,
@ -3815,8 +3815,8 @@ gimp_rectangle_tool_apply_fixed_rule (GimpRectangleTool *rect_tool)
aspect = CLAMP (options_private->aspect_numerator / aspect = CLAMP (options_private->aspect_numerator /
options_private->aspect_denominator, options_private->aspect_denominator,
1.0 / tool->display->image->height, 1.0 / gimp_image_get_height (tool->display->image),
tool->display->image->width); gimp_image_get_width (tool->display->image));
if (constraint_to_use == GIMP_RECTANGLE_CONSTRAIN_NONE) if (constraint_to_use == GIMP_RECTANGLE_CONSTRAIN_NONE)
{ {
@ -3928,8 +3928,8 @@ gimp_rectangle_tool_get_constraints (GimpRectangleTool *rect_tool,
case GIMP_RECTANGLE_CONSTRAIN_IMAGE: case GIMP_RECTANGLE_CONSTRAIN_IMAGE:
*min_x = 0; *min_x = 0;
*min_y = 0; *min_y = 0;
*max_x = tool->display->image->width; *max_x = gimp_image_get_width (tool->display->image);
*max_y = tool->display->image->height; *max_y = gimp_image_get_height (tool->display->image);
break; break;
case GIMP_RECTANGLE_CONSTRAIN_DRAWABLE: case GIMP_RECTANGLE_CONSTRAIN_DRAWABLE:

View file

@ -218,10 +218,12 @@ gimp_rotate_tool_prepare (GimpTransformTool *tr_tool,
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (rotate->sizeentry), 0, gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (rotate->sizeentry), 0,
-65536, -65536,
65536 + display->image->width); 65536 +
gimp_image_get_width (display->image));
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (rotate->sizeentry), 1, gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (rotate->sizeentry), 1,
-65536, -65536,
65536 + display->image->height); 65536 +
gimp_image_get_height (display->image));
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (rotate->sizeentry), 0, gimp_size_entry_set_size (GIMP_SIZE_ENTRY (rotate->sizeentry), 0,
tr_tool->x1, tr_tool->x2); tr_tool->x1, tr_tool->x2);

View file

@ -139,7 +139,8 @@ gimp_vectors_export (const GimpImage *image,
g_string_append_printf (str, g_string_append_printf (str,
" viewBox=\"0 0 %d %d\">\n", " viewBox=\"0 0 %d %d\">\n",
image->width, image->height); gimp_image_get_width (image),
gimp_image_get_height (image));
if (vectors) if (vectors)
{ {
@ -168,8 +169,8 @@ gimp_vectors_export_image_size (const GimpImage *image,
gchar hbuf[G_ASCII_DTOSTR_BUF_SIZE]; gchar hbuf[G_ASCII_DTOSTR_BUF_SIZE];
gdouble w, h; gdouble w, h;
w = (gdouble) image->width / image->xresolution; w = (gdouble) gimp_image_get_width (image) / image->xresolution;
h = (gdouble) image->height / image->yresolution; h = (gdouble) gimp_image_get_height (image) / image->yresolution;
/* FIXME: should probably use the display unit here */ /* FIXME: should probably use the display unit here */
unit = gimp_image_get_unit (image); unit = gimp_image_get_unit (image);

View file

@ -268,8 +268,8 @@ gimp_vectors_import (GimpImage *image,
/* the base of the stack, defines the size of the view-port */ /* the base of the stack, defines the size of the view-port */
base = g_slice_new0 (SvgHandler); base = g_slice_new0 (SvgHandler);
base->name = "image"; base->name = "image";
base->width = image->width; base->width = gimp_image_get_width (image);
base->height = image->height; base->height = gimp_image_get_height (image);
g_queue_push_head (parser.stack, base); g_queue_push_head (parser.stack, base);
@ -533,8 +533,8 @@ svg_handler_svg_start (SvgHandler *handler,
{ {
if (w > 0.0 && h > 0.0) if (w > 0.0 && h > 0.0)
gimp_matrix3_scale (matrix, gimp_matrix3_scale (matrix,
parser->image->width / w, gimp_image_get_width (parser->image) / w,
parser->image->height / h); gimp_image_get_height (parser->image) / h);
} }
handler->width = w; handler->width = w;

View file

@ -296,8 +296,8 @@ static void
gimp_vectors_convert (GimpItem *item, gimp_vectors_convert (GimpItem *item,
GimpImage *dest_image) GimpImage *dest_image)
{ {
item->width = dest_image->width; item->width = gimp_image_get_width (dest_image);
item->height = dest_image->height; item->height = gimp_image_get_height (dest_image);
GIMP_ITEM_CLASS (parent_class)->convert (item, dest_image); GIMP_ITEM_CLASS (parent_class)->convert (item, dest_image);
} }
@ -356,8 +356,11 @@ gimp_vectors_scale (GimpItem *item,
gimp_stroke_translate (stroke, new_offset_x, new_offset_y); gimp_stroke_translate (stroke, new_offset_x, new_offset_y);
} }
GIMP_ITEM_CLASS (parent_class)->scale (item, image->width, image->height, GIMP_ITEM_CLASS (parent_class)->scale (item,
0, 0, interpolation_type, progress); gimp_image_get_width (image),
gimp_image_get_height (image),
0, 0,
interpolation_type, progress);
gimp_vectors_thaw (vectors); gimp_vectors_thaw (vectors);
} }
@ -387,7 +390,9 @@ gimp_vectors_resize (GimpItem *item,
} }
GIMP_ITEM_CLASS (parent_class)->resize (item, context, GIMP_ITEM_CLASS (parent_class)->resize (item, context,
image->width, image->height, 0, 0); gimp_image_get_width (image),
gimp_image_get_height (image),
0, 0);
gimp_vectors_thaw (vectors); gimp_vectors_thaw (vectors);
} }
@ -552,7 +557,9 @@ gimp_vectors_new (GimpImage *image,
vectors = g_object_new (GIMP_TYPE_VECTORS, NULL); vectors = g_object_new (GIMP_TYPE_VECTORS, NULL);
gimp_item_configure (GIMP_ITEM (vectors), image, gimp_item_configure (GIMP_ITEM (vectors), image,
0, 0, image->width, image->height, 0, 0,
gimp_image_get_width (image),
gimp_image_get_height (image),
name); name);
return vectors; return vectors;

View file

@ -39,6 +39,7 @@
#include "core/gimp.h" #include "core/gimp.h"
#include "core/gimpcontainer.h" #include "core/gimpcontainer.h"
#include "core/gimpimage.h" #include "core/gimpimage.h"
#include "core/gimpimage-colormap.h"
#include "core/gimpundostack.h" #include "core/gimpundostack.h"
#include "core/gimpunit.h" #include "core/gimpunit.h"
#include "core/gimp-utils.h" #include "core/gimp-utils.h"
@ -439,8 +440,10 @@ gimp_image_prop_view_update (GimpImagePropView *view)
/* pixel size */ /* pixel size */
g_snprintf (buf, sizeof (buf), ngettext ("%d × %d pixel", g_snprintf (buf, sizeof (buf), ngettext ("%d × %d pixel",
"%d × %d pixels", image->height), "%d × %d pixels",
image->width, image->height); gimp_image_get_height (image)),
gimp_image_get_width (image),
gimp_image_get_height (image));
gtk_label_set_text (GTK_LABEL (view->pixel_size_label), buf); gtk_label_set_text (GTK_LABEL (view->pixel_size_label), buf);
/* print size */ /* print size */
@ -453,8 +456,8 @@ gimp_image_prop_view_update (GimpImagePropView *view)
unit_digits + 1, unit_digits + 1, unit_digits + 1, unit_digits + 1,
_gimp_unit_get_plural (image->gimp, unit)); _gimp_unit_get_plural (image->gimp, unit));
g_snprintf (buf, sizeof (buf), format_buf, g_snprintf (buf, sizeof (buf), format_buf,
image->width * unit_factor / image->xresolution, gimp_image_get_width (image) * unit_factor / image->xresolution,
image->height * unit_factor / image->yresolution); gimp_image_get_height (image) * unit_factor / image->yresolution);
gtk_label_set_text (GTK_LABEL (view->print_size_label), buf); gtk_label_set_text (GTK_LABEL (view->print_size_label), buf);
/* resolution */ /* resolution */
@ -483,7 +486,8 @@ gimp_image_prop_view_update (GimpImagePropView *view)
break; break;
case GIMP_INDEXED: case GIMP_INDEXED:
g_snprintf (buf, sizeof (buf), g_snprintf (buf, sizeof (buf),
"%s (%d %s)", desc, image->num_cols, _("colors")); "%s (%d %s)", desc, gimp_image_get_colormap_size (image),
_("colors"));
break; break;
} }
@ -498,7 +502,9 @@ gimp_image_prop_view_update (GimpImagePropView *view)
gimp_image_prop_view_label_set_undo (view->redo_label, image->redo_stack); gimp_image_prop_view_label_set_undo (view->redo_label, image->redo_stack);
/* number of layers */ /* number of layers */
g_snprintf (buf, sizeof (buf), "%d", image->width * image->height); g_snprintf (buf, sizeof (buf), "%d",
gimp_image_get_width (image) *
gimp_image_get_height (image));
gtk_label_set_text (GTK_LABEL (view->pixels_label), buf); gtk_label_set_text (GTK_LABEL (view->pixels_label), buf);
/* number of layers */ /* number of layers */

View file

@ -225,13 +225,13 @@ gimp_navigation_view_move_to (GimpNavigationView *nav_view,
/* transform to image coordinates */ /* transform to image coordinates */
if (view->renderer->width != nav_view->p_width) if (view->renderer->width != nav_view->p_width)
ratiox = ((image->width - nav_view->width + 1.0) / ratiox = ((gimp_image_get_width (image) - nav_view->width + 1.0) /
(view->renderer->width - nav_view->p_width)); (view->renderer->width - nav_view->p_width));
else else
ratiox = 1.0; ratiox = 1.0;
if (view->renderer->height != nav_view->p_height) if (view->renderer->height != nav_view->p_height)
ratioy = ((image->height - nav_view->height + 1.0) / ratioy = ((gimp_image_get_height (image) - nav_view->height + 1.0) /
(view->renderer->height - nav_view->p_height)); (view->renderer->height - nav_view->p_height));
else else
ratioy = 1.0; ratioy = 1.0;
@ -481,8 +481,10 @@ gimp_navigation_view_transform (GimpNavigationView *nav_view)
image = GIMP_IMAGE (view->renderer->viewable); image = GIMP_IMAGE (view->renderer->viewable);
ratiox = ((gdouble) view->renderer->width / (gdouble) image->width); ratiox = ((gdouble) view->renderer->width /
ratioy = ((gdouble) view->renderer->height / (gdouble) image->height); (gdouble) gimp_image_get_width (image));
ratioy = ((gdouble) view->renderer->height /
(gdouble) gimp_image_get_height (image));
nav_view->p_x = RINT (nav_view->x * ratiox); nav_view->p_x = RINT (nav_view->x * ratiox);
nav_view->p_y = RINT (nav_view->y * ratioy); nav_view->p_y = RINT (nav_view->y * ratioy);
@ -507,8 +509,8 @@ gimp_navigation_view_draw_marker (GimpNavigationView *nav_view,
if (nav_view->x > 0 || if (nav_view->x > 0 ||
nav_view->y > 0 || nav_view->y > 0 ||
nav_view->width < image->width || nav_view->width < gimp_image_get_width (image) ||
nav_view->height < image->height) nav_view->height < gimp_image_get_height (image))
{ {
GtkWidget *widget = GTK_WIDGET (view); GtkWidget *widget = GTK_WIDGET (view);
@ -550,17 +552,19 @@ gimp_navigation_view_set_marker (GimpNavigationView *nav_view,
if (GTK_WIDGET_DRAWABLE (view)) if (GTK_WIDGET_DRAWABLE (view))
gimp_navigation_view_draw_marker (nav_view, NULL); gimp_navigation_view_draw_marker (nav_view, NULL);
nav_view->x = CLAMP (x, 0.0, image->width - 1.0); nav_view->x = CLAMP (x, 0.0, gimp_image_get_width (image) - 1.0);
nav_view->y = CLAMP (y, 0.0, image->height - 1.0); nav_view->y = CLAMP (y, 0.0, gimp_image_get_height (image) - 1.0);
if (width < 0.0) if (width < 0.0)
width = image->width; width = gimp_image_get_width (image);
if (height < 0.0) if (height < 0.0)
height = image->height; height = gimp_image_get_height (image);
nav_view->width = CLAMP (width, 1.0, image->width - nav_view->x); nav_view->width = CLAMP (width, 1.0,
nav_view->height = CLAMP (height, 1.0, image->height - nav_view->y); gimp_image_get_width (image) - nav_view->x);
nav_view->height = CLAMP (height, 1.0,
gimp_image_get_height (image) - nav_view->y);
gimp_navigation_view_transform (nav_view); gimp_navigation_view_transform (nav_view);

View file

@ -294,8 +294,8 @@ gimp_selection_view_button_press (GtkWidget *widget,
operation = GIMP_CHANNEL_OP_SUBTRACT; operation = GIMP_CHANNEL_OP_SUBTRACT;
} }
x = image_editor->image->width * bevent->x / renderer->width; x = gimp_image_get_width (image_editor->image) * bevent->x / renderer->width;
y = image_editor->image->height * bevent->y / renderer->height; y = gimp_image_get_height (image_editor->image) * bevent->y / renderer->height;
if (gimp_image_pick_color (image_editor->image, drawable, x, y, if (gimp_image_pick_color (image_editor->image, drawable, x, y,
options->sample_merged, options->sample_merged,

View file

@ -83,9 +83,11 @@ gimp_view_renderer_drawable_render (GimpViewRenderer *renderer,
if (image && ! renderer->is_popup) if (image && ! renderer->is_popup)
{ {
width = MAX (1, ROUND ((((gdouble) width / (gdouble) image->width) * width = MAX (1, ROUND ((((gdouble) width /
(gdouble) gimp_image_get_width (image)) *
(gdouble) gimp_item_width (item)))); (gdouble) gimp_item_width (item))));
height = MAX (1, ROUND ((((gdouble) height / (gdouble) image->height) * height = MAX (1, ROUND ((((gdouble) height /
(gdouble) gimp_image_get_height (image)) *
(gdouble) gimp_item_height (item)))); (gdouble) gimp_item_height (item))));
gimp_viewable_calc_preview_size (gimp_item_width (item), gimp_viewable_calc_preview_size (gimp_item_width (item),
@ -128,7 +130,8 @@ gimp_view_renderer_drawable_render (GimpViewRenderer *renderer,
gimp_item_width (item), gimp_item_width (item),
gimp_item_height (item), gimp_item_height (item),
-item->offset_x, -item->offset_y, -item->offset_x, -item->offset_y,
image->width, image->height, gimp_image_get_width (image),
gimp_image_get_height (image),
&src_x, &src_y, &src_x, &src_y,
&src_width, &src_height)) &src_width, &src_height))
{ {
@ -136,10 +139,10 @@ gimp_view_renderer_drawable_render (GimpViewRenderer *renderer,
gint dest_height; gint dest_height;
dest_width = ROUND (((gdouble) renderer->width / dest_width = ROUND (((gdouble) renderer->width /
(gdouble) image->width) * (gdouble) gimp_image_get_width (image)) *
(gdouble) src_width); (gdouble) src_width);
dest_height = ROUND (((gdouble) renderer->height / dest_height = ROUND (((gdouble) renderer->height /
(gdouble) image->height) * (gdouble) gimp_image_get_height (image)) *
(gdouble) src_height); (gdouble) src_height);
if (dest_width < 1) dest_width = 1; if (dest_width < 1) dest_width = 1;
@ -189,12 +192,14 @@ gimp_view_renderer_drawable_render (GimpViewRenderer *renderer,
{ {
if (item->offset_x != 0) if (item->offset_x != 0)
render_buf->x = render_buf->x =
ROUND ((((gdouble) renderer->width / (gdouble) image->width) * ROUND ((((gdouble) renderer->width /
(gdouble) gimp_image_get_width (image)) *
(gdouble) item->offset_x)); (gdouble) item->offset_x));
if (item->offset_y != 0) if (item->offset_y != 0)
render_buf->y = render_buf->y =
ROUND ((((gdouble) renderer->height / (gdouble) image->height) * ROUND ((((gdouble) renderer->height /
(gdouble) gimp_image_get_height (image)) *
(gdouble) item->offset_y)); (gdouble) item->offset_y));
if (scaling_up) if (scaling_up)

View file

@ -80,8 +80,8 @@ gimp_view_renderer_image_render (GimpViewRenderer *renderer,
gboolean scaling_up; gboolean scaling_up;
TempBuf *render_buf = NULL; TempBuf *render_buf = NULL;
gimp_viewable_calc_preview_size (image->width, gimp_viewable_calc_preview_size (gimp_image_get_width (image),
image->height, gimp_image_get_height (image),
renderer->width, renderer->width,
renderer->height, renderer->height,
renderer->dot_for_dot, renderer->dot_for_dot,
@ -97,8 +97,8 @@ gimp_view_renderer_image_render (GimpViewRenderer *renderer,
temp_buf = gimp_viewable_get_new_preview (renderer->viewable, temp_buf = gimp_viewable_get_new_preview (renderer->viewable,
renderer->context, renderer->context,
image->width, gimp_image_get_width (image),
image->height); gimp_image_get_height (image));
if (temp_buf) if (temp_buf)
{ {

View file

@ -239,7 +239,7 @@ xcf_load_image (Gimp *gimp,
xcf_progress_update (info); xcf_progress_update (info);
/* add the channel to the image if its not the selection */ /* add the channel to the image if its not the selection */
if (channel != image->selection_mask) if (channel != gimp_image_get_mask (image))
gimp_image_add_channel (image, channel, gimp_image_add_channel (image, channel,
gimp_container_num_children (image->channels)); gimp_container_num_children (image->channels));
@ -786,21 +786,26 @@ xcf_load_channel_props (XcfInfo *info,
break; break;
case PROP_SELECTION: case PROP_SELECTION:
g_object_unref (image->selection_mask); {
image->selection_mask = GimpChannel *mask;
g_object_unref (gimp_image_get_mask (image));
mask = image->selection_mask =
gimp_selection_new (image, gimp_selection_new (image,
gimp_item_width (GIMP_ITEM (*channel)), gimp_item_width (GIMP_ITEM (*channel)),
gimp_item_height (GIMP_ITEM (*channel))); gimp_item_height (GIMP_ITEM (*channel)));
g_object_ref_sink (image->selection_mask); g_object_ref_sink (mask);
tile_manager_unref (GIMP_DRAWABLE (image->selection_mask)->tiles); tile_manager_unref (GIMP_DRAWABLE (mask)->tiles);
GIMP_DRAWABLE (image->selection_mask)->tiles = GIMP_DRAWABLE (mask)->tiles =
GIMP_DRAWABLE (*channel)->tiles; GIMP_DRAWABLE (*channel)->tiles;
GIMP_DRAWABLE (*channel)->tiles = NULL; GIMP_DRAWABLE (*channel)->tiles = NULL;
g_object_unref (*channel); g_object_unref (*channel);
*channel = image->selection_mask; *channel = mask;
(*channel)->boundary_known = FALSE; (*channel)->boundary_known = FALSE;
(*channel)->bounds_known = FALSE; (*channel)->bounds_known = FALSE;
}
break; break;
case PROP_OPACITY: case PROP_OPACITY:

View file

@ -183,7 +183,7 @@ xcf_save_choose_format (XcfInfo *info,
GList *list; GList *list;
gint save_version = 0; /* default to oldest */ gint save_version = 0; /* default to oldest */
if (image->cmap) if (gimp_image_get_colormap (image))
save_version = 1; /* need version 1 for colormaps */ save_version = 1; /* need version 1 for colormaps */
for (list = GIMP_LIST (image->layers)->list; for (list = GIMP_LIST (image->layers)->list;
@ -248,10 +248,13 @@ xcf_save_image (XcfInfo *info,
xcf_write_int8_check_error (info, (guint8 *) version_tag, 14); xcf_write_int8_check_error (info, (guint8 *) version_tag, 14);
/* write out the width, height and image type information for the image */ /* write out the width, height and image type information for the image */
xcf_write_int32_check_error (info, (guint32 *) &image->width, 1); value = gimp_image_get_width (image);
xcf_write_int32_check_error (info, (guint32 *) &image->height, 1); xcf_write_int32_check_error (info, (guint32 *) &value, 1);
value = image->base_type; value = gimp_image_get_height (image);
xcf_write_int32_check_error (info, (guint32 *) &value, 1);
value = gimp_image_base_type (image);
xcf_write_int32_check_error (info, &value, 1); xcf_write_int32_check_error (info, &value, 1);
/* determine the number of layers and channels in the image */ /* determine the number of layers and channels in the image */
@ -337,7 +340,7 @@ xcf_save_image (XcfInfo *info,
} }
else else
{ {
channel = image->selection_mask; channel = gimp_image_get_mask (image);
have_selection = FALSE; have_selection = FALSE;
} }
@ -552,7 +555,7 @@ xcf_save_channel_props (XcfInfo *info,
if (channel == gimp_image_get_active_channel (image)) if (channel == gimp_image_get_active_channel (image))
xcf_check_error (xcf_save_prop (info, image, PROP_ACTIVE_CHANNEL, error)); xcf_check_error (xcf_save_prop (info, image, PROP_ACTIVE_CHANNEL, error));
if (channel == image->selection_mask) if (channel == gimp_image_get_mask (image))
xcf_check_error (xcf_save_prop (info, image, PROP_SELECTION, error)); xcf_check_error (xcf_save_prop (info, image, PROP_SELECTION, error));
xcf_check_error (xcf_save_prop (info, image, PROP_OPACITY, error, xcf_check_error (xcf_save_prop (info, image, PROP_OPACITY, error,

View file

@ -43,7 +43,7 @@ HELP
%invoke = ( %invoke = (
code => <<'CODE' code => <<'CODE'
{ {
if (yposition <= image->height) if (yposition <= gimp_image_get_height (image))
{ {
GimpGuide *g; GimpGuide *g;
@ -83,7 +83,7 @@ HELP
%invoke = ( %invoke = (
code => <<'CODE' code => <<'CODE'
{ {
if (xposition <= image->width) if (xposition <= gimp_image_get_width (image))
{ {
GimpGuide *g; GimpGuide *g;

View file

@ -320,10 +320,10 @@ HELP
headers => [ qw("core/gimpimage-crop.h") ], headers => [ qw("core/gimpimage-crop.h") ],
code => <<'CODE' code => <<'CODE'
{ {
if (new_width > image->width || if (new_width > gimp_image_get_width (image) ||
new_height > image->height || new_height > gimp_image_get_height (image) ||
offx > (image->width - new_width) || offx > (gimp_image_get_width (image) - new_width) ||
offy > (image->height - new_height)) offy > (gimp_image_get_height (image) - new_height))
success = FALSE; success = FALSE;
else else
gimp_image_crop (image, context, gimp_image_crop (image, context,