diff --git a/ChangeLog b/ChangeLog index cd7f0a145c..eb114bbf85 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2000-12-13 Sven Neumann + + * app/color_picker.c + * app/convert.c + * app/curves.c + * app/gimpdrawable.c + * app/gimpimage.c + * app/gimpimage.h + * app/image_map.c + * app/info_window.c + * app/layer.c + * app/undo.c: couldn't resist: renamed TYPE_HAS_ALPHA() to + GIMP_IMAGE_TYPE_HAS_ALPHA() + + * plug-ins/common/sunras.c + * plug-ins/common/xwd.c: small cleanups + 2000-12-13 Vidar Madsen * plug-ins/common/spheredesigner.c: Small algo improvements. diff --git a/app/base/curves.c b/app/base/curves.c index 7df06a9e7a..ed78ffc324 100644 --- a/app/base/curves.c +++ b/app/base/curves.c @@ -135,22 +135,24 @@ static void curves_write_to_file (FILE *f); /* curves machinery */ -float +gfloat curves_lut_func (CurvesDialog *cd, gint nchannels, gint channel, gfloat value) { - float f; - int index; - double inten; - int j; + gfloat f; + gint index; + gdouble inten; + gint j; if (nchannels == 1) j = 0; else j = channel + 1; + inten = value; + /* For color images this runs through the loop with j = channel +1 the first time and j = 0 the second time */ /* For bw images this runs through the loop with j = 0 the first and @@ -184,12 +186,13 @@ curves_colour_update (Tool *tool, gint x, gint y) { - unsigned char *color; - int offx, offy; - int has_alpha; - int is_indexed; - int sample_type; - int maxval; + guchar *color; + gint offx; + gint offy; + gint maxval; + gboolean has_alpha; + gboolean is_indexed; + GimpImageType sample_type; if(!tool || tool->state != ACTIVE) return; @@ -203,8 +206,8 @@ curves_colour_update (Tool *tool, return; sample_type = gimp_drawable_type (drawable); - is_indexed = gimp_drawable_is_indexed (drawable); - has_alpha = TYPE_HAS_ALPHA (sample_type); + is_indexed = gimp_drawable_is_indexed (drawable); + has_alpha = GIMP_IMAGE_TYPE_HAS_ALPHA (sample_type); curves_dialog->col_value[HISTOGRAM_RED] = color[RED_PIX]; curves_dialog->col_value[HISTOGRAM_GREEN] = color[GREEN_PIX]; @@ -231,10 +234,10 @@ curves_add_point (GimpDrawable *drawable, gint cchan) { /* Add point onto the curve */ - int closest_point = 0; - int distance; - int curvex; - int i; + gint closest_point = 0; + gint distance; + gint curvex; + gint i; switch (curves_dialog->curve_type[cchan]) { @@ -271,9 +274,9 @@ curves_button_press (Tool *tool, GdkEventButton *bevent, gpointer gdisp_ptr) { - GDisplay *gdisp; gint x, y; - GimpDrawable * drawable; + GDisplay *gdisp; + GimpDrawable *drawable; gdisp = gdisp_ptr; drawable = gimage_active_drawable (gdisp->gimage); @@ -307,8 +310,8 @@ curves_button_release (Tool *tool, gpointer gdisp_ptr) { gint x, y; - GimpDrawable * drawable; - GDisplay *gdisp; + GimpDrawable *drawable; + GDisplay *gdisp; gdisp = (GDisplay *) gdisp_ptr; @@ -343,9 +346,9 @@ curves_motion (Tool *tool, GdkEventMotion *mevent, gpointer gdisp_ptr) { - GDisplay *gdisp; gint x, y; - GimpDrawable * drawable; + GDisplay *gdisp; + GimpDrawable *drawable; gdisp = (GDisplay *) gdisp_ptr; @@ -384,8 +387,8 @@ curves_control (Tool *tool, Tool * tools_new_curves (void) { - Tool * tool; - Curves * private; + Tool *tool; + Curves *private; /* The tool options */ if (!curves_options) @@ -420,7 +423,7 @@ curves_dialog_hide (void) void tools_free_curves (Tool *tool) { - Curves * private; + Curves *private; private = (Curves *) tool->private; @@ -722,10 +725,10 @@ curve_print_loc (CurvesDialog *cd, gint xpos, gint ypos) { - char buf[32]; - gint width; - gint ascent; - gint descent; + gchar buf[32]; + gint width; + gint ascent; + gint descent; if (cd->cursor_ind_width < 0) { @@ -771,12 +774,12 @@ curve_print_loc (CurvesDialog *cd, /* TODO: preview alpha channel stuff correctly. -- austin, 20/May/99 */ static void curves_update (CurvesDialog *cd, - int update) + gint update) { GdkRectangle area; - gint i, j; - gchar buf[32]; - gint offset; + gint i, j; + gchar buf[32]; + gint offset; gint sel_channel; if(cd->color) { @@ -1155,7 +1158,7 @@ curves_smooth_callback (GtkWidget *widget, gpointer data) { CurvesDialog *cd; - int i; + gint i; gint32 index; cd = (CurvesDialog *) data; @@ -1202,7 +1205,7 @@ curves_free_callback (GtkWidget *widget, static void curves_channel_reset (int i) { - int j; + gint j; curves_dialog->grab_point = -1; @@ -1223,7 +1226,7 @@ curves_reset_callback (GtkWidget *widget, gpointer data) { CurvesDialog *cd; - int i; + gint i; cd = (CurvesDialog *) data; @@ -1356,12 +1359,12 @@ curves_graph_events (GtkWidget *widget, GdkCursorType new_type; GdkEventButton *bevent; GdkEventMotion *mevent; - int i; - int tx, ty; - int x, y; - int closest_point; - int distance; - int x1, x2, y1, y2; + gint i; + gint tx, ty; + gint x, y; + gint closest_point; + gint distance; + gint x1, x2, y1, y2; new_type = GDK_X_CURSOR; closest_point = 0; @@ -1693,11 +1696,12 @@ file_dialog_cancel_callback (GtkWidget *widget, static gboolean curves_read_from_file (FILE *f) { - gint i, j, fields; + gint i, j; + gint fields; gchar buf[50]; - gint index[5][17]; - gint value[5][17]; - gint current_channel; + gint index[5][17]; + gint value[5][17]; + gint current_channel; if (!fgets (buf, 50, f)) return FALSE; @@ -1750,7 +1754,7 @@ curves_read_from_file (FILE *f) static void curves_write_to_file (FILE *f) { - int i, j; + gint i, j; gint32 index; for (i = 0; i < 5; i++) diff --git a/app/color_picker.c b/app/color_picker.c index 92dfb0c68f..97581b7b2a 100644 --- a/app/color_picker.c +++ b/app/color_picker.c @@ -508,7 +508,7 @@ pick_color_do (GimpImage *gimage, get_color_obj = GTK_OBJECT (gimage); } - has_alpha = TYPE_HAS_ALPHA (sample_type); + has_alpha = GIMP_IMAGE_TYPE_HAS_ALPHA (sample_type); if (!(color = (*get_color_func) (get_color_obj, x, y))) return FALSE; diff --git a/app/convert.c b/app/convert.c index 76b5a93b16..f0f17e7e47 100644 --- a/app/convert.c +++ b/app/convert.c @@ -1362,10 +1362,10 @@ convert_image (GImage *gimage, /* Push the layer on the undo stack */ undo_push_layer_mod (gimage, layer); - GIMP_DRAWABLE(layer)->tiles = new_tiles; - GIMP_DRAWABLE(layer)->bytes = new_layer_bytes; - GIMP_DRAWABLE(layer)->type = new_layer_type; - GIMP_DRAWABLE(layer)->has_alpha = TYPE_HAS_ALPHA(new_layer_type); + GIMP_DRAWABLE (layer)->tiles = new_tiles; + GIMP_DRAWABLE (layer)->bytes = new_layer_bytes; + GIMP_DRAWABLE (layer)->type = new_layer_type; + GIMP_DRAWABLE (layer)->has_alpha = GIMP_IMAGE_TYPE_HAS_ALPHA (new_layer_type); } /* colourmap stuff */ diff --git a/app/core/gimpdrawable.c b/app/core/gimpdrawable.c index 0946c62f73..494cf27811 100644 --- a/app/core/gimpdrawable.c +++ b/app/core/gimpdrawable.c @@ -433,7 +433,7 @@ gimp_drawable_get_color_at (GimpDrawable *drawable, gimp_image_get_color (gimp_drawable_gimage (drawable), gimp_drawable_type (drawable), dest, src); - if (TYPE_HAS_ALPHA (gimp_drawable_type (drawable))) + if (GIMP_IMAGE_TYPE_HAS_ALPHA (gimp_drawable_type (drawable))) dest[3] = src[gimp_drawable_bytes (drawable) - 1]; else dest[3] = 255; diff --git a/app/core/gimpimage-convert.c b/app/core/gimpimage-convert.c index 76b5a93b16..f0f17e7e47 100644 --- a/app/core/gimpimage-convert.c +++ b/app/core/gimpimage-convert.c @@ -1362,10 +1362,10 @@ convert_image (GImage *gimage, /* Push the layer on the undo stack */ undo_push_layer_mod (gimage, layer); - GIMP_DRAWABLE(layer)->tiles = new_tiles; - GIMP_DRAWABLE(layer)->bytes = new_layer_bytes; - GIMP_DRAWABLE(layer)->type = new_layer_type; - GIMP_DRAWABLE(layer)->has_alpha = TYPE_HAS_ALPHA(new_layer_type); + GIMP_DRAWABLE (layer)->tiles = new_tiles; + GIMP_DRAWABLE (layer)->bytes = new_layer_bytes; + GIMP_DRAWABLE (layer)->type = new_layer_type; + GIMP_DRAWABLE (layer)->has_alpha = GIMP_IMAGE_TYPE_HAS_ALPHA (new_layer_type); } /* colourmap stuff */ diff --git a/app/core/gimpimage-guides.c b/app/core/gimpimage-guides.c index da18b3bb7a..87f7d84aa9 100644 --- a/app/core/gimpimage-guides.c +++ b/app/core/gimpimage-guides.c @@ -960,16 +960,15 @@ gimp_image_get_color_at (GimpImage *gimage, g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL); if (x < 0 || y < 0 || x >= gimage->width || y >= gimage->height) - { - return NULL; - } + return NULL; + dest = g_new (unsigned char, 5); tile = tile_manager_get_tile (gimp_image_composite (gimage), x, y, TRUE, FALSE); src = tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT); gimp_image_get_color (gimage, gimp_image_composite_type (gimage), dest, src); - if (TYPE_HAS_ALPHA (gimp_image_composite_type (gimage))) + if (GIMP_IMAGE_TYPE_HAS_ALPHA (gimp_image_composite_type (gimage))) dest[3] = src[gimp_image_composite_bytes (gimage) - 1]; else dest[3] = 255; @@ -3696,7 +3695,6 @@ gimp_image_construct_composite_preview (GimpImage *gimage, g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL); - list = gimage->layers; ratio = (gdouble) width / (gdouble) gimage->width; switch (gimp_image_base_type (gimage)) @@ -3718,7 +3716,7 @@ gimp_image_construct_composite_preview (GimpImage *gimage, memset (temp_buf_data (comp), 0, comp->width * comp->height * comp->bytes); floating_sel = NULL; - while (list) + for (list = gimage->layers; list; list = g_slist_next (list)) { layer = (Layer *) list->data; @@ -3738,8 +3736,6 @@ gimp_image_construct_composite_preview (GimpImage *gimage, reverse_list = g_slist_prepend (reverse_list, layer); } } - - list = g_slist_next (list); } construct_flag = 0; diff --git a/app/core/gimpimage-guides.h b/app/core/gimpimage-guides.h index d5161d7be1..381cb6639d 100644 --- a/app/core/gimpimage-guides.h +++ b/app/core/gimpimage-guides.h @@ -15,6 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + #ifndef __GIMPIMAGE_H__ #define __GIMPIMAGE_H__ @@ -38,7 +39,7 @@ #define GIMP_IMAGE(obj) GTK_CHECK_CAST (obj, GIMP_TYPE_IMAGE, GimpImage) #define GIMP_IS_IMAGE(obj) GTK_CHECK_TYPE (obj, GIMP_TYPE_IMAGE) -#define TYPE_HAS_ALPHA(t) ((t)==RGBA_GIMAGE || (t)==GRAYA_GIMAGE || (t)==INDEXEDA_GIMAGE) +#define GIMP_IMAGE_TYPE_HAS_ALPHA(t) ((t)==RGBA_GIMAGE || (t)==GRAYA_GIMAGE || (t)==INDEXEDA_GIMAGE) #define GRAY_PIX 0 #define ALPHA_G_PIX 1 @@ -237,27 +238,30 @@ Channel * gimp_image_remove_channel (GimpImage *, Channel *); void gimp_image_construct (GimpImage *, gint, gint, gint, gint, gboolean); + void gimp_image_invalidate_without_render (GimpImage *, gint, gint, gint, gint, gint, gint, gint, gint); -void gimp_image_invalidate (GimpImage *, gint, gint, - gint, gint, gint, - gint, gint, gint); -void gimp_image_validate (TileManager *, Tile *); +void gimp_image_invalidate (GimpImage *, gint, gint, + gint, gint, gint, + gint, gint, gint); +void gimp_image_validate (TileManager *, Tile *); /* Access functions */ gboolean gimp_image_is_empty (GimpImage *); GimpDrawable * gimp_image_active_drawable (GimpImage *); -GimpImageBaseType gimp_image_base_type (GimpImage *); -GimpImageType gimp_image_base_type_with_alpha (GimpImage *); + +GimpImageBaseType gimp_image_base_type (GimpImage *gimage); +GimpImageType gimp_image_base_type_with_alpha (GimpImage *gimage); + gchar * gimp_image_filename (GimpImage *); gboolean gimp_image_undo_is_enabled (GimpImage *); gboolean gimp_image_undo_enable (GimpImage *); gboolean gimp_image_undo_disable (GimpImage *); gboolean gimp_image_undo_freeze (GimpImage *); gboolean gimp_image_undo_thaw (GimpImage *); -void gimp_image_undo_event (GimpImage *, int); +void gimp_image_undo_event (GimpImage *, gint); gint gimp_image_dirty (GimpImage *); gint gimp_image_clean (GimpImage *); void gimp_image_clean_all (GimpImage *); @@ -280,10 +284,12 @@ GimpImageType gimp_image_composite_type (GimpImage *); gint gimp_image_composite_bytes (GimpImage *); TempBuf * gimp_image_composite_preview (GimpImage *, ChannelType, gint, gint); + gint gimp_image_preview_valid (GimpImage *, ChannelType); void gimp_image_invalidate_preview (GimpImage *); void gimp_image_invalidate_previews (void); + TempBuf * gimp_image_construct_composite_preview (GimpImage *, gint , gint); diff --git a/app/core/gimpimage-merge.c b/app/core/gimpimage-merge.c index da18b3bb7a..87f7d84aa9 100644 --- a/app/core/gimpimage-merge.c +++ b/app/core/gimpimage-merge.c @@ -960,16 +960,15 @@ gimp_image_get_color_at (GimpImage *gimage, g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL); if (x < 0 || y < 0 || x >= gimage->width || y >= gimage->height) - { - return NULL; - } + return NULL; + dest = g_new (unsigned char, 5); tile = tile_manager_get_tile (gimp_image_composite (gimage), x, y, TRUE, FALSE); src = tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT); gimp_image_get_color (gimage, gimp_image_composite_type (gimage), dest, src); - if (TYPE_HAS_ALPHA (gimp_image_composite_type (gimage))) + if (GIMP_IMAGE_TYPE_HAS_ALPHA (gimp_image_composite_type (gimage))) dest[3] = src[gimp_image_composite_bytes (gimage) - 1]; else dest[3] = 255; @@ -3696,7 +3695,6 @@ gimp_image_construct_composite_preview (GimpImage *gimage, g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL); - list = gimage->layers; ratio = (gdouble) width / (gdouble) gimage->width; switch (gimp_image_base_type (gimage)) @@ -3718,7 +3716,7 @@ gimp_image_construct_composite_preview (GimpImage *gimage, memset (temp_buf_data (comp), 0, comp->width * comp->height * comp->bytes); floating_sel = NULL; - while (list) + for (list = gimage->layers; list; list = g_slist_next (list)) { layer = (Layer *) list->data; @@ -3738,8 +3736,6 @@ gimp_image_construct_composite_preview (GimpImage *gimage, reverse_list = g_slist_prepend (reverse_list, layer); } } - - list = g_slist_next (list); } construct_flag = 0; diff --git a/app/core/gimpimage-merge.h b/app/core/gimpimage-merge.h index d5161d7be1..381cb6639d 100644 --- a/app/core/gimpimage-merge.h +++ b/app/core/gimpimage-merge.h @@ -15,6 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + #ifndef __GIMPIMAGE_H__ #define __GIMPIMAGE_H__ @@ -38,7 +39,7 @@ #define GIMP_IMAGE(obj) GTK_CHECK_CAST (obj, GIMP_TYPE_IMAGE, GimpImage) #define GIMP_IS_IMAGE(obj) GTK_CHECK_TYPE (obj, GIMP_TYPE_IMAGE) -#define TYPE_HAS_ALPHA(t) ((t)==RGBA_GIMAGE || (t)==GRAYA_GIMAGE || (t)==INDEXEDA_GIMAGE) +#define GIMP_IMAGE_TYPE_HAS_ALPHA(t) ((t)==RGBA_GIMAGE || (t)==GRAYA_GIMAGE || (t)==INDEXEDA_GIMAGE) #define GRAY_PIX 0 #define ALPHA_G_PIX 1 @@ -237,27 +238,30 @@ Channel * gimp_image_remove_channel (GimpImage *, Channel *); void gimp_image_construct (GimpImage *, gint, gint, gint, gint, gboolean); + void gimp_image_invalidate_without_render (GimpImage *, gint, gint, gint, gint, gint, gint, gint, gint); -void gimp_image_invalidate (GimpImage *, gint, gint, - gint, gint, gint, - gint, gint, gint); -void gimp_image_validate (TileManager *, Tile *); +void gimp_image_invalidate (GimpImage *, gint, gint, + gint, gint, gint, + gint, gint, gint); +void gimp_image_validate (TileManager *, Tile *); /* Access functions */ gboolean gimp_image_is_empty (GimpImage *); GimpDrawable * gimp_image_active_drawable (GimpImage *); -GimpImageBaseType gimp_image_base_type (GimpImage *); -GimpImageType gimp_image_base_type_with_alpha (GimpImage *); + +GimpImageBaseType gimp_image_base_type (GimpImage *gimage); +GimpImageType gimp_image_base_type_with_alpha (GimpImage *gimage); + gchar * gimp_image_filename (GimpImage *); gboolean gimp_image_undo_is_enabled (GimpImage *); gboolean gimp_image_undo_enable (GimpImage *); gboolean gimp_image_undo_disable (GimpImage *); gboolean gimp_image_undo_freeze (GimpImage *); gboolean gimp_image_undo_thaw (GimpImage *); -void gimp_image_undo_event (GimpImage *, int); +void gimp_image_undo_event (GimpImage *, gint); gint gimp_image_dirty (GimpImage *); gint gimp_image_clean (GimpImage *); void gimp_image_clean_all (GimpImage *); @@ -280,10 +284,12 @@ GimpImageType gimp_image_composite_type (GimpImage *); gint gimp_image_composite_bytes (GimpImage *); TempBuf * gimp_image_composite_preview (GimpImage *, ChannelType, gint, gint); + gint gimp_image_preview_valid (GimpImage *, ChannelType); void gimp_image_invalidate_preview (GimpImage *); void gimp_image_invalidate_previews (void); + TempBuf * gimp_image_construct_composite_preview (GimpImage *, gint , gint); diff --git a/app/core/gimpimage-projection.c b/app/core/gimpimage-projection.c index da18b3bb7a..87f7d84aa9 100644 --- a/app/core/gimpimage-projection.c +++ b/app/core/gimpimage-projection.c @@ -960,16 +960,15 @@ gimp_image_get_color_at (GimpImage *gimage, g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL); if (x < 0 || y < 0 || x >= gimage->width || y >= gimage->height) - { - return NULL; - } + return NULL; + dest = g_new (unsigned char, 5); tile = tile_manager_get_tile (gimp_image_composite (gimage), x, y, TRUE, FALSE); src = tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT); gimp_image_get_color (gimage, gimp_image_composite_type (gimage), dest, src); - if (TYPE_HAS_ALPHA (gimp_image_composite_type (gimage))) + if (GIMP_IMAGE_TYPE_HAS_ALPHA (gimp_image_composite_type (gimage))) dest[3] = src[gimp_image_composite_bytes (gimage) - 1]; else dest[3] = 255; @@ -3696,7 +3695,6 @@ gimp_image_construct_composite_preview (GimpImage *gimage, g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL); - list = gimage->layers; ratio = (gdouble) width / (gdouble) gimage->width; switch (gimp_image_base_type (gimage)) @@ -3718,7 +3716,7 @@ gimp_image_construct_composite_preview (GimpImage *gimage, memset (temp_buf_data (comp), 0, comp->width * comp->height * comp->bytes); floating_sel = NULL; - while (list) + for (list = gimage->layers; list; list = g_slist_next (list)) { layer = (Layer *) list->data; @@ -3738,8 +3736,6 @@ gimp_image_construct_composite_preview (GimpImage *gimage, reverse_list = g_slist_prepend (reverse_list, layer); } } - - list = g_slist_next (list); } construct_flag = 0; diff --git a/app/core/gimpimage-projection.h b/app/core/gimpimage-projection.h index d5161d7be1..381cb6639d 100644 --- a/app/core/gimpimage-projection.h +++ b/app/core/gimpimage-projection.h @@ -15,6 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + #ifndef __GIMPIMAGE_H__ #define __GIMPIMAGE_H__ @@ -38,7 +39,7 @@ #define GIMP_IMAGE(obj) GTK_CHECK_CAST (obj, GIMP_TYPE_IMAGE, GimpImage) #define GIMP_IS_IMAGE(obj) GTK_CHECK_TYPE (obj, GIMP_TYPE_IMAGE) -#define TYPE_HAS_ALPHA(t) ((t)==RGBA_GIMAGE || (t)==GRAYA_GIMAGE || (t)==INDEXEDA_GIMAGE) +#define GIMP_IMAGE_TYPE_HAS_ALPHA(t) ((t)==RGBA_GIMAGE || (t)==GRAYA_GIMAGE || (t)==INDEXEDA_GIMAGE) #define GRAY_PIX 0 #define ALPHA_G_PIX 1 @@ -237,27 +238,30 @@ Channel * gimp_image_remove_channel (GimpImage *, Channel *); void gimp_image_construct (GimpImage *, gint, gint, gint, gint, gboolean); + void gimp_image_invalidate_without_render (GimpImage *, gint, gint, gint, gint, gint, gint, gint, gint); -void gimp_image_invalidate (GimpImage *, gint, gint, - gint, gint, gint, - gint, gint, gint); -void gimp_image_validate (TileManager *, Tile *); +void gimp_image_invalidate (GimpImage *, gint, gint, + gint, gint, gint, + gint, gint, gint); +void gimp_image_validate (TileManager *, Tile *); /* Access functions */ gboolean gimp_image_is_empty (GimpImage *); GimpDrawable * gimp_image_active_drawable (GimpImage *); -GimpImageBaseType gimp_image_base_type (GimpImage *); -GimpImageType gimp_image_base_type_with_alpha (GimpImage *); + +GimpImageBaseType gimp_image_base_type (GimpImage *gimage); +GimpImageType gimp_image_base_type_with_alpha (GimpImage *gimage); + gchar * gimp_image_filename (GimpImage *); gboolean gimp_image_undo_is_enabled (GimpImage *); gboolean gimp_image_undo_enable (GimpImage *); gboolean gimp_image_undo_disable (GimpImage *); gboolean gimp_image_undo_freeze (GimpImage *); gboolean gimp_image_undo_thaw (GimpImage *); -void gimp_image_undo_event (GimpImage *, int); +void gimp_image_undo_event (GimpImage *, gint); gint gimp_image_dirty (GimpImage *); gint gimp_image_clean (GimpImage *); void gimp_image_clean_all (GimpImage *); @@ -280,10 +284,12 @@ GimpImageType gimp_image_composite_type (GimpImage *); gint gimp_image_composite_bytes (GimpImage *); TempBuf * gimp_image_composite_preview (GimpImage *, ChannelType, gint, gint); + gint gimp_image_preview_valid (GimpImage *, ChannelType); void gimp_image_invalidate_preview (GimpImage *); void gimp_image_invalidate_previews (void); + TempBuf * gimp_image_construct_composite_preview (GimpImage *, gint , gint); diff --git a/app/core/gimpimage-resize.c b/app/core/gimpimage-resize.c index da18b3bb7a..87f7d84aa9 100644 --- a/app/core/gimpimage-resize.c +++ b/app/core/gimpimage-resize.c @@ -960,16 +960,15 @@ gimp_image_get_color_at (GimpImage *gimage, g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL); if (x < 0 || y < 0 || x >= gimage->width || y >= gimage->height) - { - return NULL; - } + return NULL; + dest = g_new (unsigned char, 5); tile = tile_manager_get_tile (gimp_image_composite (gimage), x, y, TRUE, FALSE); src = tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT); gimp_image_get_color (gimage, gimp_image_composite_type (gimage), dest, src); - if (TYPE_HAS_ALPHA (gimp_image_composite_type (gimage))) + if (GIMP_IMAGE_TYPE_HAS_ALPHA (gimp_image_composite_type (gimage))) dest[3] = src[gimp_image_composite_bytes (gimage) - 1]; else dest[3] = 255; @@ -3696,7 +3695,6 @@ gimp_image_construct_composite_preview (GimpImage *gimage, g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL); - list = gimage->layers; ratio = (gdouble) width / (gdouble) gimage->width; switch (gimp_image_base_type (gimage)) @@ -3718,7 +3716,7 @@ gimp_image_construct_composite_preview (GimpImage *gimage, memset (temp_buf_data (comp), 0, comp->width * comp->height * comp->bytes); floating_sel = NULL; - while (list) + for (list = gimage->layers; list; list = g_slist_next (list)) { layer = (Layer *) list->data; @@ -3738,8 +3736,6 @@ gimp_image_construct_composite_preview (GimpImage *gimage, reverse_list = g_slist_prepend (reverse_list, layer); } } - - list = g_slist_next (list); } construct_flag = 0; diff --git a/app/core/gimpimage-resize.h b/app/core/gimpimage-resize.h index d5161d7be1..381cb6639d 100644 --- a/app/core/gimpimage-resize.h +++ b/app/core/gimpimage-resize.h @@ -15,6 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + #ifndef __GIMPIMAGE_H__ #define __GIMPIMAGE_H__ @@ -38,7 +39,7 @@ #define GIMP_IMAGE(obj) GTK_CHECK_CAST (obj, GIMP_TYPE_IMAGE, GimpImage) #define GIMP_IS_IMAGE(obj) GTK_CHECK_TYPE (obj, GIMP_TYPE_IMAGE) -#define TYPE_HAS_ALPHA(t) ((t)==RGBA_GIMAGE || (t)==GRAYA_GIMAGE || (t)==INDEXEDA_GIMAGE) +#define GIMP_IMAGE_TYPE_HAS_ALPHA(t) ((t)==RGBA_GIMAGE || (t)==GRAYA_GIMAGE || (t)==INDEXEDA_GIMAGE) #define GRAY_PIX 0 #define ALPHA_G_PIX 1 @@ -237,27 +238,30 @@ Channel * gimp_image_remove_channel (GimpImage *, Channel *); void gimp_image_construct (GimpImage *, gint, gint, gint, gint, gboolean); + void gimp_image_invalidate_without_render (GimpImage *, gint, gint, gint, gint, gint, gint, gint, gint); -void gimp_image_invalidate (GimpImage *, gint, gint, - gint, gint, gint, - gint, gint, gint); -void gimp_image_validate (TileManager *, Tile *); +void gimp_image_invalidate (GimpImage *, gint, gint, + gint, gint, gint, + gint, gint, gint); +void gimp_image_validate (TileManager *, Tile *); /* Access functions */ gboolean gimp_image_is_empty (GimpImage *); GimpDrawable * gimp_image_active_drawable (GimpImage *); -GimpImageBaseType gimp_image_base_type (GimpImage *); -GimpImageType gimp_image_base_type_with_alpha (GimpImage *); + +GimpImageBaseType gimp_image_base_type (GimpImage *gimage); +GimpImageType gimp_image_base_type_with_alpha (GimpImage *gimage); + gchar * gimp_image_filename (GimpImage *); gboolean gimp_image_undo_is_enabled (GimpImage *); gboolean gimp_image_undo_enable (GimpImage *); gboolean gimp_image_undo_disable (GimpImage *); gboolean gimp_image_undo_freeze (GimpImage *); gboolean gimp_image_undo_thaw (GimpImage *); -void gimp_image_undo_event (GimpImage *, int); +void gimp_image_undo_event (GimpImage *, gint); gint gimp_image_dirty (GimpImage *); gint gimp_image_clean (GimpImage *); void gimp_image_clean_all (GimpImage *); @@ -280,10 +284,12 @@ GimpImageType gimp_image_composite_type (GimpImage *); gint gimp_image_composite_bytes (GimpImage *); TempBuf * gimp_image_composite_preview (GimpImage *, ChannelType, gint, gint); + gint gimp_image_preview_valid (GimpImage *, ChannelType); void gimp_image_invalidate_preview (GimpImage *); void gimp_image_invalidate_previews (void); + TempBuf * gimp_image_construct_composite_preview (GimpImage *, gint , gint); diff --git a/app/core/gimpimage-scale.c b/app/core/gimpimage-scale.c index da18b3bb7a..87f7d84aa9 100644 --- a/app/core/gimpimage-scale.c +++ b/app/core/gimpimage-scale.c @@ -960,16 +960,15 @@ gimp_image_get_color_at (GimpImage *gimage, g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL); if (x < 0 || y < 0 || x >= gimage->width || y >= gimage->height) - { - return NULL; - } + return NULL; + dest = g_new (unsigned char, 5); tile = tile_manager_get_tile (gimp_image_composite (gimage), x, y, TRUE, FALSE); src = tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT); gimp_image_get_color (gimage, gimp_image_composite_type (gimage), dest, src); - if (TYPE_HAS_ALPHA (gimp_image_composite_type (gimage))) + if (GIMP_IMAGE_TYPE_HAS_ALPHA (gimp_image_composite_type (gimage))) dest[3] = src[gimp_image_composite_bytes (gimage) - 1]; else dest[3] = 255; @@ -3696,7 +3695,6 @@ gimp_image_construct_composite_preview (GimpImage *gimage, g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL); - list = gimage->layers; ratio = (gdouble) width / (gdouble) gimage->width; switch (gimp_image_base_type (gimage)) @@ -3718,7 +3716,7 @@ gimp_image_construct_composite_preview (GimpImage *gimage, memset (temp_buf_data (comp), 0, comp->width * comp->height * comp->bytes); floating_sel = NULL; - while (list) + for (list = gimage->layers; list; list = g_slist_next (list)) { layer = (Layer *) list->data; @@ -3738,8 +3736,6 @@ gimp_image_construct_composite_preview (GimpImage *gimage, reverse_list = g_slist_prepend (reverse_list, layer); } } - - list = g_slist_next (list); } construct_flag = 0; diff --git a/app/core/gimpimage-scale.h b/app/core/gimpimage-scale.h index d5161d7be1..381cb6639d 100644 --- a/app/core/gimpimage-scale.h +++ b/app/core/gimpimage-scale.h @@ -15,6 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + #ifndef __GIMPIMAGE_H__ #define __GIMPIMAGE_H__ @@ -38,7 +39,7 @@ #define GIMP_IMAGE(obj) GTK_CHECK_CAST (obj, GIMP_TYPE_IMAGE, GimpImage) #define GIMP_IS_IMAGE(obj) GTK_CHECK_TYPE (obj, GIMP_TYPE_IMAGE) -#define TYPE_HAS_ALPHA(t) ((t)==RGBA_GIMAGE || (t)==GRAYA_GIMAGE || (t)==INDEXEDA_GIMAGE) +#define GIMP_IMAGE_TYPE_HAS_ALPHA(t) ((t)==RGBA_GIMAGE || (t)==GRAYA_GIMAGE || (t)==INDEXEDA_GIMAGE) #define GRAY_PIX 0 #define ALPHA_G_PIX 1 @@ -237,27 +238,30 @@ Channel * gimp_image_remove_channel (GimpImage *, Channel *); void gimp_image_construct (GimpImage *, gint, gint, gint, gint, gboolean); + void gimp_image_invalidate_without_render (GimpImage *, gint, gint, gint, gint, gint, gint, gint, gint); -void gimp_image_invalidate (GimpImage *, gint, gint, - gint, gint, gint, - gint, gint, gint); -void gimp_image_validate (TileManager *, Tile *); +void gimp_image_invalidate (GimpImage *, gint, gint, + gint, gint, gint, + gint, gint, gint); +void gimp_image_validate (TileManager *, Tile *); /* Access functions */ gboolean gimp_image_is_empty (GimpImage *); GimpDrawable * gimp_image_active_drawable (GimpImage *); -GimpImageBaseType gimp_image_base_type (GimpImage *); -GimpImageType gimp_image_base_type_with_alpha (GimpImage *); + +GimpImageBaseType gimp_image_base_type (GimpImage *gimage); +GimpImageType gimp_image_base_type_with_alpha (GimpImage *gimage); + gchar * gimp_image_filename (GimpImage *); gboolean gimp_image_undo_is_enabled (GimpImage *); gboolean gimp_image_undo_enable (GimpImage *); gboolean gimp_image_undo_disable (GimpImage *); gboolean gimp_image_undo_freeze (GimpImage *); gboolean gimp_image_undo_thaw (GimpImage *); -void gimp_image_undo_event (GimpImage *, int); +void gimp_image_undo_event (GimpImage *, gint); gint gimp_image_dirty (GimpImage *); gint gimp_image_clean (GimpImage *); void gimp_image_clean_all (GimpImage *); @@ -280,10 +284,12 @@ GimpImageType gimp_image_composite_type (GimpImage *); gint gimp_image_composite_bytes (GimpImage *); TempBuf * gimp_image_composite_preview (GimpImage *, ChannelType, gint, gint); + gint gimp_image_preview_valid (GimpImage *, ChannelType); void gimp_image_invalidate_preview (GimpImage *); void gimp_image_invalidate_previews (void); + TempBuf * gimp_image_construct_composite_preview (GimpImage *, gint , gint); diff --git a/app/core/gimpimage-undo-push.c b/app/core/gimpimage-undo-push.c index c7d84ea953..4674afd5d1 100644 --- a/app/core/gimpimage-undo-push.c +++ b/app/core/gimpimage-undo-push.c @@ -1599,7 +1599,7 @@ undo_pop_layer_mod (GImage *gimage, GIMP_DRAWABLE (layer)->height = tiles->height; GIMP_DRAWABLE (layer)->bytes = tiles->bpp; GIMP_DRAWABLE (layer)->type = layer_type; - GIMP_DRAWABLE (layer)->has_alpha = TYPE_HAS_ALPHA (layer_type); + GIMP_DRAWABLE (layer)->has_alpha = GIMP_IMAGE_TYPE_HAS_ALPHA (layer_type); if (layer->mask) { diff --git a/app/core/gimpimage.c b/app/core/gimpimage.c index da18b3bb7a..87f7d84aa9 100644 --- a/app/core/gimpimage.c +++ b/app/core/gimpimage.c @@ -960,16 +960,15 @@ gimp_image_get_color_at (GimpImage *gimage, g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL); if (x < 0 || y < 0 || x >= gimage->width || y >= gimage->height) - { - return NULL; - } + return NULL; + dest = g_new (unsigned char, 5); tile = tile_manager_get_tile (gimp_image_composite (gimage), x, y, TRUE, FALSE); src = tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT); gimp_image_get_color (gimage, gimp_image_composite_type (gimage), dest, src); - if (TYPE_HAS_ALPHA (gimp_image_composite_type (gimage))) + if (GIMP_IMAGE_TYPE_HAS_ALPHA (gimp_image_composite_type (gimage))) dest[3] = src[gimp_image_composite_bytes (gimage) - 1]; else dest[3] = 255; @@ -3696,7 +3695,6 @@ gimp_image_construct_composite_preview (GimpImage *gimage, g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL); - list = gimage->layers; ratio = (gdouble) width / (gdouble) gimage->width; switch (gimp_image_base_type (gimage)) @@ -3718,7 +3716,7 @@ gimp_image_construct_composite_preview (GimpImage *gimage, memset (temp_buf_data (comp), 0, comp->width * comp->height * comp->bytes); floating_sel = NULL; - while (list) + for (list = gimage->layers; list; list = g_slist_next (list)) { layer = (Layer *) list->data; @@ -3738,8 +3736,6 @@ gimp_image_construct_composite_preview (GimpImage *gimage, reverse_list = g_slist_prepend (reverse_list, layer); } } - - list = g_slist_next (list); } construct_flag = 0; diff --git a/app/core/gimpimage.h b/app/core/gimpimage.h index d5161d7be1..381cb6639d 100644 --- a/app/core/gimpimage.h +++ b/app/core/gimpimage.h @@ -15,6 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + #ifndef __GIMPIMAGE_H__ #define __GIMPIMAGE_H__ @@ -38,7 +39,7 @@ #define GIMP_IMAGE(obj) GTK_CHECK_CAST (obj, GIMP_TYPE_IMAGE, GimpImage) #define GIMP_IS_IMAGE(obj) GTK_CHECK_TYPE (obj, GIMP_TYPE_IMAGE) -#define TYPE_HAS_ALPHA(t) ((t)==RGBA_GIMAGE || (t)==GRAYA_GIMAGE || (t)==INDEXEDA_GIMAGE) +#define GIMP_IMAGE_TYPE_HAS_ALPHA(t) ((t)==RGBA_GIMAGE || (t)==GRAYA_GIMAGE || (t)==INDEXEDA_GIMAGE) #define GRAY_PIX 0 #define ALPHA_G_PIX 1 @@ -237,27 +238,30 @@ Channel * gimp_image_remove_channel (GimpImage *, Channel *); void gimp_image_construct (GimpImage *, gint, gint, gint, gint, gboolean); + void gimp_image_invalidate_without_render (GimpImage *, gint, gint, gint, gint, gint, gint, gint, gint); -void gimp_image_invalidate (GimpImage *, gint, gint, - gint, gint, gint, - gint, gint, gint); -void gimp_image_validate (TileManager *, Tile *); +void gimp_image_invalidate (GimpImage *, gint, gint, + gint, gint, gint, + gint, gint, gint); +void gimp_image_validate (TileManager *, Tile *); /* Access functions */ gboolean gimp_image_is_empty (GimpImage *); GimpDrawable * gimp_image_active_drawable (GimpImage *); -GimpImageBaseType gimp_image_base_type (GimpImage *); -GimpImageType gimp_image_base_type_with_alpha (GimpImage *); + +GimpImageBaseType gimp_image_base_type (GimpImage *gimage); +GimpImageType gimp_image_base_type_with_alpha (GimpImage *gimage); + gchar * gimp_image_filename (GimpImage *); gboolean gimp_image_undo_is_enabled (GimpImage *); gboolean gimp_image_undo_enable (GimpImage *); gboolean gimp_image_undo_disable (GimpImage *); gboolean gimp_image_undo_freeze (GimpImage *); gboolean gimp_image_undo_thaw (GimpImage *); -void gimp_image_undo_event (GimpImage *, int); +void gimp_image_undo_event (GimpImage *, gint); gint gimp_image_dirty (GimpImage *); gint gimp_image_clean (GimpImage *); void gimp_image_clean_all (GimpImage *); @@ -280,10 +284,12 @@ GimpImageType gimp_image_composite_type (GimpImage *); gint gimp_image_composite_bytes (GimpImage *); TempBuf * gimp_image_composite_preview (GimpImage *, ChannelType, gint, gint); + gint gimp_image_preview_valid (GimpImage *, ChannelType); void gimp_image_invalidate_preview (GimpImage *); void gimp_image_invalidate_previews (void); + TempBuf * gimp_image_construct_composite_preview (GimpImage *, gint , gint); diff --git a/app/core/gimpimagemap.c b/app/core/gimpimagemap.c index 8d268d0831..e128436364 100644 --- a/app/core/gimpimagemap.c +++ b/app/core/gimpimagemap.c @@ -322,12 +322,12 @@ image_map_get_color_at (ImageMap image_map, gint x, gint y) { - Tile *tile; + Tile *tile; unsigned char *src; unsigned char *dest; - _ImageMap *_image_map; + _ImageMap *_image_map; - if(!image_map) + if (!image_map) return NULL; _image_map = (_ImageMap *) image_map; @@ -359,11 +359,11 @@ image_map_get_color_at (ImageMap image_map, gimp_image_get_color (gimp_drawable_gimage(_image_map->drawable), gimp_drawable_type (_image_map->drawable), dest, src); - if(TYPE_HAS_ALPHA(gimp_drawable_type (_image_map->drawable))) + if (GIMP_IMAGE_TYPE_HAS_ALPHA (gimp_drawable_type (_image_map->drawable))) dest[3] = src[gimp_drawable_bytes (_image_map->drawable) - 1]; else dest[3] = 255; - if (gimp_drawable_is_indexed(_image_map->drawable)) + if (gimp_drawable_is_indexed (_image_map->drawable)) dest[4] = src[0]; else dest[4] = 0; diff --git a/app/core/gimplayer.c b/app/core/gimplayer.c index a28b0d9fe1..d8298998bd 100644 --- a/app/core/gimplayer.c +++ b/app/core/gimplayer.c @@ -443,7 +443,7 @@ layer_new_from_tiles (GimpImage *gimage, return NULL; /* the layer_type needs to have alpha */ - g_return_val_if_fail (TYPE_HAS_ALPHA (layer_type), NULL); + g_return_val_if_fail (GIMP_IMAGE_TYPE_HAS_ALPHA (layer_type), NULL); /* Create the new layer */ new_layer = layer_new (0, tiles->width, tiles->height, @@ -754,7 +754,7 @@ layer_add_alpha (Layer *layer) GIMP_DRAWABLE(layer)->tiles = new_tiles; GIMP_DRAWABLE(layer)->type = type; GIMP_DRAWABLE(layer)->bytes = GIMP_DRAWABLE(layer)->bytes + 1; - GIMP_DRAWABLE(layer)->has_alpha = TYPE_HAS_ALPHA (type); + GIMP_DRAWABLE(layer)->has_alpha = GIMP_IMAGE_TYPE_HAS_ALPHA (type); GIMP_DRAWABLE(layer)->preview_valid = FALSE; gtk_signal_emit_by_name (GTK_OBJECT (gimp_drawable_gimage (GIMP_DRAWABLE (layer))), @@ -1277,12 +1277,10 @@ layer_get_mask (Layer *layer) gboolean layer_has_alpha (Layer *layer) { - if (GIMP_DRAWABLE(layer)->type == RGBA_GIMAGE || - GIMP_DRAWABLE(layer)->type == GRAYA_GIMAGE || - GIMP_DRAWABLE(layer)->type == INDEXEDA_GIMAGE) - return TRUE; - else - return FALSE; + g_return_if_fail (layer != NULL); + g_return_if_fail (GIMP_IS_LAYER (layer)); + + return GIMP_IMAGE_TYPE_HAS_ALPHA (GIMP_DRAWABLE (layer)->type); } gboolean diff --git a/app/core/gimpprojection-construct.c b/app/core/gimpprojection-construct.c index da18b3bb7a..87f7d84aa9 100644 --- a/app/core/gimpprojection-construct.c +++ b/app/core/gimpprojection-construct.c @@ -960,16 +960,15 @@ gimp_image_get_color_at (GimpImage *gimage, g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL); if (x < 0 || y < 0 || x >= gimage->width || y >= gimage->height) - { - return NULL; - } + return NULL; + dest = g_new (unsigned char, 5); tile = tile_manager_get_tile (gimp_image_composite (gimage), x, y, TRUE, FALSE); src = tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT); gimp_image_get_color (gimage, gimp_image_composite_type (gimage), dest, src); - if (TYPE_HAS_ALPHA (gimp_image_composite_type (gimage))) + if (GIMP_IMAGE_TYPE_HAS_ALPHA (gimp_image_composite_type (gimage))) dest[3] = src[gimp_image_composite_bytes (gimage) - 1]; else dest[3] = 255; @@ -3696,7 +3695,6 @@ gimp_image_construct_composite_preview (GimpImage *gimage, g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL); - list = gimage->layers; ratio = (gdouble) width / (gdouble) gimage->width; switch (gimp_image_base_type (gimage)) @@ -3718,7 +3716,7 @@ gimp_image_construct_composite_preview (GimpImage *gimage, memset (temp_buf_data (comp), 0, comp->width * comp->height * comp->bytes); floating_sel = NULL; - while (list) + for (list = gimage->layers; list; list = g_slist_next (list)) { layer = (Layer *) list->data; @@ -3738,8 +3736,6 @@ gimp_image_construct_composite_preview (GimpImage *gimage, reverse_list = g_slist_prepend (reverse_list, layer); } } - - list = g_slist_next (list); } construct_flag = 0; diff --git a/app/core/gimpprojection-construct.h b/app/core/gimpprojection-construct.h index d5161d7be1..381cb6639d 100644 --- a/app/core/gimpprojection-construct.h +++ b/app/core/gimpprojection-construct.h @@ -15,6 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + #ifndef __GIMPIMAGE_H__ #define __GIMPIMAGE_H__ @@ -38,7 +39,7 @@ #define GIMP_IMAGE(obj) GTK_CHECK_CAST (obj, GIMP_TYPE_IMAGE, GimpImage) #define GIMP_IS_IMAGE(obj) GTK_CHECK_TYPE (obj, GIMP_TYPE_IMAGE) -#define TYPE_HAS_ALPHA(t) ((t)==RGBA_GIMAGE || (t)==GRAYA_GIMAGE || (t)==INDEXEDA_GIMAGE) +#define GIMP_IMAGE_TYPE_HAS_ALPHA(t) ((t)==RGBA_GIMAGE || (t)==GRAYA_GIMAGE || (t)==INDEXEDA_GIMAGE) #define GRAY_PIX 0 #define ALPHA_G_PIX 1 @@ -237,27 +238,30 @@ Channel * gimp_image_remove_channel (GimpImage *, Channel *); void gimp_image_construct (GimpImage *, gint, gint, gint, gint, gboolean); + void gimp_image_invalidate_without_render (GimpImage *, gint, gint, gint, gint, gint, gint, gint, gint); -void gimp_image_invalidate (GimpImage *, gint, gint, - gint, gint, gint, - gint, gint, gint); -void gimp_image_validate (TileManager *, Tile *); +void gimp_image_invalidate (GimpImage *, gint, gint, + gint, gint, gint, + gint, gint, gint); +void gimp_image_validate (TileManager *, Tile *); /* Access functions */ gboolean gimp_image_is_empty (GimpImage *); GimpDrawable * gimp_image_active_drawable (GimpImage *); -GimpImageBaseType gimp_image_base_type (GimpImage *); -GimpImageType gimp_image_base_type_with_alpha (GimpImage *); + +GimpImageBaseType gimp_image_base_type (GimpImage *gimage); +GimpImageType gimp_image_base_type_with_alpha (GimpImage *gimage); + gchar * gimp_image_filename (GimpImage *); gboolean gimp_image_undo_is_enabled (GimpImage *); gboolean gimp_image_undo_enable (GimpImage *); gboolean gimp_image_undo_disable (GimpImage *); gboolean gimp_image_undo_freeze (GimpImage *); gboolean gimp_image_undo_thaw (GimpImage *); -void gimp_image_undo_event (GimpImage *, int); +void gimp_image_undo_event (GimpImage *, gint); gint gimp_image_dirty (GimpImage *); gint gimp_image_clean (GimpImage *); void gimp_image_clean_all (GimpImage *); @@ -280,10 +284,12 @@ GimpImageType gimp_image_composite_type (GimpImage *); gint gimp_image_composite_bytes (GimpImage *); TempBuf * gimp_image_composite_preview (GimpImage *, ChannelType, gint, gint); + gint gimp_image_preview_valid (GimpImage *, ChannelType); void gimp_image_invalidate_preview (GimpImage *); void gimp_image_invalidate_previews (void); + TempBuf * gimp_image_construct_composite_preview (GimpImage *, gint , gint); diff --git a/app/curves.c b/app/curves.c index 7df06a9e7a..ed78ffc324 100644 --- a/app/curves.c +++ b/app/curves.c @@ -135,22 +135,24 @@ static void curves_write_to_file (FILE *f); /* curves machinery */ -float +gfloat curves_lut_func (CurvesDialog *cd, gint nchannels, gint channel, gfloat value) { - float f; - int index; - double inten; - int j; + gfloat f; + gint index; + gdouble inten; + gint j; if (nchannels == 1) j = 0; else j = channel + 1; + inten = value; + /* For color images this runs through the loop with j = channel +1 the first time and j = 0 the second time */ /* For bw images this runs through the loop with j = 0 the first and @@ -184,12 +186,13 @@ curves_colour_update (Tool *tool, gint x, gint y) { - unsigned char *color; - int offx, offy; - int has_alpha; - int is_indexed; - int sample_type; - int maxval; + guchar *color; + gint offx; + gint offy; + gint maxval; + gboolean has_alpha; + gboolean is_indexed; + GimpImageType sample_type; if(!tool || tool->state != ACTIVE) return; @@ -203,8 +206,8 @@ curves_colour_update (Tool *tool, return; sample_type = gimp_drawable_type (drawable); - is_indexed = gimp_drawable_is_indexed (drawable); - has_alpha = TYPE_HAS_ALPHA (sample_type); + is_indexed = gimp_drawable_is_indexed (drawable); + has_alpha = GIMP_IMAGE_TYPE_HAS_ALPHA (sample_type); curves_dialog->col_value[HISTOGRAM_RED] = color[RED_PIX]; curves_dialog->col_value[HISTOGRAM_GREEN] = color[GREEN_PIX]; @@ -231,10 +234,10 @@ curves_add_point (GimpDrawable *drawable, gint cchan) { /* Add point onto the curve */ - int closest_point = 0; - int distance; - int curvex; - int i; + gint closest_point = 0; + gint distance; + gint curvex; + gint i; switch (curves_dialog->curve_type[cchan]) { @@ -271,9 +274,9 @@ curves_button_press (Tool *tool, GdkEventButton *bevent, gpointer gdisp_ptr) { - GDisplay *gdisp; gint x, y; - GimpDrawable * drawable; + GDisplay *gdisp; + GimpDrawable *drawable; gdisp = gdisp_ptr; drawable = gimage_active_drawable (gdisp->gimage); @@ -307,8 +310,8 @@ curves_button_release (Tool *tool, gpointer gdisp_ptr) { gint x, y; - GimpDrawable * drawable; - GDisplay *gdisp; + GimpDrawable *drawable; + GDisplay *gdisp; gdisp = (GDisplay *) gdisp_ptr; @@ -343,9 +346,9 @@ curves_motion (Tool *tool, GdkEventMotion *mevent, gpointer gdisp_ptr) { - GDisplay *gdisp; gint x, y; - GimpDrawable * drawable; + GDisplay *gdisp; + GimpDrawable *drawable; gdisp = (GDisplay *) gdisp_ptr; @@ -384,8 +387,8 @@ curves_control (Tool *tool, Tool * tools_new_curves (void) { - Tool * tool; - Curves * private; + Tool *tool; + Curves *private; /* The tool options */ if (!curves_options) @@ -420,7 +423,7 @@ curves_dialog_hide (void) void tools_free_curves (Tool *tool) { - Curves * private; + Curves *private; private = (Curves *) tool->private; @@ -722,10 +725,10 @@ curve_print_loc (CurvesDialog *cd, gint xpos, gint ypos) { - char buf[32]; - gint width; - gint ascent; - gint descent; + gchar buf[32]; + gint width; + gint ascent; + gint descent; if (cd->cursor_ind_width < 0) { @@ -771,12 +774,12 @@ curve_print_loc (CurvesDialog *cd, /* TODO: preview alpha channel stuff correctly. -- austin, 20/May/99 */ static void curves_update (CurvesDialog *cd, - int update) + gint update) { GdkRectangle area; - gint i, j; - gchar buf[32]; - gint offset; + gint i, j; + gchar buf[32]; + gint offset; gint sel_channel; if(cd->color) { @@ -1155,7 +1158,7 @@ curves_smooth_callback (GtkWidget *widget, gpointer data) { CurvesDialog *cd; - int i; + gint i; gint32 index; cd = (CurvesDialog *) data; @@ -1202,7 +1205,7 @@ curves_free_callback (GtkWidget *widget, static void curves_channel_reset (int i) { - int j; + gint j; curves_dialog->grab_point = -1; @@ -1223,7 +1226,7 @@ curves_reset_callback (GtkWidget *widget, gpointer data) { CurvesDialog *cd; - int i; + gint i; cd = (CurvesDialog *) data; @@ -1356,12 +1359,12 @@ curves_graph_events (GtkWidget *widget, GdkCursorType new_type; GdkEventButton *bevent; GdkEventMotion *mevent; - int i; - int tx, ty; - int x, y; - int closest_point; - int distance; - int x1, x2, y1, y2; + gint i; + gint tx, ty; + gint x, y; + gint closest_point; + gint distance; + gint x1, x2, y1, y2; new_type = GDK_X_CURSOR; closest_point = 0; @@ -1693,11 +1696,12 @@ file_dialog_cancel_callback (GtkWidget *widget, static gboolean curves_read_from_file (FILE *f) { - gint i, j, fields; + gint i, j; + gint fields; gchar buf[50]; - gint index[5][17]; - gint value[5][17]; - gint current_channel; + gint index[5][17]; + gint value[5][17]; + gint current_channel; if (!fgets (buf, 50, f)) return FALSE; @@ -1750,7 +1754,7 @@ curves_read_from_file (FILE *f) static void curves_write_to_file (FILE *f) { - int i, j; + gint i, j; gint32 index; for (i = 0; i < 5; i++) diff --git a/app/dialogs/info-window.c b/app/dialogs/info-window.c index f3e736b700..bb29f37368 100644 --- a/app/dialogs/info-window.c +++ b/app/dialogs/info-window.c @@ -15,6 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + #include "config.h" #include "appenv.h" @@ -438,7 +439,7 @@ info_window_update_RGB (GDisplay *gdisp, sample_type = gimp_image_composite_type (gdisp->gimage); - if (TYPE_HAS_ALPHA (sample_type)) + if (GIMP_IMAGE_TYPE_HAS_ALPHA (sample_type)) { g_snprintf (buff, sizeof (buff), "%d", (gint) color[ALPHA_PIX]); gtk_label_set_text (GTK_LABEL (iwd->labelAvalue), buff); diff --git a/app/gimpdrawable.c b/app/gimpdrawable.c index 0946c62f73..494cf27811 100644 --- a/app/gimpdrawable.c +++ b/app/gimpdrawable.c @@ -433,7 +433,7 @@ gimp_drawable_get_color_at (GimpDrawable *drawable, gimp_image_get_color (gimp_drawable_gimage (drawable), gimp_drawable_type (drawable), dest, src); - if (TYPE_HAS_ALPHA (gimp_drawable_type (drawable))) + if (GIMP_IMAGE_TYPE_HAS_ALPHA (gimp_drawable_type (drawable))) dest[3] = src[gimp_drawable_bytes (drawable) - 1]; else dest[3] = 255; diff --git a/app/gimpimage-convert.c b/app/gimpimage-convert.c index 76b5a93b16..f0f17e7e47 100644 --- a/app/gimpimage-convert.c +++ b/app/gimpimage-convert.c @@ -1362,10 +1362,10 @@ convert_image (GImage *gimage, /* Push the layer on the undo stack */ undo_push_layer_mod (gimage, layer); - GIMP_DRAWABLE(layer)->tiles = new_tiles; - GIMP_DRAWABLE(layer)->bytes = new_layer_bytes; - GIMP_DRAWABLE(layer)->type = new_layer_type; - GIMP_DRAWABLE(layer)->has_alpha = TYPE_HAS_ALPHA(new_layer_type); + GIMP_DRAWABLE (layer)->tiles = new_tiles; + GIMP_DRAWABLE (layer)->bytes = new_layer_bytes; + GIMP_DRAWABLE (layer)->type = new_layer_type; + GIMP_DRAWABLE (layer)->has_alpha = GIMP_IMAGE_TYPE_HAS_ALPHA (new_layer_type); } /* colourmap stuff */ diff --git a/app/gimpimage.c b/app/gimpimage.c index da18b3bb7a..87f7d84aa9 100644 --- a/app/gimpimage.c +++ b/app/gimpimage.c @@ -960,16 +960,15 @@ gimp_image_get_color_at (GimpImage *gimage, g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL); if (x < 0 || y < 0 || x >= gimage->width || y >= gimage->height) - { - return NULL; - } + return NULL; + dest = g_new (unsigned char, 5); tile = tile_manager_get_tile (gimp_image_composite (gimage), x, y, TRUE, FALSE); src = tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT); gimp_image_get_color (gimage, gimp_image_composite_type (gimage), dest, src); - if (TYPE_HAS_ALPHA (gimp_image_composite_type (gimage))) + if (GIMP_IMAGE_TYPE_HAS_ALPHA (gimp_image_composite_type (gimage))) dest[3] = src[gimp_image_composite_bytes (gimage) - 1]; else dest[3] = 255; @@ -3696,7 +3695,6 @@ gimp_image_construct_composite_preview (GimpImage *gimage, g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL); - list = gimage->layers; ratio = (gdouble) width / (gdouble) gimage->width; switch (gimp_image_base_type (gimage)) @@ -3718,7 +3716,7 @@ gimp_image_construct_composite_preview (GimpImage *gimage, memset (temp_buf_data (comp), 0, comp->width * comp->height * comp->bytes); floating_sel = NULL; - while (list) + for (list = gimage->layers; list; list = g_slist_next (list)) { layer = (Layer *) list->data; @@ -3738,8 +3736,6 @@ gimp_image_construct_composite_preview (GimpImage *gimage, reverse_list = g_slist_prepend (reverse_list, layer); } } - - list = g_slist_next (list); } construct_flag = 0; diff --git a/app/gimpimage.h b/app/gimpimage.h index d5161d7be1..381cb6639d 100644 --- a/app/gimpimage.h +++ b/app/gimpimage.h @@ -15,6 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + #ifndef __GIMPIMAGE_H__ #define __GIMPIMAGE_H__ @@ -38,7 +39,7 @@ #define GIMP_IMAGE(obj) GTK_CHECK_CAST (obj, GIMP_TYPE_IMAGE, GimpImage) #define GIMP_IS_IMAGE(obj) GTK_CHECK_TYPE (obj, GIMP_TYPE_IMAGE) -#define TYPE_HAS_ALPHA(t) ((t)==RGBA_GIMAGE || (t)==GRAYA_GIMAGE || (t)==INDEXEDA_GIMAGE) +#define GIMP_IMAGE_TYPE_HAS_ALPHA(t) ((t)==RGBA_GIMAGE || (t)==GRAYA_GIMAGE || (t)==INDEXEDA_GIMAGE) #define GRAY_PIX 0 #define ALPHA_G_PIX 1 @@ -237,27 +238,30 @@ Channel * gimp_image_remove_channel (GimpImage *, Channel *); void gimp_image_construct (GimpImage *, gint, gint, gint, gint, gboolean); + void gimp_image_invalidate_without_render (GimpImage *, gint, gint, gint, gint, gint, gint, gint, gint); -void gimp_image_invalidate (GimpImage *, gint, gint, - gint, gint, gint, - gint, gint, gint); -void gimp_image_validate (TileManager *, Tile *); +void gimp_image_invalidate (GimpImage *, gint, gint, + gint, gint, gint, + gint, gint, gint); +void gimp_image_validate (TileManager *, Tile *); /* Access functions */ gboolean gimp_image_is_empty (GimpImage *); GimpDrawable * gimp_image_active_drawable (GimpImage *); -GimpImageBaseType gimp_image_base_type (GimpImage *); -GimpImageType gimp_image_base_type_with_alpha (GimpImage *); + +GimpImageBaseType gimp_image_base_type (GimpImage *gimage); +GimpImageType gimp_image_base_type_with_alpha (GimpImage *gimage); + gchar * gimp_image_filename (GimpImage *); gboolean gimp_image_undo_is_enabled (GimpImage *); gboolean gimp_image_undo_enable (GimpImage *); gboolean gimp_image_undo_disable (GimpImage *); gboolean gimp_image_undo_freeze (GimpImage *); gboolean gimp_image_undo_thaw (GimpImage *); -void gimp_image_undo_event (GimpImage *, int); +void gimp_image_undo_event (GimpImage *, gint); gint gimp_image_dirty (GimpImage *); gint gimp_image_clean (GimpImage *); void gimp_image_clean_all (GimpImage *); @@ -280,10 +284,12 @@ GimpImageType gimp_image_composite_type (GimpImage *); gint gimp_image_composite_bytes (GimpImage *); TempBuf * gimp_image_composite_preview (GimpImage *, ChannelType, gint, gint); + gint gimp_image_preview_valid (GimpImage *, ChannelType); void gimp_image_invalidate_preview (GimpImage *); void gimp_image_invalidate_previews (void); + TempBuf * gimp_image_construct_composite_preview (GimpImage *, gint , gint); diff --git a/app/gimplayer.c b/app/gimplayer.c index a28b0d9fe1..d8298998bd 100644 --- a/app/gimplayer.c +++ b/app/gimplayer.c @@ -443,7 +443,7 @@ layer_new_from_tiles (GimpImage *gimage, return NULL; /* the layer_type needs to have alpha */ - g_return_val_if_fail (TYPE_HAS_ALPHA (layer_type), NULL); + g_return_val_if_fail (GIMP_IMAGE_TYPE_HAS_ALPHA (layer_type), NULL); /* Create the new layer */ new_layer = layer_new (0, tiles->width, tiles->height, @@ -754,7 +754,7 @@ layer_add_alpha (Layer *layer) GIMP_DRAWABLE(layer)->tiles = new_tiles; GIMP_DRAWABLE(layer)->type = type; GIMP_DRAWABLE(layer)->bytes = GIMP_DRAWABLE(layer)->bytes + 1; - GIMP_DRAWABLE(layer)->has_alpha = TYPE_HAS_ALPHA (type); + GIMP_DRAWABLE(layer)->has_alpha = GIMP_IMAGE_TYPE_HAS_ALPHA (type); GIMP_DRAWABLE(layer)->preview_valid = FALSE; gtk_signal_emit_by_name (GTK_OBJECT (gimp_drawable_gimage (GIMP_DRAWABLE (layer))), @@ -1277,12 +1277,10 @@ layer_get_mask (Layer *layer) gboolean layer_has_alpha (Layer *layer) { - if (GIMP_DRAWABLE(layer)->type == RGBA_GIMAGE || - GIMP_DRAWABLE(layer)->type == GRAYA_GIMAGE || - GIMP_DRAWABLE(layer)->type == INDEXEDA_GIMAGE) - return TRUE; - else - return FALSE; + g_return_if_fail (layer != NULL); + g_return_if_fail (GIMP_IS_LAYER (layer)); + + return GIMP_IMAGE_TYPE_HAS_ALPHA (GIMP_DRAWABLE (layer)->type); } gboolean diff --git a/app/gui/info-window.c b/app/gui/info-window.c index f3e736b700..bb29f37368 100644 --- a/app/gui/info-window.c +++ b/app/gui/info-window.c @@ -15,6 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + #include "config.h" #include "appenv.h" @@ -438,7 +439,7 @@ info_window_update_RGB (GDisplay *gdisp, sample_type = gimp_image_composite_type (gdisp->gimage); - if (TYPE_HAS_ALPHA (sample_type)) + if (GIMP_IMAGE_TYPE_HAS_ALPHA (sample_type)) { g_snprintf (buff, sizeof (buff), "%d", (gint) color[ALPHA_PIX]); gtk_label_set_text (GTK_LABEL (iwd->labelAvalue), buff); diff --git a/app/image_map.c b/app/image_map.c index 8d268d0831..e128436364 100644 --- a/app/image_map.c +++ b/app/image_map.c @@ -322,12 +322,12 @@ image_map_get_color_at (ImageMap image_map, gint x, gint y) { - Tile *tile; + Tile *tile; unsigned char *src; unsigned char *dest; - _ImageMap *_image_map; + _ImageMap *_image_map; - if(!image_map) + if (!image_map) return NULL; _image_map = (_ImageMap *) image_map; @@ -359,11 +359,11 @@ image_map_get_color_at (ImageMap image_map, gimp_image_get_color (gimp_drawable_gimage(_image_map->drawable), gimp_drawable_type (_image_map->drawable), dest, src); - if(TYPE_HAS_ALPHA(gimp_drawable_type (_image_map->drawable))) + if (GIMP_IMAGE_TYPE_HAS_ALPHA (gimp_drawable_type (_image_map->drawable))) dest[3] = src[gimp_drawable_bytes (_image_map->drawable) - 1]; else dest[3] = 255; - if (gimp_drawable_is_indexed(_image_map->drawable)) + if (gimp_drawable_is_indexed (_image_map->drawable)) dest[4] = src[0]; else dest[4] = 0; diff --git a/app/info_window.c b/app/info_window.c index f3e736b700..bb29f37368 100644 --- a/app/info_window.c +++ b/app/info_window.c @@ -15,6 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + #include "config.h" #include "appenv.h" @@ -438,7 +439,7 @@ info_window_update_RGB (GDisplay *gdisp, sample_type = gimp_image_composite_type (gdisp->gimage); - if (TYPE_HAS_ALPHA (sample_type)) + if (GIMP_IMAGE_TYPE_HAS_ALPHA (sample_type)) { g_snprintf (buff, sizeof (buff), "%d", (gint) color[ALPHA_PIX]); gtk_label_set_text (GTK_LABEL (iwd->labelAvalue), buff); diff --git a/app/layer.c b/app/layer.c index a28b0d9fe1..d8298998bd 100644 --- a/app/layer.c +++ b/app/layer.c @@ -443,7 +443,7 @@ layer_new_from_tiles (GimpImage *gimage, return NULL; /* the layer_type needs to have alpha */ - g_return_val_if_fail (TYPE_HAS_ALPHA (layer_type), NULL); + g_return_val_if_fail (GIMP_IMAGE_TYPE_HAS_ALPHA (layer_type), NULL); /* Create the new layer */ new_layer = layer_new (0, tiles->width, tiles->height, @@ -754,7 +754,7 @@ layer_add_alpha (Layer *layer) GIMP_DRAWABLE(layer)->tiles = new_tiles; GIMP_DRAWABLE(layer)->type = type; GIMP_DRAWABLE(layer)->bytes = GIMP_DRAWABLE(layer)->bytes + 1; - GIMP_DRAWABLE(layer)->has_alpha = TYPE_HAS_ALPHA (type); + GIMP_DRAWABLE(layer)->has_alpha = GIMP_IMAGE_TYPE_HAS_ALPHA (type); GIMP_DRAWABLE(layer)->preview_valid = FALSE; gtk_signal_emit_by_name (GTK_OBJECT (gimp_drawable_gimage (GIMP_DRAWABLE (layer))), @@ -1277,12 +1277,10 @@ layer_get_mask (Layer *layer) gboolean layer_has_alpha (Layer *layer) { - if (GIMP_DRAWABLE(layer)->type == RGBA_GIMAGE || - GIMP_DRAWABLE(layer)->type == GRAYA_GIMAGE || - GIMP_DRAWABLE(layer)->type == INDEXEDA_GIMAGE) - return TRUE; - else - return FALSE; + g_return_if_fail (layer != NULL); + g_return_if_fail (GIMP_IS_LAYER (layer)); + + return GIMP_IMAGE_TYPE_HAS_ALPHA (GIMP_DRAWABLE (layer)->type); } gboolean diff --git a/app/tools/color_picker.c b/app/tools/color_picker.c index 92dfb0c68f..97581b7b2a 100644 --- a/app/tools/color_picker.c +++ b/app/tools/color_picker.c @@ -508,7 +508,7 @@ pick_color_do (GimpImage *gimage, get_color_obj = GTK_OBJECT (gimage); } - has_alpha = TYPE_HAS_ALPHA (sample_type); + has_alpha = GIMP_IMAGE_TYPE_HAS_ALPHA (sample_type); if (!(color = (*get_color_func) (get_color_obj, x, y))) return FALSE; diff --git a/app/tools/curves.c b/app/tools/curves.c index 7df06a9e7a..ed78ffc324 100644 --- a/app/tools/curves.c +++ b/app/tools/curves.c @@ -135,22 +135,24 @@ static void curves_write_to_file (FILE *f); /* curves machinery */ -float +gfloat curves_lut_func (CurvesDialog *cd, gint nchannels, gint channel, gfloat value) { - float f; - int index; - double inten; - int j; + gfloat f; + gint index; + gdouble inten; + gint j; if (nchannels == 1) j = 0; else j = channel + 1; + inten = value; + /* For color images this runs through the loop with j = channel +1 the first time and j = 0 the second time */ /* For bw images this runs through the loop with j = 0 the first and @@ -184,12 +186,13 @@ curves_colour_update (Tool *tool, gint x, gint y) { - unsigned char *color; - int offx, offy; - int has_alpha; - int is_indexed; - int sample_type; - int maxval; + guchar *color; + gint offx; + gint offy; + gint maxval; + gboolean has_alpha; + gboolean is_indexed; + GimpImageType sample_type; if(!tool || tool->state != ACTIVE) return; @@ -203,8 +206,8 @@ curves_colour_update (Tool *tool, return; sample_type = gimp_drawable_type (drawable); - is_indexed = gimp_drawable_is_indexed (drawable); - has_alpha = TYPE_HAS_ALPHA (sample_type); + is_indexed = gimp_drawable_is_indexed (drawable); + has_alpha = GIMP_IMAGE_TYPE_HAS_ALPHA (sample_type); curves_dialog->col_value[HISTOGRAM_RED] = color[RED_PIX]; curves_dialog->col_value[HISTOGRAM_GREEN] = color[GREEN_PIX]; @@ -231,10 +234,10 @@ curves_add_point (GimpDrawable *drawable, gint cchan) { /* Add point onto the curve */ - int closest_point = 0; - int distance; - int curvex; - int i; + gint closest_point = 0; + gint distance; + gint curvex; + gint i; switch (curves_dialog->curve_type[cchan]) { @@ -271,9 +274,9 @@ curves_button_press (Tool *tool, GdkEventButton *bevent, gpointer gdisp_ptr) { - GDisplay *gdisp; gint x, y; - GimpDrawable * drawable; + GDisplay *gdisp; + GimpDrawable *drawable; gdisp = gdisp_ptr; drawable = gimage_active_drawable (gdisp->gimage); @@ -307,8 +310,8 @@ curves_button_release (Tool *tool, gpointer gdisp_ptr) { gint x, y; - GimpDrawable * drawable; - GDisplay *gdisp; + GimpDrawable *drawable; + GDisplay *gdisp; gdisp = (GDisplay *) gdisp_ptr; @@ -343,9 +346,9 @@ curves_motion (Tool *tool, GdkEventMotion *mevent, gpointer gdisp_ptr) { - GDisplay *gdisp; gint x, y; - GimpDrawable * drawable; + GDisplay *gdisp; + GimpDrawable *drawable; gdisp = (GDisplay *) gdisp_ptr; @@ -384,8 +387,8 @@ curves_control (Tool *tool, Tool * tools_new_curves (void) { - Tool * tool; - Curves * private; + Tool *tool; + Curves *private; /* The tool options */ if (!curves_options) @@ -420,7 +423,7 @@ curves_dialog_hide (void) void tools_free_curves (Tool *tool) { - Curves * private; + Curves *private; private = (Curves *) tool->private; @@ -722,10 +725,10 @@ curve_print_loc (CurvesDialog *cd, gint xpos, gint ypos) { - char buf[32]; - gint width; - gint ascent; - gint descent; + gchar buf[32]; + gint width; + gint ascent; + gint descent; if (cd->cursor_ind_width < 0) { @@ -771,12 +774,12 @@ curve_print_loc (CurvesDialog *cd, /* TODO: preview alpha channel stuff correctly. -- austin, 20/May/99 */ static void curves_update (CurvesDialog *cd, - int update) + gint update) { GdkRectangle area; - gint i, j; - gchar buf[32]; - gint offset; + gint i, j; + gchar buf[32]; + gint offset; gint sel_channel; if(cd->color) { @@ -1155,7 +1158,7 @@ curves_smooth_callback (GtkWidget *widget, gpointer data) { CurvesDialog *cd; - int i; + gint i; gint32 index; cd = (CurvesDialog *) data; @@ -1202,7 +1205,7 @@ curves_free_callback (GtkWidget *widget, static void curves_channel_reset (int i) { - int j; + gint j; curves_dialog->grab_point = -1; @@ -1223,7 +1226,7 @@ curves_reset_callback (GtkWidget *widget, gpointer data) { CurvesDialog *cd; - int i; + gint i; cd = (CurvesDialog *) data; @@ -1356,12 +1359,12 @@ curves_graph_events (GtkWidget *widget, GdkCursorType new_type; GdkEventButton *bevent; GdkEventMotion *mevent; - int i; - int tx, ty; - int x, y; - int closest_point; - int distance; - int x1, x2, y1, y2; + gint i; + gint tx, ty; + gint x, y; + gint closest_point; + gint distance; + gint x1, x2, y1, y2; new_type = GDK_X_CURSOR; closest_point = 0; @@ -1693,11 +1696,12 @@ file_dialog_cancel_callback (GtkWidget *widget, static gboolean curves_read_from_file (FILE *f) { - gint i, j, fields; + gint i, j; + gint fields; gchar buf[50]; - gint index[5][17]; - gint value[5][17]; - gint current_channel; + gint index[5][17]; + gint value[5][17]; + gint current_channel; if (!fgets (buf, 50, f)) return FALSE; @@ -1750,7 +1754,7 @@ curves_read_from_file (FILE *f) static void curves_write_to_file (FILE *f) { - int i, j; + gint i, j; gint32 index; for (i = 0; i < 5; i++) diff --git a/app/tools/gimpcurvestool.c b/app/tools/gimpcurvestool.c index 7df06a9e7a..ed78ffc324 100644 --- a/app/tools/gimpcurvestool.c +++ b/app/tools/gimpcurvestool.c @@ -135,22 +135,24 @@ static void curves_write_to_file (FILE *f); /* curves machinery */ -float +gfloat curves_lut_func (CurvesDialog *cd, gint nchannels, gint channel, gfloat value) { - float f; - int index; - double inten; - int j; + gfloat f; + gint index; + gdouble inten; + gint j; if (nchannels == 1) j = 0; else j = channel + 1; + inten = value; + /* For color images this runs through the loop with j = channel +1 the first time and j = 0 the second time */ /* For bw images this runs through the loop with j = 0 the first and @@ -184,12 +186,13 @@ curves_colour_update (Tool *tool, gint x, gint y) { - unsigned char *color; - int offx, offy; - int has_alpha; - int is_indexed; - int sample_type; - int maxval; + guchar *color; + gint offx; + gint offy; + gint maxval; + gboolean has_alpha; + gboolean is_indexed; + GimpImageType sample_type; if(!tool || tool->state != ACTIVE) return; @@ -203,8 +206,8 @@ curves_colour_update (Tool *tool, return; sample_type = gimp_drawable_type (drawable); - is_indexed = gimp_drawable_is_indexed (drawable); - has_alpha = TYPE_HAS_ALPHA (sample_type); + is_indexed = gimp_drawable_is_indexed (drawable); + has_alpha = GIMP_IMAGE_TYPE_HAS_ALPHA (sample_type); curves_dialog->col_value[HISTOGRAM_RED] = color[RED_PIX]; curves_dialog->col_value[HISTOGRAM_GREEN] = color[GREEN_PIX]; @@ -231,10 +234,10 @@ curves_add_point (GimpDrawable *drawable, gint cchan) { /* Add point onto the curve */ - int closest_point = 0; - int distance; - int curvex; - int i; + gint closest_point = 0; + gint distance; + gint curvex; + gint i; switch (curves_dialog->curve_type[cchan]) { @@ -271,9 +274,9 @@ curves_button_press (Tool *tool, GdkEventButton *bevent, gpointer gdisp_ptr) { - GDisplay *gdisp; gint x, y; - GimpDrawable * drawable; + GDisplay *gdisp; + GimpDrawable *drawable; gdisp = gdisp_ptr; drawable = gimage_active_drawable (gdisp->gimage); @@ -307,8 +310,8 @@ curves_button_release (Tool *tool, gpointer gdisp_ptr) { gint x, y; - GimpDrawable * drawable; - GDisplay *gdisp; + GimpDrawable *drawable; + GDisplay *gdisp; gdisp = (GDisplay *) gdisp_ptr; @@ -343,9 +346,9 @@ curves_motion (Tool *tool, GdkEventMotion *mevent, gpointer gdisp_ptr) { - GDisplay *gdisp; gint x, y; - GimpDrawable * drawable; + GDisplay *gdisp; + GimpDrawable *drawable; gdisp = (GDisplay *) gdisp_ptr; @@ -384,8 +387,8 @@ curves_control (Tool *tool, Tool * tools_new_curves (void) { - Tool * tool; - Curves * private; + Tool *tool; + Curves *private; /* The tool options */ if (!curves_options) @@ -420,7 +423,7 @@ curves_dialog_hide (void) void tools_free_curves (Tool *tool) { - Curves * private; + Curves *private; private = (Curves *) tool->private; @@ -722,10 +725,10 @@ curve_print_loc (CurvesDialog *cd, gint xpos, gint ypos) { - char buf[32]; - gint width; - gint ascent; - gint descent; + gchar buf[32]; + gint width; + gint ascent; + gint descent; if (cd->cursor_ind_width < 0) { @@ -771,12 +774,12 @@ curve_print_loc (CurvesDialog *cd, /* TODO: preview alpha channel stuff correctly. -- austin, 20/May/99 */ static void curves_update (CurvesDialog *cd, - int update) + gint update) { GdkRectangle area; - gint i, j; - gchar buf[32]; - gint offset; + gint i, j; + gchar buf[32]; + gint offset; gint sel_channel; if(cd->color) { @@ -1155,7 +1158,7 @@ curves_smooth_callback (GtkWidget *widget, gpointer data) { CurvesDialog *cd; - int i; + gint i; gint32 index; cd = (CurvesDialog *) data; @@ -1202,7 +1205,7 @@ curves_free_callback (GtkWidget *widget, static void curves_channel_reset (int i) { - int j; + gint j; curves_dialog->grab_point = -1; @@ -1223,7 +1226,7 @@ curves_reset_callback (GtkWidget *widget, gpointer data) { CurvesDialog *cd; - int i; + gint i; cd = (CurvesDialog *) data; @@ -1356,12 +1359,12 @@ curves_graph_events (GtkWidget *widget, GdkCursorType new_type; GdkEventButton *bevent; GdkEventMotion *mevent; - int i; - int tx, ty; - int x, y; - int closest_point; - int distance; - int x1, x2, y1, y2; + gint i; + gint tx, ty; + gint x, y; + gint closest_point; + gint distance; + gint x1, x2, y1, y2; new_type = GDK_X_CURSOR; closest_point = 0; @@ -1693,11 +1696,12 @@ file_dialog_cancel_callback (GtkWidget *widget, static gboolean curves_read_from_file (FILE *f) { - gint i, j, fields; + gint i, j; + gint fields; gchar buf[50]; - gint index[5][17]; - gint value[5][17]; - gint current_channel; + gint index[5][17]; + gint value[5][17]; + gint current_channel; if (!fgets (buf, 50, f)) return FALSE; @@ -1750,7 +1754,7 @@ curves_read_from_file (FILE *f) static void curves_write_to_file (FILE *f) { - int i, j; + gint i, j; gint32 index; for (i = 0; i < 5; i++) diff --git a/app/undo.c b/app/undo.c index c7d84ea953..4674afd5d1 100644 --- a/app/undo.c +++ b/app/undo.c @@ -1599,7 +1599,7 @@ undo_pop_layer_mod (GImage *gimage, GIMP_DRAWABLE (layer)->height = tiles->height; GIMP_DRAWABLE (layer)->bytes = tiles->bpp; GIMP_DRAWABLE (layer)->type = layer_type; - GIMP_DRAWABLE (layer)->has_alpha = TYPE_HAS_ALPHA (layer_type); + GIMP_DRAWABLE (layer)->has_alpha = GIMP_IMAGE_TYPE_HAS_ALPHA (layer_type); if (layer->mask) { diff --git a/plug-ins/common/sunras.c b/plug-ins/common/sunras.c index ba411c622e..2495b91658 100644 --- a/plug-ins/common/sunras.c +++ b/plug-ins/common/sunras.c @@ -881,7 +881,7 @@ set_color_table (gint32 image_ID, for (j = 0; j < ncols; j++) { - ColorMap[j*3] = suncolmap[j]; + ColorMap[j*3] = suncolmap[j]; ColorMap[j*3+1] = suncolmap[j+ncols]; ColorMap[j*3+2] = suncolmap[j+2*ncols]; } @@ -898,13 +898,13 @@ set_color_table (gint32 image_ID, /* Create an image. Sets layer_ID, drawable and rgn. Returns image_ID */ static gint32 -create_new_image (gchar *filename, - guint width, - guint height, - GimpImageBaseType type, - gint32 *layer_ID, - GimpDrawable **drawable, - GimpPixelRgn *pixel_rgn) +create_new_image (gchar *filename, + guint width, + guint height, + GimpImageBaseType type, + gint32 *layer_ID, + GimpDrawable **drawable, + GimpPixelRgn *pixel_rgn) { gint32 image_ID; GimpImageType gdtype; diff --git a/plug-ins/common/xwd.c b/plug-ins/common/xwd.c index f181de67b7..9cc788696f 100644 --- a/plug-ins/common/xwd.c +++ b/plug-ins/common/xwd.c @@ -995,16 +995,15 @@ set_color_table (gint32 image_ID, /* Create an image. Sets layer_ID, drawable and rgn. Returns image_ID */ static gint32 -create_new_image (char *filename, - guint width, - guint height, +create_new_image (char *filename, + guint width, + guint height, GimpImageBaseType type, - gint32 *layer_ID, - GimpDrawable **drawable, - GimpPixelRgn *pixel_rgn) - + gint32 *layer_ID, + GimpDrawable **drawable, + GimpPixelRgn *pixel_rgn) { - gint32 image_ID; + gint32 image_ID; GimpImageType gdtype; switch (type)