From 75061fccfd9ebb418be5462cf92c930f9459425c Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Tue, 25 Dec 2007 16:21:40 +0000 Subject: [PATCH] app/actions/channels-commands.c app/actions/colormap-actions.c 2007-12-25 Michael Natterer * 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 --- ChangeLog | 72 ++++++++++++++++++++++++ app/actions/channels-commands.c | 4 +- app/actions/colormap-actions.c | 3 +- app/actions/colormap-commands.c | 11 ++-- app/actions/image-commands.c | 24 ++++---- app/core/gimp-edit.c | 11 ++-- app/core/gimpdrawable-preview.c | 12 ++-- app/core/gimpimage-colorhash.c | 15 ++--- app/core/gimpimage-colormap.c | 2 +- app/core/gimpimage-convert.c | 29 +++++----- app/core/gimpimage-crop.c | 13 +++-- app/core/gimpimage-duplicate.c | 23 +++++--- app/core/gimpimage-flip.c | 16 ++++-- app/core/gimpimage-guides.c | 18 +++--- app/core/gimpimage-merge.c | 14 ++--- app/core/gimpimage-preview.c | 19 ++++--- app/core/gimpimage-quick-mask.c | 4 +- app/core/gimpimage-resize.c | 4 +- app/core/gimpimage-rotate.c | 56 ++++++++++-------- app/core/gimpimage-sample-points.c | 16 +++--- app/core/gimpimage-scale.c | 6 +- app/core/gimpimage-snap.c | 44 +++++++-------- app/core/gimpimage.c | 22 +++++--- app/core/gimpimagefile.c | 19 ++++--- app/core/gimpimageundo.c | 24 ++++---- app/core/gimpitem-preview.c | 4 +- app/core/gimpitem.c | 20 ++++--- app/core/gimplayer.c | 7 ++- app/core/gimppalette-import.c | 24 +++++--- app/core/gimpprojection-construct.c | 17 ++++-- app/core/gimpprojection.c | 41 +++++++++----- app/core/gimpselection.c | 16 +++--- app/core/gimpundo.c | 15 +++-- app/dialogs/layer-options-dialog.c | 8 +-- app/dialogs/print-size-dialog.c | 14 +++-- app/display/gimpdisplay.c | 24 +++++--- app/display/gimpdisplayshell-draw.c | 8 +-- app/display/gimpdisplayshell-scale.c | 12 ++-- app/display/gimpdisplayshell-scroll.c | 4 +- app/display/gimpdisplayshell-title.c | 10 ++-- app/display/gimpdisplayshell-transform.c | 6 +- app/display/gimpdisplayshell.c | 24 ++++---- app/display/gimpstatusbar.c | 12 ++-- app/file/file-open.c | 8 ++- app/paint/gimppaintoptions.c | 6 +- app/pdb/guides_cmds.c | 4 +- app/pdb/image_cmds.c | 8 +-- app/tools/gimpaligntool.c | 23 +++----- app/tools/gimpcolortool.c | 6 +- app/tools/gimpeditselectiontool.c | 4 +- app/tools/gimpiscissorstool.c | 50 +++++++++------- app/tools/gimpmeasuretool.c | 4 +- app/tools/gimpmovetool.c | 6 +- app/tools/gimpperspectiveclonetool.c | 4 +- app/tools/gimprectangleselecttool.c | 9 ++- app/tools/gimprectangletool.c | 28 ++++----- app/tools/gimprotatetool.c | 6 +- app/vectors/gimpvectors-export.c | 7 ++- app/vectors/gimpvectors-import.c | 8 +-- app/vectors/gimpvectors.c | 19 +++++-- app/widgets/gimpimagepropview.c | 18 ++++-- app/widgets/gimpnavigationview.c | 32 ++++++----- app/widgets/gimpselectioneditor.c | 4 +- app/widgets/gimpviewrendererdrawable.c | 19 ++++--- app/widgets/gimpviewrendererimage.c | 8 +-- app/xcf/xcf-load.c | 35 +++++++----- app/xcf/xcf-save.c | 15 +++-- tools/pdbgen/pdb/guides.pdb | 4 +- tools/pdbgen/pdb/image.pdb | 8 +-- 69 files changed, 646 insertions(+), 444 deletions(-) diff --git a/ChangeLog b/ChangeLog index d862ecfade..92e548c7fc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,75 @@ +2007-12-25 Michael Natterer + + * 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 * app/dialogs/file-save-dialog.c: forgot to port some debug output diff --git a/app/actions/channels-commands.c b/app/actions/channels-commands.c index 4d92d63151..8459ca3798 100644 --- a/app/actions/channels-commands.c +++ b/app/actions/channels-commands.c @@ -348,8 +348,8 @@ channels_new_channel_response (GtkWidget *widget, else { new_channel = gimp_channel_new (options->image, - options->image->width, - options->image->height, + gimp_image_get_width (options->image), + gimp_image_get_height (options->image), channel_name, &channel_color); diff --git a/app/actions/colormap-actions.c b/app/actions/colormap-actions.c index 81aa6fb00a..212ab0346f 100644 --- a/app/actions/colormap-actions.c +++ b/app/actions/colormap-actions.c @@ -26,6 +26,7 @@ #include "core/gimpcontext.h" #include "core/gimpimage.h" +#include "core/gimpimage-colormap.h" #include "widgets/gimpactiongroup.h" #include "widgets/gimphelp-ids.h" @@ -93,7 +94,7 @@ colormap_actions_update (GimpActionGroup *group, if (image) { indexed = gimp_image_base_type (image) == GIMP_INDEXED; - num_colors = image->num_cols; + num_colors = gimp_image_get_colormap_size (image); } if (context) diff --git a/app/actions/colormap-commands.c b/app/actions/colormap-commands.c index eb4a1bbdb5..44de3da5c5 100644 --- a/app/actions/colormap-commands.c +++ b/app/actions/colormap-commands.c @@ -55,16 +55,19 @@ colormap_edit_color_cmd_callback (GtkAction *action, { GimpColormapEditor *editor; GimpImage *image; + const guchar *colormap; GimpRGB color; gchar *desc; return_if_no_image (image, data); editor = GIMP_COLORMAP_EDITOR (data); + colormap = gimp_image_get_colormap (image); + gimp_rgba_set_uchar (&color, - image->cmap[editor->col_index * 3], - image->cmap[editor->col_index * 3 + 1], - image->cmap[editor->col_index * 3 + 2], + colormap[editor->col_index * 3], + colormap[editor->col_index * 3 + 1], + colormap[editor->col_index * 3 + 2], OPAQUE_OPACITY); 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_image (image, data); - if (image->num_cols < 256) + if (gimp_image_get_colormap_size (image) < 256) { GimpRGB color; diff --git a/app/actions/image-commands.c b/app/actions/image-commands.c index bf414488ee..cfdc38e40b 100644 --- a/app/actions/image-commands.c +++ b/app/actions/image-commands.c @@ -571,8 +571,8 @@ image_resize_callback (GtkWidget *dialog, gtk_widget_destroy (dialog); - if (width == image->width && - height == image->height) + if (width == gimp_image_get_width (image) && + height == gimp_image_get_height (image)) return; progress = gimp_progress_start (GIMP_PROGRESS (display), @@ -612,9 +612,9 @@ image_print_size_callback (GtkWidget *dialog, { gtk_widget_destroy (dialog); - if (xresolution == image->xresolution && - yresolution == image->yresolution && - resolution_unit == image->resolution_unit) + if (xresolution == image->xresolution && + yresolution == image->yresolution && + resolution_unit == gimp_image_get_unit (image)) return; 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 == image->width && - height == image->height && - xresolution == image->xresolution && - yresolution == image->yresolution && - resolution_unit == image->resolution_unit) + if (width == gimp_image_get_width (image) && + height == gimp_image_get_height (image) && + xresolution == image->xresolution && + yresolution == image->yresolution && + resolution_unit == gimp_image_get_unit (image)) return; 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_unit (image, resolution_unit); - if (width != image->width || - height != image->height) + if (width != gimp_image_get_width (image) || + height != gimp_image_get_height (image)) { GimpProgress *progress; diff --git a/app/core/gimp-edit.c b/app/core/gimp-edit.c index 47dbac94ea..5b32491fd4 100644 --- a/app/core/gimp-edit.c +++ b/app/core/gimp-edit.c @@ -236,8 +236,8 @@ gimp_edit_paste (GimpImage *image, { /* otherwise the offsets to the center of the image */ - center_x = image->width / 2; - center_y = image->height / 2; + center_x = gimp_image_get_width (image) / 2; + center_y = gimp_image_get_height (image) / 2; } 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 * fits and aligned at top left if it doesn't. (See bug #142944). */ - offset_x = MIN (offset_x, image->width - width); - offset_y = MIN (offset_y, image->height - height); + offset_x = MIN (offset_x, gimp_image_get_width (image) - width); + offset_y = MIN (offset_y, gimp_image_get_height (image) - height); offset_x = MAX (offset_x, 0); offset_y = MAX (offset_y, 0); @@ -517,7 +517,8 @@ gimp_edit_fade (GimpImage *image, gimp_image_undo (image); pixel_region_init (&src2PR, src2_tiles, - 0, 0, undo->width, undo->height, + 0, 0, + undo->width, undo->height, FALSE); gimp_drawable_apply_region (drawable, &src2PR, diff --git a/app/core/gimpdrawable-preview.c b/app/core/gimpdrawable-preview.c index 0fc6b6001e..e2e5b3ba4f 100644 --- a/app/core/gimpdrawable-preview.c +++ b/app/core/gimpdrawable-preview.c @@ -76,12 +76,12 @@ gimp_drawable_get_preview (GimpViewable *viewable, return NULL; /* Ok prime the cache with a large preview if the cache is invalid */ - if (! drawable->preview_valid && - width <= PREVIEW_CACHE_PRIME_WIDTH && - height <= PREVIEW_CACHE_PRIME_HEIGHT && - image && - image->width > PREVIEW_CACHE_PRIME_WIDTH && - image->height > PREVIEW_CACHE_PRIME_HEIGHT) + if (! drawable->preview_valid && + width <= PREVIEW_CACHE_PRIME_WIDTH && + height <= PREVIEW_CACHE_PRIME_HEIGHT && + image && + gimp_image_get_width (image) > PREVIEW_CACHE_PRIME_WIDTH && + gimp_image_get_height (image) > PREVIEW_CACHE_PRIME_HEIGHT) { TempBuf *tb = gimp_drawable_preview_private (drawable, PREVIEW_CACHE_PRIME_WIDTH, diff --git a/app/core/gimpimage-colorhash.c b/app/core/gimpimage-colorhash.c index 019c61279f..aee1773d74 100644 --- a/app/core/gimpimage-colorhash.c +++ b/app/core/gimpimage-colorhash.c @@ -24,6 +24,7 @@ #include "gimpimage.h" #include "gimpimage-colorhash.h" +#include "gimpimage-colormap.h" #define MAXDIFF 195076 @@ -113,14 +114,14 @@ gimp_image_color_hash_rgb_to_indexed (const GimpImage *image, gint g, gint b) { - guchar *cmap; - gint num_cols; - guint pixel; - gint hash_index; - gint cmap_index; + const guchar *cmap; + gint num_cols; + guint pixel; + gint hash_index; + gint cmap_index; - cmap = image->cmap; - num_cols = image->num_cols; + cmap = gimp_image_get_colormap (image); + num_cols = gimp_image_get_colormap_size (image); pixel = (r << 16) | (g << 8) | b; hash_index = pixel % HASH_TABLE_SIZE; diff --git a/app/core/gimpimage-colormap.c b/app/core/gimpimage-colormap.c index 526d0ac66f..e0b34425aa 100644 --- a/app/core/gimpimage-colormap.c +++ b/app/core/gimpimage-colormap.c @@ -72,7 +72,7 @@ gimp_image_set_colormap (GimpImage *image, 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) g_free (image->cmap); diff --git a/app/core/gimpimage-convert.c b/app/core/gimpimage-convert.c index c134456ae1..6a41daafc0 100644 --- a/app/core/gimpimage-convert.c +++ b/app/core/gimpimage-convert.c @@ -825,7 +825,7 @@ gimp_image_convert (GimpImage *image, gimp_image_undo_push_image_type (image, NULL); /* 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); @@ -1004,12 +1004,9 @@ gimp_image_convert (GimpImage *image, break; 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)) { + guchar colormap[GIMP_IMAGE_COLORMAP_SIZE]; gint i, j; guchar old_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++) { - image->cmap[j] = new_palette[j]; j++; - image->cmap[j] = new_palette[j]; j++; - image->cmap[j] = new_palette[j]; j++; + colormap[j] = new_palette[j]; j++; + colormap[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 { - gint i,j; + guchar colormap[GIMP_IMAGE_COLORMAP_SIZE]; + gint i, j; for (i = 0, j = 0; i < quantobj->actual_number_of_colors; i++) { - image->cmap[j++] = quantobj->cmap[i].red; - image->cmap[j++] = quantobj->cmap[i].green; - image->cmap[j++] = quantobj->cmap[i].blue; + colormap[j++] = quantobj->cmap[i].red; + colormap[j++] = quantobj->cmap[i].green; + 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; } diff --git a/app/core/gimpimage-crop.c b/app/core/gimpimage-crop.c index 7ba7e5ebce..dfdb4a4bf1 100644 --- a/app/core/gimpimage-crop.c +++ b/app/core/gimpimage-crop.c @@ -179,12 +179,12 @@ gimp_image_crop (GimpImage *image, gimp_item_offsets (item, &off_x, &off_y); - lx1 = CLAMP (off_x, 0, image->width); - ly1 = CLAMP (off_y, 0, image->height); + lx1 = CLAMP (off_x, 0, gimp_image_get_width (image)); + ly1 = CLAMP (off_y, 0, gimp_image_get_height (image)); 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, - 0, image->height); + 0, gimp_image_get_height (image)); width = lx2 - lx1; height = ly2 - ly1; @@ -262,7 +262,10 @@ gimp_image_crop (GimpImage *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)); g_object_thaw_notify (G_OBJECT (image)); diff --git a/app/core/gimpimage-duplicate.c b/app/core/gimpimage-duplicate.c index b832505a7a..e10d9d9cee 100644 --- a/app/core/gimpimage-duplicate.c +++ b/app/core/gimpimage-duplicate.c @@ -64,8 +64,9 @@ gimp_image_duplicate (GimpImage *image) /* Create a new image */ new_image = gimp_create_image (image->gimp, - image->width, image->height, - image->base_type, + gimp_image_get_width (image), + gimp_image_get_height (image), + gimp_image_base_type (image), FALSE); gimp_image_undo_disable (new_image); @@ -80,7 +81,7 @@ gimp_image_duplicate (GimpImage *image) } /* 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_get_colormap (image), gimp_image_get_colormap_size (image), @@ -89,7 +90,7 @@ gimp_image_duplicate (GimpImage *image) /* Copy resolution information */ new_image->xresolution = image->xresolution; new_image->yresolution = image->yresolution; - new_image->resolution_unit = image->resolution_unit; + new_image->resolution_unit = gimp_image_get_unit (image); /* Copy floating layer */ floating_layer = gimp_image_floating_sel (image); @@ -196,14 +197,20 @@ gimp_image_duplicate (GimpImage *image) PixelRegion srcPR, destPR; src_tiles = - gimp_drawable_get_tiles (GIMP_DRAWABLE (image->selection_mask)); + gimp_drawable_get_tiles (GIMP_DRAWABLE (gimp_image_get_mask (image))); 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, - 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, - 0, 0, image->width, image->height, TRUE); + 0, 0, + gimp_image_get_width (image), + gimp_image_get_height (image), + TRUE); copy_region (&srcPR, &destPR); diff --git a/app/core/gimpimage-flip.c b/app/core/gimpimage-flip.c index b62c20687d..418b0273ea 100644 --- a/app/core/gimpimage-flip.c +++ b/app/core/gimpimage-flip.c @@ -57,11 +57,11 @@ gimp_image_flip (GimpImage *image, switch (flip_type) { case GIMP_ORIENTATION_HORIZONTAL: - axis = (gdouble) image->width / 2.0; + axis = (gdouble) gimp_image_get_width (image) / 2.0; break; case GIMP_ORIENTATION_VERTICAL: - axis = (gdouble) image->height / 2.0; + axis = (gdouble) gimp_image_get_height (image) / 2.0; break; default: @@ -133,13 +133,15 @@ gimp_image_flip (GimpImage *image, case GIMP_ORIENTATION_HORIZONTAL: if (flip_type == GIMP_ORIENTATION_VERTICAL) gimp_image_move_guide (image, guide, - image->height - position, TRUE); + gimp_image_get_height (image) - position, + TRUE); break; case GIMP_ORIENTATION_VERTICAL: if (flip_type == GIMP_ORIENTATION_HORIZONTAL) gimp_image_move_guide (image, guide, - image->width - position, TRUE); + gimp_image_get_width (image) - position, + TRUE); break; default: @@ -155,12 +157,14 @@ gimp_image_flip (GimpImage *image, if (flip_type == GIMP_ORIENTATION_VERTICAL) gimp_image_move_sample_point (image, sample_point, sample_point->x, - image->height - sample_point->y, + gimp_image_get_height (image) - + sample_point->y, TRUE); if (flip_type == GIMP_ORIENTATION_HORIZONTAL) gimp_image_move_sample_point (image, sample_point, - image->width - sample_point->x, + gimp_image_get_width (image) - + sample_point->x, sample_point->y, TRUE); } diff --git a/app/core/gimpimage-guides.c b/app/core/gimpimage-guides.c index af1e9fd6bb..6893f83dd8 100644 --- a/app/core/gimpimage-guides.c +++ b/app/core/gimpimage-guides.c @@ -41,7 +41,8 @@ gimp_image_add_hguide (GimpImage *image, GimpGuide *guide; 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, image->gimp->next_guide_ID++); @@ -63,7 +64,8 @@ gimp_image_add_vguide (GimpImage *image, GimpGuide *guide; 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, image->gimp->next_guide_ID++); @@ -87,9 +89,9 @@ gimp_image_add_guide (GimpImage *image, g_return_if_fail (position >= 0); 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 - 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); @@ -130,9 +132,9 @@ gimp_image_move_guide (GimpImage *image, g_return_if_fail (position >= 0); 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 - g_return_if_fail (position <= image->width); + g_return_if_fail (position <= gimp_image_get_width (image)); if (push_undo) 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 (epsilon_x > 0 && epsilon_y > 0, NULL); - if (x < 0 || x >= image->width || - y < 0 || y >= image->height) + if (x < 0 || x >= gimp_image_get_width (image) || + y < 0 || y >= gimp_image_get_height (image)) { return NULL; } diff --git a/app/core/gimpimage-merge.c b/app/core/gimpimage-merge.c index 6f3ec996b4..6529525a26 100644 --- a/app/core/gimpimage-merge.c +++ b/app/core/gimpimage-merge.c @@ -131,7 +131,7 @@ gimp_image_merge_visible_layers (GimpImage *image, return layer; } - return image->active_layer; + return gimp_image_get_active_layer (image); } GimpLayer * @@ -374,10 +374,10 @@ gimp_image_merge_layers (GimpImage *image, if (merge_type == GIMP_CLIP_TO_IMAGE) { - x1 = CLAMP (x1, 0, image->width); - y1 = CLAMP (y1, 0, image->height); - x2 = CLAMP (x2, 0, image->width); - y2 = CLAMP (y2, 0, image->height); + x1 = CLAMP (x1, 0, gimp_image_get_width (image)); + y1 = CLAMP (y1, 0, gimp_image_get_height (image)); + x2 = CLAMP (x2, 0, gimp_image_get_width (image)); + y2 = CLAMP (y2, 0, gimp_image_get_height (image)); } break; @@ -396,8 +396,8 @@ gimp_image_merge_layers (GimpImage *image, { x1 = 0; y1 = 0; - x2 = image->width; - y2 = image->height; + x2 = gimp_image_get_width (image); + y2 = gimp_image_get_height (image); } break; } diff --git a/app/core/gimpimage-preview.c b/app/core/gimpimage-preview.c index a9888330b2..4c2c14b6ff 100644 --- a/app/core/gimpimage-preview.c +++ b/app/core/gimpimage-preview.c @@ -40,8 +40,8 @@ gimp_image_get_preview_size (GimpViewable *viewable, { GimpImage *image = GIMP_IMAGE (viewable); - gimp_viewable_calc_preview_size (image->width, - image->height, + gimp_viewable_calc_preview_size (gimp_image_get_width (image), + gimp_image_get_height (image), size, size, dot_for_dot, @@ -62,12 +62,13 @@ gimp_image_get_popup_size (GimpViewable *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; - gimp_viewable_calc_preview_size (image->width, - image->height, + gimp_viewable_calc_preview_size (gimp_image_get_width (image), + gimp_image_get_height (image), width * 2, height * 2, dot_for_dot, 1.0, 1.0, @@ -77,8 +78,8 @@ gimp_image_get_popup_size (GimpViewable *viewable, if (scaling_up) { - *popup_width = image->width; - *popup_height = image->height; + *popup_width = gimp_image_get_width (image); + *popup_height = gimp_image_get_height (image); } return TRUE; @@ -129,8 +130,8 @@ gimp_image_get_new_preview (GimpViewable *viewable, gint level; gboolean is_premult; - scale_x = (gdouble) width / (gdouble) image->width; - scale_y = (gdouble) height / (gdouble) image->height; + scale_x = (gdouble) width / (gdouble) gimp_image_get_width (image); + scale_y = (gdouble) height / (gdouble) gimp_image_get_height (image); level = gimp_projection_get_level (image->projection, scale_x, scale_y); diff --git a/app/core/gimpimage-quick-mask.c b/app/core/gimpimage-quick-mask.c index 35b3c42033..94be1f7623 100644 --- a/app/core/gimpimage-quick-mask.c +++ b/app/core/gimpimage-quick-mask.c @@ -91,8 +91,8 @@ gimp_image_set_quick_mask_state (GimpImage *image, floating_sel_to_layer (floating_sel, NULL); mask = gimp_channel_new (image, - image->width, - image->height, + gimp_image_get_width (image), + gimp_image_get_height (image), GIMP_IMAGE_QUICK_MASK_NAME, &image->quick_mask_color); diff --git a/app/core/gimpimage-resize.c b/app/core/gimpimage-resize.c index 26818973ae..77c7f45141 100644 --- a/app/core/gimpimage-resize.c +++ b/app/core/gimpimage-resize.c @@ -93,8 +93,8 @@ gimp_image_resize_with_layers (GimpImage *image, GIMP_ITEM_TYPE_LAYERS, layer_set); - old_width = image->width; - old_height = image->height; + old_width = gimp_image_get_width (image); + old_height = gimp_image_get_height (image); /* Push the image size to the stack */ gimp_image_undo_push_image_size (image, NULL); diff --git a/app/core/gimpimage-rotate.c b/app/core/gimpimage-rotate.c index 9fa22c4a40..730796396c 100644 --- a/app/core/gimpimage-rotate.c +++ b/app/core/gimpimage-rotate.c @@ -69,8 +69,8 @@ gimp_image_rotate (GimpImage *image, gimp_set_busy (image->gimp); - center_x = (gdouble) image->width / 2.0; - center_y = (gdouble) image->height / 2.0; + center_x = (gdouble) gimp_image_get_width (image) / 2.0; + center_y = (gdouble) gimp_image_get_height (image) / 2.0; progress_max = (image->channels->num_children + image->layers->num_children + @@ -86,14 +86,14 @@ gimp_image_rotate (GimpImage *image, { case GIMP_ROTATE_90: case GIMP_ROTATE_270: - new_image_width = image->height; - new_image_height = image->width; + new_image_width = gimp_image_get_height (image); + new_image_height = gimp_image_get_width (image); size_changed = TRUE; break; case GIMP_ROTATE_180: - new_image_width = image->width; - new_image_height = image->height; + new_image_width = gimp_image_get_width (image); + new_image_height = gimp_image_get_height (image); size_changed = FALSE; break; @@ -133,8 +133,8 @@ gimp_image_rotate (GimpImage *image, item->offset_y = 0; gimp_item_translate (item, - (new_image_width - image->width) / 2, - (new_image_height - image->height) / 2, + (new_image_width - gimp_image_get_width (image)) / 2, + (new_image_height - gimp_image_get_height (image)) / 2, FALSE); if (progress) @@ -142,14 +142,18 @@ gimp_image_rotate (GimpImage *image, } /* Don't forget the selection mask! */ - gimp_item_rotate (GIMP_ITEM (gimp_image_get_mask (image)), context, - rotate_type, center_x, center_y, FALSE); + { + GimpChannel *mask = gimp_image_get_mask (image); - GIMP_ITEM (image->selection_mask)->offset_x = 0; - GIMP_ITEM (image->selection_mask)->offset_y = 0; + gimp_item_rotate (GIMP_ITEM (mask), context, + rotate_type, center_x, center_y, FALSE); - if (progress) - gimp_progress_set_value (progress, progress_current++ / progress_max); + GIMP_ITEM (mask)->offset_x = 0; + GIMP_ITEM (mask)->offset_y = 0; + + if (progress) + gimp_progress_set_value (progress, progress_current++ / progress_max); + } /* Rotate all layers */ for (list = GIMP_LIST (image->layers)->list; @@ -222,13 +226,13 @@ gimp_image_rotate_item_offset (GimpImage *image, switch (rotate_type) { 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; break; case GIMP_ROTATE_270: 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; case GIMP_ROTATE_180: @@ -265,7 +269,8 @@ gimp_image_rotate_guides (GimpImage *image, case GIMP_ORIENTATION_HORIZONTAL: gimp_image_undo_push_guide (image, NULL, guide); 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; case GIMP_ORIENTATION_VERTICAL: @@ -283,12 +288,14 @@ gimp_image_rotate_guides (GimpImage *image, { case GIMP_ORIENTATION_HORIZONTAL: gimp_image_move_guide (image, guide, - image->height - position, TRUE); + gimp_image_get_height (image) - position, + TRUE); break; case GIMP_ORIENTATION_VERTICAL: gimp_image_move_guide (image, guide, - image->width - position, TRUE); + gimp_image_get_width (image) - position, + TRUE); break; default: @@ -307,7 +314,8 @@ gimp_image_rotate_guides (GimpImage *image, case GIMP_ORIENTATION_VERTICAL: gimp_image_undo_push_guide (image, NULL, guide); 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; default: @@ -341,16 +349,16 @@ gimp_image_rotate_sample_points (GimpImage *image, { case GIMP_ROTATE_90: sample_point->x = old_y; - sample_point->y = image->height - old_x; + sample_point->y = gimp_image_get_height (image) - old_x; break; case GIMP_ROTATE_180: - sample_point->x = image->height - old_x; - sample_point->y = image->width - old_y; + sample_point->x = gimp_image_get_height (image) - old_x; + sample_point->y = gimp_image_get_width (image) - old_y; break; 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; break; } diff --git a/app/core/gimpimage-sample-points.c b/app/core/gimpimage-sample-points.c index cf6f01ec20..e3b84c5c11 100644 --- a/app/core/gimpimage-sample-points.c +++ b/app/core/gimpimage-sample-points.c @@ -44,8 +44,8 @@ gimp_image_add_sample_point_at_pos (GimpImage *image, GimpSamplePoint *sample_point; 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 (y >= 0 && y < image->height, NULL); + g_return_val_if_fail (x >= 0 && x < gimp_image_get_width (image), 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++); @@ -69,8 +69,8 @@ gimp_image_add_sample_point (GimpImage *image, g_return_if_fail (sample_point != NULL); g_return_if_fail (x >= 0); g_return_if_fail (y >= 0); - g_return_if_fail (x < image->width); - g_return_if_fail (y < image->height); + g_return_if_fail (x < gimp_image_get_width (image)); + g_return_if_fail (y < gimp_image_get_height (image)); 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 (x >= 0); g_return_if_fail (y >= 0); - g_return_if_fail (x < image->width); - g_return_if_fail (y < image->height); + g_return_if_fail (x < gimp_image_get_width (image)); + g_return_if_fail (y < gimp_image_get_height (image)); if (push_undo) 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 (epsilon_x > 0 && epsilon_y > 0, NULL); - if (x < 0 || x >= image->width || - y < 0 || y >= image->height) + if (x < 0 || x >= gimp_image_get_width (image) || + y < 0 || y >= gimp_image_get_height (image)) { return NULL; } diff --git a/app/core/gimpimage-scale.c b/app/core/gimpimage-scale.c index fea2aee811..4d11ae18dc 100644 --- a/app/core/gimpimage-scale.c +++ b/app/core/gimpimage-scale.c @@ -82,8 +82,8 @@ gimp_image_scale (GimpImage *image, /* Push the image size to the stack */ gimp_image_undo_push_image_size (image, NULL); - old_width = image->width; - old_height = image->height; + old_width = gimp_image_get_width (image); + old_height = gimp_image_get_height (image); img_scale_w = (gdouble) new_width / (gdouble) old_width; 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_CHANNELS, 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; scaled_size = 0; diff --git a/app/core/gimpimage-snap.c b/app/core/gimpimage-snap.c index c109bc88d3..8f69d78cc1 100644 --- a/app/core/gimpimage-snap.c +++ b/app/core/gimpimage-snap.c @@ -64,7 +64,7 @@ gimp_image_snap_x (GimpImage *image, if (! (snap_to_guides || snap_to_grid || snap_to_canvas)) 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; if (snap_to_guides) @@ -108,7 +108,7 @@ gimp_image_snap_x (GimpImage *image, while (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) continue; @@ -135,12 +135,12 @@ gimp_image_snap_x (GimpImage *image, snapped = TRUE; } - dist = ABS (image->width - x); + dist = ABS (gimp_image_get_width (image) - x); if (dist < MIN (epsilon_x, mindist)) { mindist = dist; - *tx = image->width; + *tx = gimp_image_get_width (image); snapped = TRUE; } } @@ -172,7 +172,7 @@ gimp_image_snap_y (GimpImage *image, if (! (snap_to_guides || snap_to_grid || snap_to_canvas)) 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; if (snap_to_guides) @@ -216,7 +216,7 @@ gimp_image_snap_y (GimpImage *image, while (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) continue; @@ -243,12 +243,12 @@ gimp_image_snap_y (GimpImage *image, snapped = TRUE; } - dist = ABS (image->height - y); + dist = ABS (gimp_image_get_height (image) - y); if (dist < MIN (epsilon_y, mindist)) { mindist = dist; - *ty = image->height; + *ty = gimp_image_get_height (image); snapped = TRUE; } } @@ -281,15 +281,15 @@ gimp_image_snap_point (GimpImage *image, *tx = x; *ty = y; - if (! image->guides) snap_to_guides = FALSE; - if (! image->grid) snap_to_grid = FALSE; - if (! image->active_vectors) snap_to_vectors = FALSE; + if (! image->guides) snap_to_guides = FALSE; + if (! gimp_image_get_grid (image)) snap_to_grid = 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)) return FALSE; - if (x < -epsilon_x || x >= (image->width + epsilon_x) || - y < -epsilon_y || y >= (image->height + epsilon_y)) + if (x < -epsilon_x || x >= (gimp_image_get_width (image) + epsilon_x) || + y < -epsilon_y || y >= (gimp_image_get_height (image) + epsilon_y)) { return FALSE; } @@ -356,7 +356,7 @@ gimp_image_snap_point (GimpImage *image, while (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) 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) continue; @@ -398,12 +398,12 @@ gimp_image_snap_point (GimpImage *image, snapped = TRUE; } - dist = ABS (image->width - x); + dist = ABS (gimp_image_get_width (image) - x); if (dist < MIN (epsilon_x, mindist_x)) { mindist_x = dist; - *tx = image->width; + *tx = gimp_image_get_width (image); snapped = TRUE; } @@ -416,12 +416,12 @@ gimp_image_snap_point (GimpImage *image, snapped = TRUE; } - dist = ABS (image->height - y); + dist = ABS (gimp_image_get_height (image) - y); if (dist < MIN (epsilon_y, mindist_y)) { mindist_y = dist; - *ty = image->height; + *ty = gimp_image_get_height (image); snapped = TRUE; } } @@ -494,9 +494,9 @@ gimp_image_snap_rectangle (GimpImage *image, *tx1 = x1; *ty1 = y1; - if (! image->guides) snap_to_guides = FALSE; - if (! image->grid) snap_to_grid = FALSE; - if (! image->active_vectors) snap_to_vectors = FALSE; + if (! image->guides) snap_to_guides = FALSE; + if (! gimp_image_get_grid (image)) snap_to_grid = 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)) return FALSE; diff --git a/app/core/gimpimage.c b/app/core/gimpimage.c index 14127c8cf2..a14547fe80 100644 --- a/app/core/gimpimage.c +++ b/app/core/gimpimage.c @@ -729,8 +729,8 @@ gimp_image_constructor (GType type, /* create the selection mask */ image->selection_mask = gimp_selection_new (image, - image->width, - image->height); + gimp_image_get_width (image), + gimp_image_get_height (image)); g_object_ref_sink (image->selection_mask); g_signal_connect (image->selection_mask, "update", @@ -1031,8 +1031,8 @@ gimp_image_get_size (GimpViewable *viewable, { GimpImage *image = GIMP_IMAGE (viewable); - *width = image->width; - *height = image->height; + *width = gimp_image_get_width (image); + *height = gimp_image_get_height (image); return TRUE; } @@ -1114,7 +1114,10 @@ gimp_image_real_colormap_changed (GimpImage *image, gimp_image_color_hash_invalidate (image, color_index); /* 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); } @@ -1700,7 +1703,10 @@ gimp_image_set_component_visible (GimpImage *image, gimp_image_signals[COMPONENT_VISIBILITY_CHANGED], 0, 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 (x >= 0 && x < image->width && - y >= 0 && y < image->height) + if (x >= 0 && x < gimp_image_get_width (image) && + y >= 0 && y < gimp_image_get_height (image)) in_pickable = TRUE; } else diff --git a/app/core/gimpimagefile.c b/app/core/gimpimagefile.c index 0b51a78dc7..58a8c20daa 100644 --- a/app/core/gimpimagefile.c +++ b/app/core/gimpimagefile.c @@ -699,7 +699,7 @@ gimp_imagefile_load_thumb (GimpImagefile *imagefile, return NULL; } - pixbuf_width = gdk_pixbuf_get_width (pixbuf); + pixbuf_width = gdk_pixbuf_get_width (pixbuf); pixbuf_height = gdk_pixbuf_get_height (pixbuf); gimp_viewable_calc_preview_size (pixbuf_width, @@ -758,24 +758,27 @@ gimp_imagefile_save_thumb (GimpImagefile *imagefile, if (size < 1) 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; - height = image->height; + width = gimp_image_get_width (image); + height = gimp_image_get_height (image); size = MAX (width, height); } else { - if (image->width < image->height) + if (gimp_image_get_width (image) < gimp_image_get_height (image)) { 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 { width = size; - height = MAX (1, (size * image->height) / image->width); + height = MAX (1, (size * gimp_image_get_height (image) / + gimp_image_get_width (image))); } } @@ -831,7 +834,7 @@ gimp_thumbnail_set_info_from_image (GimpThumbnail *thumbnail, g_object_set (thumbnail, "image-mimetype", mime_type, - "image-width", gimp_image_get_width (image), + "image-width", gimp_image_get_width (image), "image-height", gimp_image_get_height (image), "image-type", desc->value_desc, "image-num-layers", gimp_container_num_children (image->layers), diff --git a/app/core/gimpimageundo.c b/app/core/gimpimageundo.c index e58b173b61..7d1407791c 100644 --- a/app/core/gimpimageundo.c +++ b/app/core/gimpimageundo.c @@ -126,18 +126,18 @@ gimp_image_undo_constructor (GType type, switch (GIMP_UNDO (object)->undo_type) { case GIMP_UNDO_IMAGE_TYPE: - image_undo->base_type = image->base_type; + image_undo->base_type = gimp_image_base_type (image); break; case GIMP_UNDO_IMAGE_SIZE: - image_undo->width = image->width; - image_undo->height = image->height; + image_undo->width = gimp_image_get_width (image); + image_undo->height = gimp_image_get_height (image); break; case GIMP_UNDO_IMAGE_RESOLUTION: image_undo->xresolution = image->xresolution; image_undo->yresolution = image->yresolution; - image_undo->resolution_unit = image->resolution_unit; + image_undo->resolution_unit = gimp_image_get_unit (image); break; case GIMP_UNDO_IMAGE_GRID: @@ -252,12 +252,12 @@ gimp_image_undo_pop (GimpUndo *undo, GimpImageBaseType 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); 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; } break; @@ -270,8 +270,8 @@ gimp_image_undo_pop (GimpUndo *undo, width = image_undo->width; height = image_undo->height; - image_undo->width = image->width; - image_undo->height = image->height; + image_undo->width = gimp_image_get_width (image); + image_undo->height = gimp_image_get_height (image); g_object_set (image, "width", width, @@ -281,8 +281,8 @@ gimp_image_undo_pop (GimpUndo *undo, gimp_drawable_invalidate_boundary (GIMP_DRAWABLE (gimp_image_get_mask (image))); - if (image->width != image_undo->width || - image->height != image_undo->height) + if (gimp_image_get_width (image) != image_undo->width || + gimp_image_get_height (image) != image_undo->height) accum->size_changed = TRUE; } break; @@ -306,11 +306,11 @@ gimp_image_undo_pop (GimpUndo *undo, accum->resolution_changed = TRUE; } - if (image_undo->resolution_unit != image->resolution_unit) + if (image_undo->resolution_unit != gimp_image_get_unit (image)) { GimpUnit unit; - unit = image->resolution_unit; + unit = gimp_image_get_unit (image); image->resolution_unit = image_undo->resolution_unit; image_undo->resolution_unit = unit; diff --git a/app/core/gimpitem-preview.c b/app/core/gimpitem-preview.c index 98253a02f3..b62bcb5674 100644 --- a/app/core/gimpitem-preview.c +++ b/app/core/gimpitem-preview.c @@ -56,8 +56,8 @@ gimp_item_get_preview_size (GimpViewable *viewable, if (image && ! is_popup) { - gimp_viewable_calc_preview_size (image->width, - image->height, + gimp_viewable_calc_preview_size (gimp_image_get_width (image), + gimp_image_get_height (image), size, size, dot_for_dot, diff --git a/app/core/gimpitem.c b/app/core/gimpitem.c index b25364b050..c3f9b85869 100644 --- a/app/core/gimpitem.c +++ b/app/core/gimpitem.c @@ -718,8 +718,10 @@ gimp_item_check_scaling (const GimpItem *item, image = gimp_item_get_image (item); - img_scale_w = (gdouble) new_width / (gdouble) image->width; - img_scale_h = (gdouble) new_height / (gdouble) image->height; + img_scale_w = ((gdouble) new_width / + (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_height = ROUND (img_scale_h * (gdouble) gimp_item_height (item)); @@ -872,18 +874,20 @@ gimp_item_scale_by_origin (GimpItem *item, if (local_origin) { - new_offset_x = item->offset_x + ((item->width - new_width) / 2.0); - new_offset_y = item->offset_y + ((item->height - new_height) / 2.0); + new_offset_x = (item->offset_x + + ((gimp_item_width (item) - new_width) / 2.0)); + new_offset_y = (item->offset_y + + ((gimp_item_height (item) - new_height) / 2.0)); } else { new_offset_x = (gint) (((gdouble) new_width * (gdouble) item->offset_x / - (gdouble) item->width)); + (gdouble) gimp_item_width (item))); new_offset_y = (gint) (((gdouble) new_height * (gdouble) item->offset_y / - (gdouble) item->height)); + (gdouble) gimp_item_height (item))); } gimp_item_scale (item, @@ -1317,8 +1321,8 @@ gimp_item_is_in_set (GimpItem *item, return TRUE; case GIMP_ITEM_SET_IMAGE_SIZED: - return (gimp_item_width (item) == item->image->width && - gimp_item_height (item) == item->image->height); + return (gimp_item_width (item) == gimp_image_get_width (item->image) && + gimp_item_height (item) == gimp_image_get_height (item->image)); case GIMP_ITEM_SET_VISIBLE: return gimp_item_get_visible (item); diff --git a/app/core/gimplayer.c b/app/core/gimplayer.c index cca8815da4..2eb912fe92 100644 --- a/app/core/gimplayer.c +++ b/app/core/gimplayer.c @@ -1428,7 +1428,8 @@ gimp_layer_create_mask (const GimpLayer *layer, channel_empty = gimp_channel_is_empty (channel); 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, gimp_item_width (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_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); } diff --git a/app/core/gimppalette-import.c b/app/core/gimppalette-import.c index 6a631dc6f2..f4a4de3c7f 100644 --- a/app/core/gimppalette-import.c +++ b/app/core/gimppalette-import.c @@ -34,6 +34,7 @@ #include "gimpcontext.h" #include "gimpgradient.h" #include "gimpimage.h" +#include "gimpimage-colormap.h" #include "gimppalette.h" #include "gimppalette-import.h" #include "gimppalette-load.h" @@ -384,8 +385,8 @@ gimp_palette_import_from_image (GimpImage *image, { x = 0; y = 0; - width = image->width; - height = image->height; + width = gimp_image_get_width (image); + height = gimp_image_get_height (image); } colors = gimp_palette_import_extract (image, @@ -405,9 +406,11 @@ GimpPalette * gimp_palette_import_from_indexed_image (GimpImage *image, const gchar *palette_name) { - GimpPalette *palette; - gint count; - GimpRGB color; + GimpPalette *palette; + const guchar *colormap; + guint n_colors; + gint count; + GimpRGB color; g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL); g_return_val_if_fail (gimp_image_base_type (image) == GIMP_INDEXED, NULL); @@ -415,16 +418,19 @@ gimp_palette_import_from_indexed_image (GimpImage *image, 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]; g_snprintf (name, sizeof (name), _("Index %d"), count); gimp_rgba_set_uchar (&color, - image->cmap[count * 3 + 0], - image->cmap[count * 3 + 1], - image->cmap[count * 3 + 2], + colormap[count * 3 + 0], + colormap[count * 3 + 1], + colormap[count * 3 + 2], 255); gimp_palette_add_entry (palette, -1, name, &color); diff --git a/app/core/gimpprojection-construct.c b/app/core/gimpprojection-construct.c index caa7a87711..d3d2831311 100644 --- a/app/core/gimpprojection-construct.c +++ b/app/core/gimpprojection-construct.c @@ -31,6 +31,7 @@ #include "gimpdrawable.h" #include "gimpimage.h" +#include "gimpimage-colormap.h" #include "gimplayer.h" #include "gimplayer-floating-sel.h" #include "gimplayermask.h" @@ -441,11 +442,13 @@ project_indexed (GimpProjection *proj, PixelRegion *dest, 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) { - 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_mode (layer), proj->image->visible, @@ -453,7 +456,7 @@ project_indexed (GimpProjection *proj, } 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_mode (layer), proj->image->visible, @@ -468,11 +471,13 @@ project_indexed_alpha (GimpProjection *proj, PixelRegion *dest, 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) { - 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_mode (layer), proj->image->visible, @@ -480,7 +485,7 @@ project_indexed_alpha (GimpProjection *proj, } 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_mode (layer), proj->image->visible, diff --git a/app/core/gimpprojection.c b/app/core/gimpprojection.c index 50b3ff6946..5baaf1139c 100644 --- a/app/core/gimpprojection.c +++ b/app/core/gimpprojection.c @@ -260,7 +260,10 @@ gimp_projection_get_pixel_at (GimpPickable *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; 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) { proj->pyramid = tile_pyramid_new (gimp_projection_get_image_type (proj), - proj->image->width, - proj->image->height); + gimp_image_get_width (proj->image), + gimp_image_get_height (proj->image)); tile_pyramid_set_validate_proc (proj->pyramid, (TileValidateProc) gimp_projection_validate_tile, @@ -346,8 +349,8 @@ gimp_projection_get_level (GimpProjection *proj, gdouble scale_x, gdouble scale_y) { - return tile_pyramid_get_level (proj->image->width, - proj->image->height, + return tile_pyramid_get_level (gimp_image_get_width (proj->image), + gimp_image_get_height (proj->image), MAX (scale_x, scale_y)); } @@ -375,6 +378,8 @@ gimp_projection_get_image_type (const GimpProjection *proj) } g_assert_not_reached (); + + return 0; } gint @@ -435,10 +440,10 @@ gimp_projection_add_update_area (GimpProjection *proj, g_return_if_fail (GIMP_IS_PROJECTION (proj)); - area = gimp_area_new (CLAMP (x, 0, proj->image->width), - CLAMP (y, 0, proj->image->height), - CLAMP (x + w, 0, proj->image->width), - CLAMP (y + h, 0, proj->image->height)); + area = gimp_area_new (CLAMP (x, 0, gimp_image_get_width (proj->image)), + CLAMP (y, 0, gimp_image_get_height (proj->image)), + CLAMP (x + w, 0, gimp_image_get_width (proj->image)), + CLAMP (y + h, 0, gimp_image_get_height (proj->image))); proj->update_areas = gimp_area_list_process (proj->update_areas, area); } @@ -646,10 +651,10 @@ gimp_projection_paint_area (GimpProjection *proj, gint h) { /* Bounds check */ - gint x1 = CLAMP (x, 0, proj->image->width); - gint y1 = CLAMP (y, 0, proj->image->height); - gint x2 = CLAMP (x + w, 0, proj->image->width); - gint y2 = CLAMP (y + h, 0, proj->image->height); + gint x1 = CLAMP (x, 0, gimp_image_get_width (proj->image)); + gint y1 = CLAMP (y, 0, gimp_image_get_height (proj->image)); + gint x2 = CLAMP (x + w, 0, gimp_image_get_width (proj->image)); + gint y2 = CLAMP (y + h, 0, gimp_image_get_height (proj->image)); gimp_projection_invalidate (proj, x1, y1, x2 - x1, y2 - y1); @@ -706,7 +711,10 @@ gimp_projection_image_size_changed (GimpImage *image, 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 @@ -719,7 +727,10 @@ gimp_projection_image_mode_changed (GimpImage *image, 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 diff --git a/app/core/gimpselection.c b/app/core/gimpselection.c index 67939fc067..ec0817eddc 100644 --- a/app/core/gimpselection.c +++ b/app/core/gimpselection.c @@ -360,8 +360,8 @@ gimp_selection_boundary (GimpChannel *channel, num_segs_in, num_segs_out, 0, 0, - image->width, - image->height); + gimp_image_get_width (image), + gimp_image_get_height (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); - x1 = CLAMP (off_x, 0, image->width); - y1 = CLAMP (off_y, 0, image->height); - x2 = CLAMP (off_x + gimp_item_width (GIMP_ITEM (layer)), 0, - image->width); - y2 = CLAMP (off_y + gimp_item_height (GIMP_ITEM (layer)), 0, - image->height); + x1 = CLAMP (off_x, 0, gimp_image_get_width (image)); + y1 = CLAMP (off_y, 0, gimp_image_get_height (image)); + x2 = CLAMP (off_x + gimp_item_width (GIMP_ITEM (layer)), + 0, gimp_image_get_width (image)); + y2 = CLAMP (off_y + gimp_item_height (GIMP_ITEM (layer)), + 0, gimp_image_get_height (image)); return GIMP_CHANNEL_CLASS (parent_class)->boundary (channel, segs_in, segs_out, diff --git a/app/core/gimpundo.c b/app/core/gimpundo.c index d26703b579..60df655611 100644 --- a/app/core/gimpundo.c +++ b/app/core/gimpundo.c @@ -477,22 +477,25 @@ gimp_undo_create_preview_private (GimpUndo *undo, 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; - height = image->height; + width = gimp_image_get_width (image); + height = gimp_image_get_height (image); } else { - if (image->width > image->height) + if (gimp_image_get_width (image) > gimp_image_get_height (image)) { 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 { 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))); } } diff --git a/app/dialogs/layer-options-dialog.c b/app/dialogs/layer-options-dialog.c index 12ab1fcbce..23e0503660 100644 --- a/app/dialogs/layer-options-dialog.c +++ b/app/dialogs/layer-options-dialog.c @@ -181,14 +181,14 @@ layer_options_dialog_new (GimpImage *image, GIMP_MAX_IMAGE_SIZE); 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, - 0, image->height); + 0, gimp_image_get_height (image)); 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, - image->height); + gimp_image_get_height (image)); /* The radio frame */ frame = gimp_enum_radio_frame_new_with_range (GIMP_TYPE_FILL_TYPE, diff --git a/app/dialogs/print-size-dialog.c b/app/dialogs/print-size-dialog.c index d66ddccf96..452a630738 100644 --- a/app/dialogs/print-size-dialog.c +++ b/app/dialogs/print-size-dialog.c @@ -206,8 +206,10 @@ print_size_dialog_new (GimpImage *image, gimp_size_entry_set_refval_boundaries (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), 1, image->height); + gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (entry), 0, + gimp_image_get_width (image)); + gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (entry), 1, + gimp_image_get_height (image)); /* the resolution entry */ @@ -348,14 +350,16 @@ print_size_dialog_size_changed (GtkWidget *widget, width = gimp_size_entry_get_value (private->size_entry, 0); height = gimp_size_entry_get_value (private->size_entry, 1); - xres = scale * image->width / MAX (0.001, width); - yres = scale * image->height / MAX (0.001, height); + xres = scale * gimp_image_get_width (image) / MAX (0.001, width); + yres = scale * gimp_image_get_height (image) / MAX (0.001, height); xres = CLAMP (xres, 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_size (private, image->width, image->height); + print_size_dialog_set_size (private, + gimp_image_get_width (image), + gimp_image_get_height (image)); } static void diff --git a/app/display/gimpdisplay.c b/app/display/gimpdisplay.c index eac967a2b3..4431192b2d 100644 --- a/app/display/gimpdisplay.c +++ b/app/display/gimpdisplay.c @@ -475,10 +475,14 @@ gimp_display_update_area (GimpDisplay *display, } else { - GimpArea *area = gimp_area_new (CLAMP (x, 0, display->image->width), - CLAMP (y, 0, display->image->height), - CLAMP (x + w, 0, display->image->width), - CLAMP (y + h, 0, display->image->height)); + GimpArea *area; + gint image_width = gimp_image_get_width (display->image); + gint image_height = gimp_image_get_height (display->image); + + 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, area); @@ -540,15 +544,17 @@ gimp_display_paint_area (GimpDisplay *display, gint w, 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; gdouble x1_f, y1_f, x2_f, y2_f; /* Bounds check */ - x1 = CLAMP (x, 0, display->image->width); - y1 = CLAMP (y, 0, display->image->height); - x2 = CLAMP (x + w, 0, display->image->width); - y2 = CLAMP (y + h, 0, display->image->height); + x1 = CLAMP (x, 0, image_width); + y1 = CLAMP (y, 0, image_height); + x2 = CLAMP (x + w, 0, image_width); + y2 = CLAMP (y + h, 0, image_height); x = x1; y = y1; diff --git a/app/display/gimpdisplayshell-draw.c b/app/display/gimpdisplayshell-draw.c index 39a38000ce..7cce60ab2d 100644 --- a/app/display/gimpdisplayshell-draw.c +++ b/app/display/gimpdisplayshell-draw.c @@ -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, - shell->display->image->width, - shell->display->image->height, + gimp_image_get_width (shell->display->image), + gimp_image_get_height (shell->display->image), &x2, &y2, FALSE); 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; y2 = area->y + area->height; - width = shell->display->image->width; - height = shell->display->image->height; + width = gimp_image_get_width (shell->display->image); + height = gimp_image_get_height (shell->display->image); x_offset = grid->xoffset; while (x_offset > 0) diff --git a/app/display/gimpdisplayshell-scale.c b/app/display/gimpdisplayshell-scale.c index 394c4e2bd4..850c34dfb4 100644 --- a/app/display/gimpdisplayshell-scale.c +++ b/app/display/gimpdisplayshell-scale.c @@ -98,8 +98,8 @@ gimp_display_shell_scale_setup (GimpDisplayShell *shell) if (! shell->display) return; - image_width = shell->display->image->width; - image_height = shell->display->image->height; + image_width = gimp_image_get_width (shell->display->image); + image_height = gimp_image_get_height (shell->display->image); sx = SCALEX (shell, image_width); sy = SCALEY (shell, image_height); @@ -400,8 +400,8 @@ gimp_display_shell_scale_fit_in (GimpDisplayShell *shell) image = shell->display->image; - image_width = image->width; - image_height = image->height; + image_width = gimp_image_get_width (image); + image_height = gimp_image_get_height (image); if (! shell->dot_for_dot) { @@ -436,8 +436,8 @@ gimp_display_shell_scale_fill (GimpDisplayShell *shell) image = shell->display->image; - image_width = image->width; - image_height = image->height; + image_width = gimp_image_get_width (image); + image_height = gimp_image_get_height (image); if (! shell->dot_for_dot) { diff --git a/app/display/gimpdisplayshell-scroll.c b/app/display/gimpdisplayshell-scroll.c index 4d541f5665..2be6a8f8a8 100644 --- a/app/display/gimpdisplayshell-scroll.c +++ b/app/display/gimpdisplayshell-scroll.c @@ -94,8 +94,8 @@ gimp_display_shell_scroll_clamp_offsets (GimpDisplayShell *shell) g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell)); - sx = SCALEX (shell, shell->display->image->width); - sy = SCALEY (shell, shell->display->image->height); + sx = SCALEX (shell, gimp_image_get_width (shell->display->image)); + sy = SCALEY (shell, gimp_image_get_height (shell->display->image)); shell->offset_x = CLAMP (shell->offset_x, 0, MAX (sx - shell->disp_width, 0)); diff --git a/app/display/gimpdisplayshell-title.c b/app/display/gimpdisplayshell-title.c index 1dbd1bda95..f9ea964ca0 100644 --- a/app/display/gimpdisplayshell-title.c +++ b/app/display/gimpdisplayshell-title.c @@ -351,14 +351,15 @@ gimp_display_shell_format_title (GimpDisplayShell *shell, g_snprintf (unit_format, sizeof (unit_format), "%%.%df", _gimp_unit_get_digits (gimp, shell->unit) + 1); i += print (title, title_len, i, unit_format, - (image->width * + (gimp_image_get_width (image) * _gimp_unit_get_factor (gimp, shell->unit) / image->xresolution)); break; } /* else fallthru */ 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; 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", _gimp_unit_get_digits (gimp, shell->unit) + 1); i += print (title, title_len, i, unit_format, - (image->height * + (gimp_image_get_height (image) * _gimp_unit_get_factor (gimp, shell->unit) / image->yresolution)); break; } /* else fallthru */ 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; case 'u': /* unit symbol */ diff --git a/app/display/gimpdisplayshell-transform.c b/app/display/gimpdisplayshell-transform.c index a64225afbb..0674953044 100644 --- a/app/display/gimpdisplayshell-transform.c +++ b/app/display/gimpdisplayshell-transform.c @@ -474,8 +474,10 @@ gimp_display_shell_untransform_viewport (GimpDisplayShell *shell, if (x1 < 0) x1 = 0; if (y1 < 0) y1 = 0; - if (x2 > shell->display->image->width) x2 = shell->display->image->width; - if (y2 > shell->display->image->height) y2 = shell->display->image->height; + if (x2 > gimp_image_get_width (shell->display->image)) + 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 (y) *y = y1; diff --git a/app/display/gimpdisplayshell.c b/app/display/gimpdisplayshell.c index c271426ca0..0e1f55e93a 100644 --- a/app/display/gimpdisplayshell.c +++ b/app/display/gimpdisplayshell.c @@ -663,8 +663,8 @@ gimp_display_shell_new (GimpDisplay *display, shell->display = display; - image_width = display->image->width; - image_height = display->image->height; + image_width = gimp_image_get_width (display->image); + image_height = gimp_image_get_height (display->image); gimp = display->image->gimp; display_config = GIMP_DISPLAY_CONFIG (gimp->config); @@ -1166,16 +1166,16 @@ gimp_display_shell_scale_changed (GimpDisplayShell *shell) image = shell->display->image; - shell->scale_x = (gimp_zoom_model_get_factor (shell->zoom) - * SCREEN_XRES (shell) / image->xresolution); + shell->scale_x = (gimp_zoom_model_get_factor (shell->zoom) * + SCREEN_XRES (shell) / image->xresolution); - shell->scale_y = (gimp_zoom_model_get_factor (shell->zoom) - * SCREEN_YRES (shell) / image->yresolution); + shell->scale_y = (gimp_zoom_model_get_factor (shell->zoom) * + SCREEN_YRES (shell) / image->yresolution); - shell->x_dest_inc = image->width; - shell->y_dest_inc = image->height; - shell->x_src_dec = ceil (image->width * shell->scale_x); - shell->y_src_dec = ceil (image->height * shell->scale_y); + shell->x_dest_inc = gimp_image_get_width (image); + shell->y_dest_inc = gimp_image_get_height (image); + shell->x_src_dec = ceil (gimp_image_get_width (image) * shell->scale_x); + shell->y_src_dec = ceil (gimp_image_get_height (image) * shell->scale_y); } void @@ -1593,8 +1593,8 @@ gimp_display_shell_shrink_wrap (GimpDisplayShell *shell) monitor = gdk_screen_get_monitor_at_window (screen, widget->window); gdk_screen_get_monitor_geometry (screen, monitor, &rect); - width = SCALEX (shell, shell->display->image->width); - height = SCALEY (shell, shell->display->image->height); + width = SCALEX (shell, gimp_image_get_width (shell->display->image)); + height = SCALEY (shell, gimp_image_get_height (shell->display->image)); disp_width = shell->disp_width; disp_height = shell->disp_height; diff --git a/app/display/gimpstatusbar.c b/app/display/gimpstatusbar.c index fdbbf6b5ec..1f5aff9c32 100644 --- a/app/display/gimpstatusbar.c +++ b/app/display/gimpstatusbar.c @@ -902,10 +902,10 @@ gimp_statusbar_update_cursor (GimpStatusbar *statusbar, shell = statusbar->shell; - if (x < 0 || - y < 0 || - x >= shell->display->image->width || - y >= shell->display->image->height) + if (x < 0 || + y < 0 || + x >= gimp_image_get_width (shell->display->image) || + y >= gimp_image_get_height (shell->display->image)) { 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_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)); diff --git a/app/file/file-open.c b/app/file/file-open.c index f25a9c48a5..b0d4b25c63 100644 --- a/app/file/file-open.c +++ b/app/file/file-open.c @@ -281,7 +281,8 @@ file_open_thumbnail (Gimp *gimp, #ifdef GIMP_UNSTABLE g_printerr ("opened thumbnail at %d x %d\n", - image->width, image->height); + gimp_image_get_width (image), + gimp_image_get_height (image)); #endif } } @@ -568,7 +569,10 @@ file_open_sanitize_image (GimpImage *image, * load plug-ins are not required to call gimp_drawable_update() or * 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); /* same for drawable previews */ diff --git a/app/paint/gimppaintoptions.c b/app/paint/gimppaintoptions.c index 28626b25f9..7db2c6e066 100644 --- a/app/paint/gimppaintoptions.c +++ b/app/paint/gimppaintoptions.c @@ -575,7 +575,8 @@ gimp_paint_options_get_fade (GimpPaintOptions *paint_options, fade_out = fade_options->fade_length; break; 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); break; default: @@ -658,7 +659,8 @@ gimp_paint_options_get_gradient_color (GimpPaintOptions *paint_options, gradient_length = gradient_options->gradient_length; break; 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); break; default: diff --git a/app/pdb/guides_cmds.c b/app/pdb/guides_cmds.c index 1de23fd1d1..b7824f781a 100644 --- a/app/pdb/guides_cmds.c +++ b/app/pdb/guides_cmds.c @@ -55,7 +55,7 @@ image_add_hguide_invoker (GimpProcedure *procedure, if (success) { - if (yposition <= image->height) + if (yposition <= gimp_image_get_height (image)) { GimpGuide *g; @@ -93,7 +93,7 @@ image_add_vguide_invoker (GimpProcedure *procedure, if (success) { - if (xposition <= image->width) + if (xposition <= gimp_image_get_width (image)) { GimpGuide *g; diff --git a/app/pdb/image_cmds.c b/app/pdb/image_cmds.c index 52ad59bc3d..23c37113e1 100644 --- a/app/pdb/image_cmds.c +++ b/app/pdb/image_cmds.c @@ -422,10 +422,10 @@ image_crop_invoker (GimpProcedure *procedure, if (success) { - if (new_width > image->width || - new_height > image->height || - offx > (image->width - new_width) || - offy > (image->height - new_height)) + if (new_width > gimp_image_get_width (image) || + new_height > gimp_image_get_height (image) || + offx > (gimp_image_get_width (image) - new_width) || + offy > (gimp_image_get_height (image) - new_height)) success = FALSE; else gimp_image_crop (image, context, diff --git a/app/tools/gimpaligntool.c b/app/tools/gimpaligntool.c index d7664dfcbf..25f1149a64 100644 --- a/app/tools/gimpaligntool.c +++ b/app/tools/gimpaligntool.c @@ -906,7 +906,7 @@ do_alignment (GtkWidget *widget, GList *list; gint offset; - image = GIMP_TOOL (align_tool)->display->image; + image = GIMP_TOOL (align_tool)->display->image; action = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget), "action")); offset = align_tool->horz_offset; @@ -967,34 +967,25 @@ do_alignment (GtkWidget *widget, break; case GIMP_ALIGN_REFERENCE_SELECTION: - if (image->selection_mask) - { - reference_object = G_OBJECT (image->selection_mask); - } - else - return; + reference_object = G_OBJECT (gimp_image_get_mask (image)); break; case GIMP_ALIGN_REFERENCE_ACTIVE_LAYER: - if (image->active_layer) - reference_object = G_OBJECT (image->active_layer); - else - return; + reference_object = G_OBJECT (gimp_image_get_active_layer (image)); break; case GIMP_ALIGN_REFERENCE_ACTIVE_CHANNEL: - if (image->active_channel) - reference_object = G_OBJECT (image->active_channel); - else - return; + reference_object = G_OBJECT (gimp_image_get_active_channel (image)); break; case GIMP_ALIGN_REFERENCE_ACTIVE_PATH: g_print ("reference = active path not yet handled.\n"); - return; break; } + if (! reference_object) + return; + gimp_draw_tool_pause (GIMP_DRAW_TOOL (align_tool)); gimp_image_arrange_objects (image, list, diff --git a/app/tools/gimpcolortool.c b/app/tools/gimpcolortool.c index 67e281c1a1..fdff9b29c4 100644 --- a/app/tools/gimpcolortool.c +++ b/app/tools/gimpcolortool.c @@ -558,15 +558,17 @@ gimp_color_tool_draw (GimpDrawTool *draw_tool) if (color_tool->sample_point_x != -1 && color_tool->sample_point_y != -1) { + GimpImage *image = draw_tool->display->image; + gimp_draw_tool_draw_line (draw_tool, 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, FALSE); gimp_draw_tool_draw_line (draw_tool, color_tool->sample_point_x + 0.5, 0, color_tool->sample_point_x + 0.5, - draw_tool->display->image->height, + gimp_image_get_height (image), FALSE); } } diff --git a/app/tools/gimpeditselectiontool.c b/app/tools/gimpeditselectiontool.c index 1fd10ea699..da99b3bfe0 100644 --- a/app/tools/gimpeditselectiontool.c +++ b/app/tools/gimpeditselectiontool.c @@ -236,8 +236,8 @@ gimp_edit_selection_tool_start (GimpTool *parent_tool, { edit_select->x1 = 0; edit_select->y1 = 0; - edit_select->x2 = display->image->width; - edit_select->y2 = display->image->height; + edit_select->x2 = gimp_image_get_width (display->image); + edit_select->y2 = gimp_image_get_height (display->image); } else { diff --git a/app/tools/gimpiscissorstool.c b/app/tools/gimpiscissorstool.c index 8726c44b2a..c8ed14e747 100644 --- a/app/tools/gimpiscissorstool.c +++ b/app/tools/gimpiscissorstool.c @@ -440,8 +440,10 @@ gimp_iscissors_tool_button_press (GimpTool *tool, &iscissors->x, &iscissors->y); - iscissors->x = CLAMP (iscissors->x, 0, display->image->width - 1); - iscissors->y = CLAMP (iscissors->y, 0, display->image->height - 1); + iscissors->x = CLAMP (iscissors->x, + 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->iy = iscissors->y; @@ -530,8 +532,8 @@ iscissors_convert (GimpIscissorsTool *iscissors, g_object_unref (iscissors->mask); iscissors->mask = gimp_channel_new_mask (display->image, - display->image->width, - display->image->height); + gimp_image_get_width (display->image), + gimp_image_get_height (display->image)); gimp_scan_convert_render (sc, gimp_drawable_get_tiles (GIMP_DRAWABLE (iscissors->mask)), 0, 0, options->antialias); @@ -693,8 +695,10 @@ gimp_iscissors_tool_motion (GimpTool *tool, find_max_gradient (iscissors, display->image, &iscissors->x, &iscissors->y); - iscissors->x = CLAMP (iscissors->x, 0, display->image->width - 1); - iscissors->y = CLAMP (iscissors->y, 0, display->image->height - 1); + iscissors->x = CLAMP (iscissors->x, + 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) { @@ -709,8 +713,10 @@ gimp_iscissors_tool_motion (GimpTool *tool, find_max_gradient (iscissors, display->image, &iscissors->x, &iscissors->y); - iscissors->x = CLAMP (iscissors->x, 0, display->image->width - 1); - iscissors->y = CLAMP (iscissors->y, 0, display->image->height - 1); + iscissors->x = CLAMP (iscissors->x, + 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->ny = iscissors->y; @@ -1358,10 +1364,10 @@ calculate_curve (GimpTool *tool, display = tool->display; /* Get the bounding box */ - xs = CLAMP (curve->x1, 0, display->image->width - 1); - ys = CLAMP (curve->y1, 0, display->image->height - 1); - xe = CLAMP (curve->x2, 0, display->image->width - 1); - ye = CLAMP (curve->y2, 0, display->image->height - 1); + xs = CLAMP (curve->x1, 0, gimp_image_get_width (display->image) - 1); + ys = CLAMP (curve->y1, 0, gimp_image_get_height (display->image) - 1); + xe = CLAMP (curve->x2, 0, gimp_image_get_width (display->image) - 1); + ye = CLAMP (curve->y2, 0, gimp_image_get_height (display->image) - 1); x1 = MIN (xs, xe); y1 = MIN (ys, ye); 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; if (xe >= xs) - x2 += CLAMP (ewidth, 0, display->image->width - x2); + x2 += CLAMP (ewidth, 0, gimp_image_get_width (display->image) - x2); else x1 -= CLAMP (ewidth, 0, x1); + if (ye >= ys) - y2 += CLAMP (eheight, 0, display->image->height - y2); + y2 += CLAMP (eheight, 0, gimp_image_get_height (display->image) - y2); else y1 -= CLAMP (eheight, 0, y1); @@ -1861,7 +1868,8 @@ gradient_map_new (GimpImage *image) { 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); tile_manager_set_validate_proc (tm, @@ -1894,14 +1902,14 @@ find_max_gradient (GimpIscissorsTool *iscissors, radius = GRADIENT_SEARCH >> 1; /* calculate the extent of the search */ - cx = CLAMP (*x, 0, image->width); - cy = CLAMP (*y, 0, image->height); + cx = CLAMP (*x, 0, gimp_image_get_width (image)); + cy = CLAMP (*y, 0, gimp_image_get_height (image)); sx = cx - radius; sy = cy - radius; - x1 = CLAMP (cx - radius, 0, image->width); - y1 = CLAMP (cy - radius, 0, image->height); - x2 = CLAMP (cx + radius, 0, image->width); - y2 = CLAMP (cy + radius, 0, image->height); + x1 = CLAMP (cx - radius, 0, gimp_image_get_width (image)); + y1 = CLAMP (cy - radius, 0, gimp_image_get_height (image)); + x2 = CLAMP (cx + radius, 0, gimp_image_get_width (image)); + y2 = CLAMP (cy + radius, 0, gimp_image_get_height (image)); /* calculate the factor to multiply the distance from the cursor by */ max_gradient = 0; diff --git a/app/tools/gimpmeasuretool.c b/app/tools/gimpmeasuretool.c index c04234eb7d..d02d95f82c 100644 --- a/app/tools/gimpmeasuretool.c +++ b/app/tools/gimpmeasuretool.c @@ -224,13 +224,13 @@ gimp_measure_tool_button_press (GimpTool *tool, (measure->y[i] == CLAMP (measure->y[i], 0, - display->image->height))); + gimp_image_get_height (display->image)))); create_vguide = ((state & GDK_MOD1_MASK) && (measure->x[i] == CLAMP (measure->x[i], 0, - display->image->width))); + gimp_image_get_width (display->image)))); if (create_hguide && create_vguide) gimp_image_undo_group_start (display->image, diff --git a/app/tools/gimpmovetool.c b/app/tools/gimpmovetool.c index 4c5711b14b..c62341b4f2 100644 --- a/app/tools/gimpmovetool.c +++ b/app/tools/gimpmovetool.c @@ -762,12 +762,14 @@ gimp_move_tool_draw (GimpDrawTool *draw_tool) if (move->moving_guide && move->guide_position != -1) { + GimpImage *image = draw_tool->display->image; + switch (move->guide_orientation) { case GIMP_ORIENTATION_HORIZONTAL: gimp_draw_tool_draw_line (draw_tool, 0, move->guide_position, - draw_tool->display->image->width, + gimp_image_get_width (image), move->guide_position, FALSE); break; @@ -776,7 +778,7 @@ gimp_move_tool_draw (GimpDrawTool *draw_tool) gimp_draw_tool_draw_line (draw_tool, move->guide_position, 0, move->guide_position, - draw_tool->display->image->height, + gimp_image_get_height (image), FALSE); break; diff --git a/app/tools/gimpperspectiveclonetool.c b/app/tools/gimpperspectiveclonetool.c index 18d57976e5..130d4da0e8 100644 --- a/app/tools/gimpperspectiveclonetool.c +++ b/app/tools/gimpperspectiveclonetool.c @@ -876,8 +876,8 @@ gimp_perspective_clone_tool_bounds (GimpPerspectiveCloneTool *tool, tool->x1 = 0; tool->y1 = 0; - tool->x2 = display->image->width; - tool->y2 = display->image->height; + tool->x2 = gimp_image_get_width (display->image); + tool->y2 = gimp_image_get_height (display->image); } static void diff --git a/app/tools/gimprectangleselecttool.c b/app/tools/gimprectangleselecttool.c index 75ca892000..f96830ed4d 100644 --- a/app/tools/gimprectangleselecttool.c +++ b/app/tools/gimprectangleselecttool.c @@ -579,9 +579,12 @@ gimp_rect_select_tool_select (GimpRectangleTool *rectangle, gimp_tool_pop_status (tool, tool->display); - rectangle_exists = (x <= image->width && y <= image->height && - x + w >= 0 && y + h >= 0 && - w > 0 && h > 0); + rectangle_exists = (x <= gimp_image_get_width (image) && + y <= gimp_image_get_height (image) && + x + w >= 0 && + y + h >= 0 && + w > 0 && + h > 0); if (priv->use_saved_op) operation = priv->operation; diff --git a/app/tools/gimprectangletool.c b/app/tools/gimprectangletool.c index c02a8bae7d..69eb8cb1f1 100644 --- a/app/tools/gimprectangletool.c +++ b/app/tools/gimprectangletool.c @@ -611,8 +611,8 @@ gimp_rectangle_tool_constraint_size_set (GimpRectangleTool *rect_tool, case GIMP_RECTANGLE_CONSTRAIN_IMAGE: default: { - width = image->width; - height = image->height; + width = gimp_image_get_width (image); + height = gimp_image_get_height (image); } 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), 0, display->image->xresolution, FALSE); 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) @@ -1943,7 +1943,7 @@ gimp_rectangle_tool_start (GimpRectangleTool *rect_tool, gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (options_private->fixed_height_entry), 0, display->image->yresolution, FALSE); 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) @@ -1951,7 +1951,7 @@ gimp_rectangle_tool_start (GimpRectangleTool *rect_tool, gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (options_private->x_entry), 0, display->image->xresolution, FALSE); 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) @@ -1959,7 +1959,7 @@ gimp_rectangle_tool_start (GimpRectangleTool *rect_tool, gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (options_private->y_entry), 0, display->image->yresolution, FALSE); 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) @@ -1967,7 +1967,7 @@ gimp_rectangle_tool_start (GimpRectangleTool *rect_tool, gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (options_private->width_entry), 0, display->image->xresolution, FALSE); 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) @@ -1975,7 +1975,7 @@ gimp_rectangle_tool_start (GimpRectangleTool *rect_tool, gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (options_private->height_entry), 0, display->image->yresolution, FALSE); 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) @@ -2409,8 +2409,8 @@ gimp_rectangle_tool_auto_shrink (GimpRectangleTool *rect_tool) if (! display) return; - width = display->image->width; - height = display->image->height; + width = gimp_image_get_width (display->image); + height = gimp_image_get_height (display->image); g_object_get (gimp_tool_get_options (tool), "shrink-merged", &shrink_merged, @@ -3815,8 +3815,8 @@ gimp_rectangle_tool_apply_fixed_rule (GimpRectangleTool *rect_tool) aspect = CLAMP (options_private->aspect_numerator / options_private->aspect_denominator, - 1.0 / tool->display->image->height, - tool->display->image->width); + 1.0 / gimp_image_get_height (tool->display->image), + gimp_image_get_width (tool->display->image)); 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: *min_x = 0; *min_y = 0; - *max_x = tool->display->image->width; - *max_y = tool->display->image->height; + *max_x = gimp_image_get_width (tool->display->image); + *max_y = gimp_image_get_height (tool->display->image); break; case GIMP_RECTANGLE_CONSTRAIN_DRAWABLE: diff --git a/app/tools/gimprotatetool.c b/app/tools/gimprotatetool.c index bd666a3855..c9ddd059be 100644 --- a/app/tools/gimprotatetool.c +++ b/app/tools/gimprotatetool.c @@ -218,10 +218,12 @@ gimp_rotate_tool_prepare (GimpTransformTool *tr_tool, gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (rotate->sizeentry), 0, -65536, - 65536 + display->image->width); + 65536 + + gimp_image_get_width (display->image)); gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (rotate->sizeentry), 1, -65536, - 65536 + display->image->height); + 65536 + + gimp_image_get_height (display->image)); gimp_size_entry_set_size (GIMP_SIZE_ENTRY (rotate->sizeentry), 0, tr_tool->x1, tr_tool->x2); diff --git a/app/vectors/gimpvectors-export.c b/app/vectors/gimpvectors-export.c index 02024f186c..821f77e63b 100644 --- a/app/vectors/gimpvectors-export.c +++ b/app/vectors/gimpvectors-export.c @@ -139,7 +139,8 @@ gimp_vectors_export (const GimpImage *image, g_string_append_printf (str, " viewBox=\"0 0 %d %d\">\n", - image->width, image->height); + gimp_image_get_width (image), + gimp_image_get_height (image)); if (vectors) { @@ -168,8 +169,8 @@ gimp_vectors_export_image_size (const GimpImage *image, gchar hbuf[G_ASCII_DTOSTR_BUF_SIZE]; gdouble w, h; - w = (gdouble) image->width / image->xresolution; - h = (gdouble) image->height / image->yresolution; + w = (gdouble) gimp_image_get_width (image) / image->xresolution; + h = (gdouble) gimp_image_get_height (image) / image->yresolution; /* FIXME: should probably use the display unit here */ unit = gimp_image_get_unit (image); diff --git a/app/vectors/gimpvectors-import.c b/app/vectors/gimpvectors-import.c index 3bfcb0b735..16f5eb70d5 100644 --- a/app/vectors/gimpvectors-import.c +++ b/app/vectors/gimpvectors-import.c @@ -268,8 +268,8 @@ gimp_vectors_import (GimpImage *image, /* the base of the stack, defines the size of the view-port */ base = g_slice_new0 (SvgHandler); base->name = "image"; - base->width = image->width; - base->height = image->height; + base->width = gimp_image_get_width (image); + base->height = gimp_image_get_height (image); g_queue_push_head (parser.stack, base); @@ -533,8 +533,8 @@ svg_handler_svg_start (SvgHandler *handler, { if (w > 0.0 && h > 0.0) gimp_matrix3_scale (matrix, - parser->image->width / w, - parser->image->height / h); + gimp_image_get_width (parser->image) / w, + gimp_image_get_height (parser->image) / h); } handler->width = w; diff --git a/app/vectors/gimpvectors.c b/app/vectors/gimpvectors.c index c2c24336bb..5b1a12609b 100644 --- a/app/vectors/gimpvectors.c +++ b/app/vectors/gimpvectors.c @@ -296,8 +296,8 @@ static void gimp_vectors_convert (GimpItem *item, GimpImage *dest_image) { - item->width = dest_image->width; - item->height = dest_image->height; + item->width = gimp_image_get_width (dest_image); + item->height = gimp_image_get_height (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_ITEM_CLASS (parent_class)->scale (item, image->width, image->height, - 0, 0, interpolation_type, progress); + GIMP_ITEM_CLASS (parent_class)->scale (item, + gimp_image_get_width (image), + gimp_image_get_height (image), + 0, 0, + interpolation_type, progress); gimp_vectors_thaw (vectors); } @@ -387,7 +390,9 @@ gimp_vectors_resize (GimpItem *item, } 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); } @@ -552,7 +557,9 @@ gimp_vectors_new (GimpImage *image, vectors = g_object_new (GIMP_TYPE_VECTORS, NULL); 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); return vectors; diff --git a/app/widgets/gimpimagepropview.c b/app/widgets/gimpimagepropview.c index 263dead2ea..dcf443bd68 100644 --- a/app/widgets/gimpimagepropview.c +++ b/app/widgets/gimpimagepropview.c @@ -39,6 +39,7 @@ #include "core/gimp.h" #include "core/gimpcontainer.h" #include "core/gimpimage.h" +#include "core/gimpimage-colormap.h" #include "core/gimpundostack.h" #include "core/gimpunit.h" #include "core/gimp-utils.h" @@ -439,8 +440,10 @@ gimp_image_prop_view_update (GimpImagePropView *view) /* pixel size */ g_snprintf (buf, sizeof (buf), ngettext ("%d × %d pixel", - "%d × %d pixels", image->height), - image->width, image->height); + "%d × %d pixels", + 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); /* print size */ @@ -453,8 +456,8 @@ gimp_image_prop_view_update (GimpImagePropView *view) unit_digits + 1, unit_digits + 1, _gimp_unit_get_plural (image->gimp, unit)); g_snprintf (buf, sizeof (buf), format_buf, - image->width * unit_factor / image->xresolution, - image->height * unit_factor / image->yresolution); + gimp_image_get_width (image) * unit_factor / image->xresolution, + gimp_image_get_height (image) * unit_factor / image->yresolution); gtk_label_set_text (GTK_LABEL (view->print_size_label), buf); /* resolution */ @@ -483,7 +486,8 @@ gimp_image_prop_view_update (GimpImagePropView *view) break; case GIMP_INDEXED: 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; } @@ -498,7 +502,9 @@ gimp_image_prop_view_update (GimpImagePropView *view) gimp_image_prop_view_label_set_undo (view->redo_label, image->redo_stack); /* 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); /* number of layers */ diff --git a/app/widgets/gimpnavigationview.c b/app/widgets/gimpnavigationview.c index 4f60940bc0..52abdb1a4e 100644 --- a/app/widgets/gimpnavigationview.c +++ b/app/widgets/gimpnavigationview.c @@ -225,13 +225,13 @@ gimp_navigation_view_move_to (GimpNavigationView *nav_view, /* transform to image coordinates */ 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)); else ratiox = 1.0; 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)); else ratioy = 1.0; @@ -481,8 +481,10 @@ gimp_navigation_view_transform (GimpNavigationView *nav_view) image = GIMP_IMAGE (view->renderer->viewable); - ratiox = ((gdouble) view->renderer->width / (gdouble) image->width); - ratioy = ((gdouble) view->renderer->height / (gdouble) image->height); + ratiox = ((gdouble) view->renderer->width / + (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_y = RINT (nav_view->y * ratioy); @@ -505,10 +507,10 @@ gimp_navigation_view_draw_marker (GimpNavigationView *nav_view, image = GIMP_IMAGE (view->renderer->viewable); - if (nav_view->x > 0 || - nav_view->y > 0 || - nav_view->width < image->width || - nav_view->height < image->height) + if (nav_view->x > 0 || + nav_view->y > 0 || + nav_view->width < gimp_image_get_width (image) || + nav_view->height < gimp_image_get_height (image)) { GtkWidget *widget = GTK_WIDGET (view); @@ -550,17 +552,19 @@ gimp_navigation_view_set_marker (GimpNavigationView *nav_view, if (GTK_WIDGET_DRAWABLE (view)) gimp_navigation_view_draw_marker (nav_view, NULL); - nav_view->x = CLAMP (x, 0.0, image->width - 1.0); - nav_view->y = CLAMP (y, 0.0, image->height - 1.0); + nav_view->x = CLAMP (x, 0.0, gimp_image_get_width (image) - 1.0); + nav_view->y = CLAMP (y, 0.0, gimp_image_get_height (image) - 1.0); if (width < 0.0) - width = image->width; + width = gimp_image_get_width (image); 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->height = CLAMP (height, 1.0, image->height - nav_view->y); + nav_view->width = CLAMP (width, 1.0, + 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); diff --git a/app/widgets/gimpselectioneditor.c b/app/widgets/gimpselectioneditor.c index 36ad07a6c2..18495530ac 100644 --- a/app/widgets/gimpselectioneditor.c +++ b/app/widgets/gimpselectioneditor.c @@ -294,8 +294,8 @@ gimp_selection_view_button_press (GtkWidget *widget, operation = GIMP_CHANNEL_OP_SUBTRACT; } - x = image_editor->image->width * bevent->x / renderer->width; - y = image_editor->image->height * bevent->y / renderer->height; + x = gimp_image_get_width (image_editor->image) * bevent->x / renderer->width; + y = gimp_image_get_height (image_editor->image) * bevent->y / renderer->height; if (gimp_image_pick_color (image_editor->image, drawable, x, y, options->sample_merged, diff --git a/app/widgets/gimpviewrendererdrawable.c b/app/widgets/gimpviewrendererdrawable.c index cf91091b05..a1338aa359 100644 --- a/app/widgets/gimpviewrendererdrawable.c +++ b/app/widgets/gimpviewrendererdrawable.c @@ -83,9 +83,11 @@ gimp_view_renderer_drawable_render (GimpViewRenderer *renderer, 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)))); - 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)))); 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_height (item), -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_width, &src_height)) { @@ -136,10 +139,10 @@ gimp_view_renderer_drawable_render (GimpViewRenderer *renderer, gint dest_height; dest_width = ROUND (((gdouble) renderer->width / - (gdouble) image->width) * + (gdouble) gimp_image_get_width (image)) * (gdouble) src_width); dest_height = ROUND (((gdouble) renderer->height / - (gdouble) image->height) * + (gdouble) gimp_image_get_height (image)) * (gdouble) src_height); if (dest_width < 1) dest_width = 1; @@ -189,12 +192,14 @@ gimp_view_renderer_drawable_render (GimpViewRenderer *renderer, { if (item->offset_x != 0) render_buf->x = - ROUND ((((gdouble) renderer->width / (gdouble) image->width) * + ROUND ((((gdouble) renderer->width / + (gdouble) gimp_image_get_width (image)) * (gdouble) item->offset_x)); if (item->offset_y != 0) render_buf->y = - ROUND ((((gdouble) renderer->height / (gdouble) image->height) * + ROUND ((((gdouble) renderer->height / + (gdouble) gimp_image_get_height (image)) * (gdouble) item->offset_y)); if (scaling_up) diff --git a/app/widgets/gimpviewrendererimage.c b/app/widgets/gimpviewrendererimage.c index 19258cf445..4caaff8c85 100644 --- a/app/widgets/gimpviewrendererimage.c +++ b/app/widgets/gimpviewrendererimage.c @@ -80,8 +80,8 @@ gimp_view_renderer_image_render (GimpViewRenderer *renderer, gboolean scaling_up; TempBuf *render_buf = NULL; - gimp_viewable_calc_preview_size (image->width, - image->height, + gimp_viewable_calc_preview_size (gimp_image_get_width (image), + gimp_image_get_height (image), renderer->width, renderer->height, renderer->dot_for_dot, @@ -97,8 +97,8 @@ gimp_view_renderer_image_render (GimpViewRenderer *renderer, temp_buf = gimp_viewable_get_new_preview (renderer->viewable, renderer->context, - image->width, - image->height); + gimp_image_get_width (image), + gimp_image_get_height (image)); if (temp_buf) { diff --git a/app/xcf/xcf-load.c b/app/xcf/xcf-load.c index 76185a8029..7476f62e92 100644 --- a/app/xcf/xcf-load.c +++ b/app/xcf/xcf-load.c @@ -239,7 +239,7 @@ xcf_load_image (Gimp *gimp, xcf_progress_update (info); /* 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_container_num_children (image->channels)); @@ -786,21 +786,26 @@ xcf_load_channel_props (XcfInfo *info, break; case PROP_SELECTION: - g_object_unref (image->selection_mask); - image->selection_mask = - gimp_selection_new (image, - gimp_item_width (GIMP_ITEM (*channel)), - gimp_item_height (GIMP_ITEM (*channel))); - g_object_ref_sink (image->selection_mask); + { + GimpChannel *mask; - tile_manager_unref (GIMP_DRAWABLE (image->selection_mask)->tiles); - GIMP_DRAWABLE (image->selection_mask)->tiles = - GIMP_DRAWABLE (*channel)->tiles; - GIMP_DRAWABLE (*channel)->tiles = NULL; - g_object_unref (*channel); - *channel = image->selection_mask; - (*channel)->boundary_known = FALSE; - (*channel)->bounds_known = FALSE; + g_object_unref (gimp_image_get_mask (image)); + + mask = image->selection_mask = + gimp_selection_new (image, + gimp_item_width (GIMP_ITEM (*channel)), + gimp_item_height (GIMP_ITEM (*channel))); + g_object_ref_sink (mask); + + tile_manager_unref (GIMP_DRAWABLE (mask)->tiles); + GIMP_DRAWABLE (mask)->tiles = + GIMP_DRAWABLE (*channel)->tiles; + GIMP_DRAWABLE (*channel)->tiles = NULL; + g_object_unref (*channel); + *channel = mask; + (*channel)->boundary_known = FALSE; + (*channel)->bounds_known = FALSE; + } break; case PROP_OPACITY: diff --git a/app/xcf/xcf-save.c b/app/xcf/xcf-save.c index 53a43b95c7..ec1c6749cc 100644 --- a/app/xcf/xcf-save.c +++ b/app/xcf/xcf-save.c @@ -183,7 +183,7 @@ xcf_save_choose_format (XcfInfo *info, GList *list; gint save_version = 0; /* default to oldest */ - if (image->cmap) + if (gimp_image_get_colormap (image)) save_version = 1; /* need version 1 for colormaps */ 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); /* write out the width, height and image type information for the image */ - xcf_write_int32_check_error (info, (guint32 *) &image->width, 1); - xcf_write_int32_check_error (info, (guint32 *) &image->height, 1); + value = gimp_image_get_width (image); + 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); /* determine the number of layers and channels in the image */ @@ -337,7 +340,7 @@ xcf_save_image (XcfInfo *info, } else { - channel = image->selection_mask; + channel = gimp_image_get_mask (image); have_selection = FALSE; } @@ -552,7 +555,7 @@ xcf_save_channel_props (XcfInfo *info, if (channel == gimp_image_get_active_channel (image)) 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_OPACITY, error, diff --git a/tools/pdbgen/pdb/guides.pdb b/tools/pdbgen/pdb/guides.pdb index c18084efcb..6e5cfa96dc 100644 --- a/tools/pdbgen/pdb/guides.pdb +++ b/tools/pdbgen/pdb/guides.pdb @@ -43,7 +43,7 @@ HELP %invoke = ( code => <<'CODE' { - if (yposition <= image->height) + if (yposition <= gimp_image_get_height (image)) { GimpGuide *g; @@ -83,7 +83,7 @@ HELP %invoke = ( code => <<'CODE' { - if (xposition <= image->width) + if (xposition <= gimp_image_get_width (image)) { GimpGuide *g; diff --git a/tools/pdbgen/pdb/image.pdb b/tools/pdbgen/pdb/image.pdb index 8bf4e4c677..85c6f1ec91 100644 --- a/tools/pdbgen/pdb/image.pdb +++ b/tools/pdbgen/pdb/image.pdb @@ -320,10 +320,10 @@ HELP headers => [ qw("core/gimpimage-crop.h") ], code => <<'CODE' { - if (new_width > image->width || - new_height > image->height || - offx > (image->width - new_width) || - offy > (image->height - new_height)) + if (new_width > gimp_image_get_width (image) || + new_height > gimp_image_get_height (image) || + offx > (gimp_image_get_width (image) - new_width) || + offy > (gimp_image_get_height (image) - new_height)) success = FALSE; else gimp_image_crop (image, context,