From f6858e21d1927412b71ccf78478c69e36330ba83 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Wed, 18 Aug 1999 23:41:39 +0000 Subject: [PATCH] Actually use the enum types GimpImageType, GimpImageBaseType, * app/*.[ch]: Actually use the enum types GimpImageType, GimpImageBaseType, LayerModeEffects, PaintApplicationMode, BrushApplicationMode, GimpFillType and ConvertPaletteType, instead of just int or gint. Hopefully I catched most of the places where these should be used. Add an enum ConvolutionType, suffix the too general constants NORMAL, ABSOLUTE and NEGATIVE with _CONVOL. Use NORMAL_MODE instead of NORMAL in some places (this was what was intended). Fix some minor gccisms. * app/apptypes.h: New file. This file contains the above enumeration types, and some opaque struct typedefs. It was necessary to collect these in one header that doesn't include other headers, because when we started using the above mentioned types in the headers, all hell broke loose because of the spaghetti-like cross-inclusion mess between headers. (An example: Header A includes header B, which includes header C which includes A. B uses a type defined in A. This is not defined, because A hasn't defined it yet at the point where it includes B, and A included from B of course is skipped as we already are reading A.) --- app/actions/plug-in-commands.c | 4 +- app/airbrush.c | 19 +-- app/apptypes.h | 143 +++++++++++++++++++++++ app/brush_select.c | 2 +- app/channel.h | 7 +- app/color_picker.c | 2 +- app/convert.c | 17 +-- app/convert.h | 6 +- app/convolve.c | 2 +- app/core/gimp-edit.c | 6 +- app/core/gimpchannel-combine.h | 7 +- app/core/gimpchannel.h | 7 +- app/core/gimpcontext.c | 6 +- app/core/gimpcontext.h | 27 ++--- app/core/gimpdrawable.c | 7 +- app/core/gimpdrawable.h | 13 +-- app/core/gimpedit.c | 6 +- app/core/gimpimage-convert.c | 17 +-- app/core/gimpimage-convert.h | 6 +- app/core/gimpimage-guides.c | 50 ++++---- app/core/gimpimage-guides.h | 52 +++------ app/core/gimpimage-mask.c | 2 +- app/core/gimpimage-merge.c | 50 ++++---- app/core/gimpimage-merge.h | 52 +++------ app/core/gimpimage-projection.c | 50 ++++---- app/core/gimpimage-projection.h | 52 +++------ app/core/gimpimage-resize.c | 50 ++++---- app/core/gimpimage-resize.h | 52 +++------ app/core/gimpimage-scale.c | 50 ++++---- app/core/gimpimage-scale.h | 52 +++------ app/core/gimpimage.c | 50 ++++---- app/core/gimpimage.h | 52 +++------ app/core/gimplayer.c | 67 +++++------ app/core/gimplayer.h | 16 +-- app/core/gimpprojection-construct.c | 50 ++++---- app/core/gimpprojection-construct.h | 52 +++------ app/core/gimpprojection.c | 4 +- app/devices.c | 2 +- app/dialogs/image-new-dialog.c | 12 +- app/display/gimpdisplay.c | 4 +- app/display/gimpnavigationeditor.c | 2 + app/display/gimpnavigationview.c | 2 + app/drawable.c | 70 +++++------ app/drawable.h | 4 +- app/drawable_cmds.c | 2 +- app/file_new_dialog.c | 12 +- app/gdisplay.c | 4 +- app/gimage_mask.c | 2 +- app/gimpbrushhose.c | 2 +- app/gimpbrushpixmap.c | 3 +- app/gimpchannel.h | 7 +- app/gimpcontext.c | 6 +- app/gimpcontext.h | 27 ++--- app/gimpdrawable.c | 7 +- app/gimpdrawable.h | 13 +-- app/gimpdrawableP.h | 4 +- app/gimpimage-convert.c | 17 +-- app/gimpimage-convert.h | 6 +- app/gimpimage.c | 50 ++++---- app/gimpimage.h | 52 +++------ app/gimpimageP.h | 4 +- app/gimplayer.c | 67 +++++------ app/gimplayer.h | 16 +-- app/global_edit.c | 6 +- app/gui/brush-select.c | 2 +- app/gui/device-status-dialog.c | 2 +- app/gui/file-new-dialog.c | 12 +- app/gui/indicator-area.c | 2 +- app/gui/input-dialog.c | 2 +- app/gui/plug-in-commands.c | 4 +- app/gui/plug-in-menus.c | 4 +- app/indicator_area.c | 2 +- app/iscissors.c | 6 +- app/layer.c | 67 +++++------ app/layer.h | 16 +-- app/layerF.h | 21 +--- app/layer_cmds.c | 5 +- app/layer_pvt.h | 2 +- app/makefile.msc | 3 + app/menus/plug-in-menus.c | 4 +- app/nav_window.c | 2 + app/paint-funcs/paint-funcs.c | 124 ++++++++++---------- app/paint-funcs/paint-funcs.h | 71 ++++------- app/paint/gimpairbrush.c | 19 +-- app/paint/gimpconvolve.c | 2 +- app/paint/gimppencil.c | 14 +-- app/paint_core.c | 65 ++++++----- app/paint_core.h | 34 +++--- app/paint_funcs.c | 124 ++++++++++---------- app/paint_funcs.h | 71 ++++------- app/paintbrush.c | 9 +- app/pencil.c | 14 +-- app/pixmapbrush.c | 9 +- app/plug-in/gimpplugin-message.c | 4 +- app/plug-in/gimpplugin-progress.c | 4 +- app/plug-in/gimpplugin-progress.h | 11 +- app/plug-in/gimpplugin.c | 4 +- app/plug-in/gimpplugin.h | 11 +- app/plug-in/gimppluginmanager-call.c | 4 +- app/plug-in/gimppluginmanager-run.c | 4 +- app/plug-in/gimppluginmanager.c | 4 +- app/plug-in/gimppluginmanager.h | 11 +- app/plug-in/gimppluginshm.c | 4 +- app/plug-in/plug-in-def.c | 4 +- app/plug-in/plug-in-def.h | 11 +- app/plug-in/plug-in-message.c | 4 +- app/plug-in/plug-in-params.c | 4 +- app/plug-in/plug-in-params.h | 11 +- app/plug-in/plug-in-progress.c | 4 +- app/plug-in/plug-in-progress.h | 11 +- app/plug-in/plug-in-run.c | 4 +- app/plug-in/plug-in-shm.c | 4 +- app/plug-in/plug-in.c | 4 +- app/plug-in/plug-in.h | 11 +- app/plug-in/plug-ins.c | 4 +- app/plug-in/plug-ins.h | 11 +- app/plug_in.c | 4 +- app/plug_in.h | 11 +- app/tools/airbrush.c | 19 +-- app/tools/color_picker.c | 2 +- app/tools/convolve.c | 2 +- app/tools/gimpairbrushtool.c | 19 +-- app/tools/gimpconvolvetool.c | 2 +- app/tools/gimpiscissorstool.c | 6 +- app/tools/gimppenciltool.c | 14 +-- app/tools/iscissors.c | 6 +- app/tools/paint_core.c | 65 ++++++----- app/tools/paint_core.h | 34 +++--- app/tools/paintbrush.c | 9 +- app/tools/pencil.c | 14 +-- app/widgets/gimpdeviceinfo.c | 2 +- app/widgets/gimpdevices.c | 2 +- app/widgets/gimptoolbox-indicator-area.c | 2 +- 133 files changed, 1250 insertions(+), 1333 deletions(-) create mode 100644 app/apptypes.h diff --git a/app/actions/plug-in-commands.c b/app/actions/plug-in-commands.c index 84174dda12..4f85f32aeb 100644 --- a/app/actions/plug-in-commands.c +++ b/app/actions/plug-in-commands.c @@ -1240,7 +1240,7 @@ plug_in_repeat (int with_interface) } void -plug_in_set_menu_sensitivity (int base_type) +plug_in_set_menu_sensitivity (GimpImageType type) { PlugInProcDef *proc_def; GSList *tmp; @@ -1254,7 +1254,7 @@ plug_in_set_menu_sensitivity (int base_type) if (proc_def->image_types_val && proc_def->menu_path) { - switch (base_type) + switch (type) { case -1: sensitive = FALSE; diff --git a/app/airbrush.c b/app/airbrush.c index a2db2f578e..52704792bc 100644 --- a/app/airbrush.c +++ b/app/airbrush.c @@ -86,7 +86,7 @@ static double non_gui_pressure; static gboolean non_gui_incremental; /* forward function declarations */ -static void airbrush_motion (PaintCore *, GimpDrawable *, double, gboolean); +static void airbrush_motion (PaintCore *, GimpDrawable *, double, PaintApplicationMode); static gint airbrush_time_out (gpointer); @@ -235,7 +235,8 @@ airbrush_paint_func (PaintCore *paint_core, gtk_timeout_remove (timer); timer_state = OFF; - airbrush_motion (paint_core, drawable, airbrush_options->pressure, airbrush_options->incremental); + airbrush_motion (paint_core, drawable, airbrush_options->pressure, + airbrush_options->incremental ? INCREMENTAL : CONSTANT); if (airbrush_options->rate != 0.0) { @@ -279,7 +280,7 @@ airbrush_time_out (gpointer client_data) airbrush_motion (airbrush_timeout.paint_core, airbrush_timeout.drawable, airbrush_options->pressure, - airbrush_options->incremental); + airbrush_options->incremental ? INCREMENTAL : CONSTANT); gdisplays_flush (); /* restart the timer */ @@ -291,10 +292,10 @@ airbrush_time_out (gpointer client_data) static void -airbrush_motion (PaintCore *paint_core, - GimpDrawable *drawable, - double pressure, - gboolean mode) +airbrush_motion (PaintCore *paint_core, + GimpDrawable *drawable, + double pressure, + PaintApplicationMode mode) { gint opacity; GImage *gimage; @@ -316,9 +317,9 @@ airbrush_motion (PaintCore *paint_core, col[area->bytes - 1] = OPAQUE_OPACITY; - if(GIMP_IS_BRUSH_PIXMAP(paint_core->brush)) + if (GIMP_IS_BRUSH_PIXMAP (paint_core->brush)) { - color_area_with_pixmap(gimage, drawable, area, paint_core->brush); + color_area_with_pixmap (gimage, drawable, area, paint_core->brush); mode = INCREMENTAL; } else diff --git a/app/apptypes.h b/app/apptypes.h new file mode 100644 index 0000000000..8bf5a5dc81 --- /dev/null +++ b/app/apptypes.h @@ -0,0 +1,143 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +#ifndef __APPTYPES_H__ +#define __APPTYPES_H__ + +/* To avoid problems with headers including each others like spaghetti + * (even recursively), and various types not being defined when they + * are needed depending on the order you happen to include headers, + * this file defines those enumeration and opaque struct types that + * don't depend on any other header. These problems began creeping up + * when we started to actually use these enums in function prototypes. +*/ + +/* Should we instead use the enums in libgimp/gimpenums.h? */ + +/* Base image types */ +typedef enum +{ + RGB, + GRAY, + INDEXED +} GimpImageBaseType; + +/* Image types */ +typedef enum +{ + RGB_GIMAGE, /*< nick=RGB_IMAGE >*/ + RGBA_GIMAGE, /*< nick=RGBA_IMAGE >*/ + GRAY_GIMAGE, /*< nick=GRAY_IMAGE >*/ + GRAYA_GIMAGE, /*< nick=GRAYA_IMAGE >*/ + INDEXED_GIMAGE, /*< nick=INDEXED_IMAGE >*/ + INDEXEDA_GIMAGE /*< nick=INDEXEDA_IMAGE >*/ +} GimpImageType; + +/* Fill types */ +typedef enum +{ + FOREGROUND_FILL, /*< nick=FG_IMAGE_FILL >*/ + BACKGROUND_FILL, /*< nick=BG_IMAGE_FILL >*/ + WHITE_FILL, /*< nick=WHITE_IMAGE_FILL >*/ + TRANSPARENT_FILL, /*< nick=TRANS_IMAGE_FILL >*/ + NO_FILL /*< nick=NO_IMAGE_FILL >*/ +} GimpFillType; + +/* Layer modes */ +typedef enum +{ + NORMAL_MODE, + DISSOLVE_MODE, + BEHIND_MODE, + MULTIPLY_MODE, + SCREEN_MODE, + OVERLAY_MODE, + DIFFERENCE_MODE, + ADDITION_MODE, + SUBTRACT_MODE, + DARKEN_ONLY_MODE, + LIGHTEN_ONLY_MODE, + HUE_MODE, + SATURATION_MODE, + COLOR_MODE, + VALUE_MODE, + DIVIDE_MODE, + ERASE_MODE, /*< skip >*/ + REPLACE_MODE, /*< skip >*/ + ANTI_ERASE_MODE, /*< skip >*/ +} LayerModeEffects; + +/* Types of convolutions */ +typedef enum +{ + NORMAL_CONVOL, /* Negative numbers truncated */ + ABSOLUTE_CONVOL, /* Absolute value */ + NEGATIVE_CONVOL /* add 127 to values */ +} ConvolutionType; + +/* Brush application types */ +typedef enum +{ + HARD, /* pencil */ + SOFT, /* paintbrush */ + PRESSURE /* paintbrush with variable pressure */ +} BrushApplicationMode; + +/* Paint application modes */ +typedef enum +{ + CONSTANT, /*< nick=CONTINUOUS >*/ /* pencil, paintbrush, airbrush, clone */ + INCREMENTAL /* convolve, smudge */ +} PaintApplicationMode; + +typedef enum +{ + APPLY, + DISCARD +} MaskApplyMode; + +typedef enum /*< chop=ADD_ >*/ +{ + ADD_WHITE_MASK, + ADD_BLACK_MASK, + ADD_ALPHA_MASK +} AddMaskType; + +typedef struct _GimpChannel GimpChannel; +typedef struct _GimpChannelClass GimpChannelClass; + +typedef GimpChannel Channel; /* convenience */ + +typedef struct _GimpLayer GimpLayer; +typedef struct _GimpLayerClass GimpLayerClass; +typedef struct _GimpLayerMask GimpLayerMask; +typedef struct _GimpLayerMaskClass GimpLayerMaskClass; + +typedef GimpLayer Layer; /* convenience */ +typedef GimpLayerMask LayerMask; /* convenience */ + +typedef struct _layer_undo LayerUndo; + +typedef struct _layer_mask_undo LayerMaskUndo; + +typedef struct _fs_to_layer_undo FStoLayerUndo; + +typedef struct _PlugIn PlugIn; +typedef struct _PlugInDef PlugInDef; +typedef struct _PlugInProcDef PlugInProcDef; + +#endif /* __APPTYPES_H__ */ diff --git a/app/brush_select.c b/app/brush_select.c index fa843f4e51..e08e28346d 100644 --- a/app/brush_select.c +++ b/app/brush_select.c @@ -901,7 +901,7 @@ display_brush (BrushSelectP bsp, { if (offset_y > 0 && offset_y < bsp->preview->allocation.height) gtk_preview_draw_row (GTK_PREVIEW (bsp->preview), - brush_scale_indicator_bits[i], + brush_scale_indicator_bits[i][0], offset_x, offset_y, brush_scale_indicator_width); } diff --git a/app/channel.h b/app/channel.h index 1e00178211..c9024dcfef 100644 --- a/app/channel.h +++ b/app/channel.h @@ -18,8 +18,8 @@ #ifndef __CHANNEL_H__ #define __CHANNEL_H__ +#include "apptypes.h" #include "drawable.h" - #include "boundary.h" #include "temp_buf.h" #include "tile_manager.h" @@ -47,11 +47,6 @@ typedef enum #define GIMP_IS_CHANNEL_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_CHANNEL)) -typedef struct _GimpChannel GimpChannel; -typedef struct _GimpChannelClass GimpChannelClass; - -typedef GimpChannel Channel; /* convenience */ - GtkType gimp_channel_get_type (void); /* Special undo type */ diff --git a/app/color_picker.c b/app/color_picker.c index c6c4d127a7..8ff7f08212 100644 --- a/app/color_picker.c +++ b/app/color_picker.c @@ -70,7 +70,7 @@ gint col_value[5] = { 0, 0, 0, 0, 0 }; /* the color picker dialog */ static gint update_type; -static gint sample_type; +static GimpImageType sample_type; static InfoDialog * color_picker_info = NULL; static gchar red_buf [MAX_INFO_BUF]; static gchar green_buf [MAX_INFO_BUF]; diff --git a/app/convert.c b/app/convert.c index b621f47eea..4a93f5b6ee 100644 --- a/app/convert.c +++ b/app/convert.c @@ -736,18 +736,21 @@ indexed_dither_update (GtkWidget *w, } void -convert_image (GImage *gimage, - int new_type, - int num_cols, /* used only for new_type == INDEXED */ - int dither, /* used only for new_type == INDEXED */ - int palette_type) /* used only for new_type == INDEXED */ +convert_image (GImage *gimage, + GimpImageBaseType new_type, + /* The following three params used only for + * new_type == INDEXED + */ + int num_cols, + int dither, + ConvertPaletteType palette_type) { QuantizeObj *quantobj; Layer *layer; Layer *floating_layer; - int old_type; + GimpImageBaseType old_type; GSList *list; - int new_layer_type; + GimpImageType new_layer_type; int new_layer_bytes; int has_alpha; TileManager *new_tiles; diff --git a/app/convert.h b/app/convert.h index dee8e8abdc..2372e83101 100644 --- a/app/convert.h +++ b/app/convert.h @@ -18,6 +18,7 @@ #ifndef __CONVERT_H__ #define __CONVERT_H__ +#include "apptypes.h" #include "procedural_db.h" #include "gimpimageF.h" #include "palette_entries.h" @@ -38,7 +39,10 @@ void convert_to_rgb (GimpImage *); void convert_to_grayscale (GimpImage *); void convert_to_indexed (GimpImage *); -void convert_image (GimpImage *, int, int, int, int); +void convert_image (GimpImage *, + GimpImageBaseType, + int, int, + ConvertPaletteType); extern PaletteEntriesP theCustomPalette; diff --git a/app/convolve.c b/app/convolve.c index a4c11ff8b6..52ebf40ff5 100644 --- a/app/convolve.c +++ b/app/convolve.c @@ -337,7 +337,7 @@ convolve_motion (PaintCore *paint_core, /* Convolve the region */ convolve_region (&tempPR, &destPR, matrix, matrix_size, - matrix_divisor, NORMAL); + matrix_divisor, NORMAL_CONVOL); if (drawable_has_alpha (drawable)) separate_alpha_region (&destPR); diff --git a/app/core/gimp-edit.c b/app/core/gimp-edit.c index 24e866504c..7eb22f00c2 100644 --- a/app/core/gimp-edit.c +++ b/app/core/gimp-edit.c @@ -285,7 +285,7 @@ edit_paste (GImage *gimage, int cx, cy; /* Make a new floating layer */ - float_layer = layer_from_tiles (gimage, drawable, paste, _("Pasted Layer"), OPAQUE_OPACITY, NORMAL); + float_layer = layer_from_tiles (gimage, drawable, paste, _("Pasted Layer"), OPAQUE_OPACITY, NORMAL_MODE); if (float_layer) { @@ -340,7 +340,7 @@ edit_paste_as_new (GImage *invoke, layer = layer_new (gimage, gimage->width, gimage->height, (invoke->base_type == RGB) ? RGBA_GIMAGE : GRAYA_GIMAGE, - _("Pasted Layer"), OPAQUE_OPACITY, NORMAL); + _("Pasted Layer"), OPAQUE_OPACITY, NORMAL_MODE); /* add the new layer to the image */ gimage_disable_undo (gimage); @@ -350,7 +350,7 @@ edit_paste_as_new (GImage *invoke, /* make a new floating layer */ float_layer = layer_from_tiles (gimage, drawable, paste, - _("Pasted Layer"), OPAQUE_OPACITY, NORMAL); + _("Pasted Layer"), OPAQUE_OPACITY, NORMAL_MODE); /* add the new floating selection */ floating_sel_attach (float_layer, drawable); diff --git a/app/core/gimpchannel-combine.h b/app/core/gimpchannel-combine.h index 1e00178211..c9024dcfef 100644 --- a/app/core/gimpchannel-combine.h +++ b/app/core/gimpchannel-combine.h @@ -18,8 +18,8 @@ #ifndef __CHANNEL_H__ #define __CHANNEL_H__ +#include "apptypes.h" #include "drawable.h" - #include "boundary.h" #include "temp_buf.h" #include "tile_manager.h" @@ -47,11 +47,6 @@ typedef enum #define GIMP_IS_CHANNEL_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_CHANNEL)) -typedef struct _GimpChannel GimpChannel; -typedef struct _GimpChannelClass GimpChannelClass; - -typedef GimpChannel Channel; /* convenience */ - GtkType gimp_channel_get_type (void); /* Special undo type */ diff --git a/app/core/gimpchannel.h b/app/core/gimpchannel.h index 1e00178211..c9024dcfef 100644 --- a/app/core/gimpchannel.h +++ b/app/core/gimpchannel.h @@ -18,8 +18,8 @@ #ifndef __CHANNEL_H__ #define __CHANNEL_H__ +#include "apptypes.h" #include "drawable.h" - #include "boundary.h" #include "temp_buf.h" #include "tile_manager.h" @@ -47,11 +47,6 @@ typedef enum #define GIMP_IS_CHANNEL_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_CHANNEL)) -typedef struct _GimpChannel GimpChannel; -typedef struct _GimpChannelClass GimpChannelClass; - -typedef GimpChannel Channel; /* convenience */ - GtkType gimp_channel_get_type (void); /* Special undo type */ diff --git a/app/core/gimpcontext.c b/app/core/gimpcontext.c index e1ddc7873e..afd677b3bd 100644 --- a/app/core/gimpcontext.c +++ b/app/core/gimpcontext.c @@ -428,7 +428,7 @@ gimp_context_define_opacity (GimpContext *context, /* paint mode */ -gint +LayerModeEffects gimp_context_get_paint_mode (GimpContext *context) { context_check_current (context); @@ -439,8 +439,8 @@ gimp_context_get_paint_mode (GimpContext *context) } void -gimp_context_set_paint_mode (GimpContext *context, - gint paint_mode) +gimp_context_set_paint_mode (GimpContext *context, + LayerModeEffects paint_mode) { context_check_current (context); context_return_if_fail (context); diff --git a/app/core/gimpcontext.h b/app/core/gimpcontext.h index 08714b7798..485ad9e80a 100644 --- a/app/core/gimpcontext.h +++ b/app/core/gimpcontext.h @@ -51,26 +51,26 @@ typedef struct _GimpContextClass GimpContextClass; struct _GimpContext { - GimpObject object; + GimpObject object; - gchar *name; - GimpContext *parent; + gchar *name; + GimpContext *parent; /* FIXME: the solution of having a boolean for each attribute and the * name "defined" need some brainstorming */ - gboolean opacity_defined; - gdouble opacity; + gboolean opacity_defined; + gdouble opacity; - gboolean paint_mode_defined; - gint paint_mode; + gboolean paint_mode_defined; + LayerModeEffects paint_mode; - gboolean image_defined; - GimpImage *image; + gboolean image_defined; + GimpImage *image; - gboolean display_defined; - GDisplay *display; + gboolean display_defined; + GDisplay *display; }; struct _GimpContextClass @@ -136,9 +136,10 @@ gboolean gimp_context_opacity_defined (GimpContext *context); void gimp_context_define_opacity (GimpContext *context, gboolean defined); -gint gimp_context_get_paint_mode (GimpContext *context); +LayerModeEffects + gimp_context_get_paint_mode (GimpContext *context); void gimp_context_set_paint_mode (GimpContext *context, - gint paint_mode); + LayerModeEffects paint_mode); gboolean gimp_context_paint_mode_defined (GimpContext *context); void gimp_context_define_paint_mode (GimpContext *context, gboolean defined); diff --git a/app/core/gimpdrawable.c b/app/core/gimpdrawable.c index 38c8ac83e6..9169a81c21 100644 --- a/app/core/gimpdrawable.c +++ b/app/core/gimpdrawable.c @@ -274,7 +274,7 @@ gimp_drawable_set_gimage (GimpDrawable *drawable, GimpImage *gimage) } -int +GimpImageType gimp_drawable_type (GimpDrawable *drawable) { if (drawable) @@ -498,7 +498,7 @@ gimp_drawable_get_tattoo(const GimpDrawable *drawable) int gimp_drawable_type_with_alpha (GimpDrawable *drawable) { - int type = gimp_drawable_type (drawable); + GimpImageType type = gimp_drawable_type (drawable); int has_alpha = gimp_drawable_has_alpha (drawable); if (has_alpha) @@ -692,7 +692,7 @@ gimp_drawable_destroy (GtkObject *object) void gimp_drawable_configure (GimpDrawable *drawable, GimpImage* gimage, int width, int height, - int type, char *name) + GimpImageType type, char *name) { int bpp; int alpha; @@ -743,4 +743,3 @@ gimp_drawable_configure (GimpDrawable *drawable, drawable->preview_cache = NULL; drawable->preview_valid = FALSE; } - diff --git a/app/core/gimpdrawable.h b/app/core/gimpdrawable.h index d8f9132d37..ba7b4dad53 100644 --- a/app/core/gimpdrawable.h +++ b/app/core/gimpdrawable.h @@ -18,6 +18,7 @@ #ifndef __GIMPDRAWABLE_H__ #define __GIMPDRAWABLE_H__ +#include "apptypes.h" #include "gimpobject.h" #include "gimpdrawableF.h" #include "tile_manager.h" @@ -31,16 +32,6 @@ GtkType gimp_drawable_get_type (void); -typedef enum -{ - FOREGROUND_FILL, /*< nick=FG_IMAGE_FILL >*/ - BACKGROUND_FILL, /*< nick=BG_IMAGE_FILL >*/ - WHITE_FILL, /*< nick=WHITE_IMAGE_FILL >*/ - TRANSPARENT_FILL, /*< nick=TRANS_IMAGE_FILL >*/ - NO_FILL /*< nick=NO_IMAGE_FILL >*/ -} GimpFillType; - - /* drawable access functions */ void gimp_drawable_merge_shadow (GimpDrawable *, int); void gimp_drawable_fill (GimpDrawable *drawable, @@ -54,7 +45,7 @@ int gimp_drawable_mask_bounds (GimpDrawable *, void gimp_drawable_invalidate_preview (GimpDrawable *); int gimp_drawable_dirty (GimpDrawable *); int gimp_drawable_clean (GimpDrawable *); -int gimp_drawable_type (GimpDrawable *); +GimpImageType gimp_drawable_type (GimpDrawable *); int gimp_drawable_has_alpha (GimpDrawable *); int gimp_drawable_type_with_alpha (GimpDrawable *); int gimp_drawable_color (GimpDrawable *); diff --git a/app/core/gimpedit.c b/app/core/gimpedit.c index 24e866504c..7eb22f00c2 100644 --- a/app/core/gimpedit.c +++ b/app/core/gimpedit.c @@ -285,7 +285,7 @@ edit_paste (GImage *gimage, int cx, cy; /* Make a new floating layer */ - float_layer = layer_from_tiles (gimage, drawable, paste, _("Pasted Layer"), OPAQUE_OPACITY, NORMAL); + float_layer = layer_from_tiles (gimage, drawable, paste, _("Pasted Layer"), OPAQUE_OPACITY, NORMAL_MODE); if (float_layer) { @@ -340,7 +340,7 @@ edit_paste_as_new (GImage *invoke, layer = layer_new (gimage, gimage->width, gimage->height, (invoke->base_type == RGB) ? RGBA_GIMAGE : GRAYA_GIMAGE, - _("Pasted Layer"), OPAQUE_OPACITY, NORMAL); + _("Pasted Layer"), OPAQUE_OPACITY, NORMAL_MODE); /* add the new layer to the image */ gimage_disable_undo (gimage); @@ -350,7 +350,7 @@ edit_paste_as_new (GImage *invoke, /* make a new floating layer */ float_layer = layer_from_tiles (gimage, drawable, paste, - _("Pasted Layer"), OPAQUE_OPACITY, NORMAL); + _("Pasted Layer"), OPAQUE_OPACITY, NORMAL_MODE); /* add the new floating selection */ floating_sel_attach (float_layer, drawable); diff --git a/app/core/gimpimage-convert.c b/app/core/gimpimage-convert.c index b621f47eea..4a93f5b6ee 100644 --- a/app/core/gimpimage-convert.c +++ b/app/core/gimpimage-convert.c @@ -736,18 +736,21 @@ indexed_dither_update (GtkWidget *w, } void -convert_image (GImage *gimage, - int new_type, - int num_cols, /* used only for new_type == INDEXED */ - int dither, /* used only for new_type == INDEXED */ - int palette_type) /* used only for new_type == INDEXED */ +convert_image (GImage *gimage, + GimpImageBaseType new_type, + /* The following three params used only for + * new_type == INDEXED + */ + int num_cols, + int dither, + ConvertPaletteType palette_type) { QuantizeObj *quantobj; Layer *layer; Layer *floating_layer; - int old_type; + GimpImageBaseType old_type; GSList *list; - int new_layer_type; + GimpImageType new_layer_type; int new_layer_bytes; int has_alpha; TileManager *new_tiles; diff --git a/app/core/gimpimage-convert.h b/app/core/gimpimage-convert.h index dee8e8abdc..2372e83101 100644 --- a/app/core/gimpimage-convert.h +++ b/app/core/gimpimage-convert.h @@ -18,6 +18,7 @@ #ifndef __CONVERT_H__ #define __CONVERT_H__ +#include "apptypes.h" #include "procedural_db.h" #include "gimpimageF.h" #include "palette_entries.h" @@ -38,7 +39,10 @@ void convert_to_rgb (GimpImage *); void convert_to_grayscale (GimpImage *); void convert_to_indexed (GimpImage *); -void convert_image (GimpImage *, int, int, int, int); +void convert_image (GimpImage *, + GimpImageBaseType, + int, int, + ConvertPaletteType); extern PaletteEntriesP theCustomPalette; diff --git a/app/core/gimpimage-guides.c b/app/core/gimpimage-guides.c index 277a4c9748..e2a4c6401f 100644 --- a/app/core/gimpimage-guides.c +++ b/app/core/gimpimage-guides.c @@ -250,7 +250,7 @@ gimp_image_allocate_shadow (GimpImage *gimage, GimpImage * gimp_image_new (int width, int height, - int base_type) + GimpImageBaseType base_type) { GimpImage *gimage=GIMP_IMAGE(gtk_type_new(gimp_image_get_type ())); int i; @@ -621,16 +621,16 @@ gimp_image_destroy (GtkObject *object) } void -gimp_image_apply_image (GimpImage *gimage, - GimpDrawable *drawable, - PixelRegion *src2PR, - int undo, - int opacity, - int mode, +gimp_image_apply_image (GimpImage *gimage, + GimpDrawable *drawable, + PixelRegion *src2PR, + int undo, + int opacity, + LayerModeEffects mode, /* alternative to using drawable tiles as src1: */ - TileManager *src1_tiles, - int x, - int y) + TileManager *src1_tiles, + int x, + int y) { Channel *mask; int x1, y1, x2, y2; @@ -893,7 +893,7 @@ gimp_image_get_color_at (GimpImage *gimage, void gimp_image_get_color (GimpImage *gimage, - int d_type, + GimpImageType d_type, unsigned char *rgb, unsigned char *src) { @@ -913,14 +913,14 @@ gimp_image_get_color (GimpImage *gimage, void -gimp_image_transform_color (GimpImage *gimage, - GimpDrawable *drawable, - unsigned char *src, - unsigned char *dest, - int type) +gimp_image_transform_color (GimpImage *gimage, + GimpDrawable *drawable, + unsigned char *src, + unsigned char *dest, + GimpImageBaseType type) { #define INTENSITY(r,g,b) (r * 0.30 + g * 0.59 + b * 0.11 + 0.001) - int d_type; + GimpImageType d_type; d_type = (drawable != NULL) ? drawable_type (drawable) : gimp_image_base_type_with_alpha (gimage); @@ -1214,14 +1214,14 @@ project_channel (GimpImage *gimage, type = (channel->show_masked) ? INITIAL_CHANNEL_MASK : INITIAL_CHANNEL_SELECTION; initial_region (src2, src, NULL, channel->col, channel->opacity, - NORMAL, NULL, type); + NORMAL_MODE, NULL, type); } else { type = (channel->show_masked) ? COMBINE_INTEN_A_CHANNEL_MASK : COMBINE_INTEN_A_CHANNEL_SELECTION; combine_regions (src, src2, src, NULL, channel->col, channel->opacity, - NORMAL, NULL, type); + NORMAL_MODE, NULL, type); } } @@ -2569,7 +2569,7 @@ gimp_image_merge_layers (GimpImage *gimage, Layer *layer; Layer *bottom; unsigned char bg[4] = {0, 0, 0, 0}; - int type; + GimpImageType type; int count; int x1, y1, x2, y2; int x3, y3, x4, y4; @@ -2721,7 +2721,7 @@ gimp_image_merge_layers (GimpImage *gimage, * Keep a pointer to it so that we can set the mode right after it's been * merged so that undo works correctly. */ - layer -> mode =NORMAL; + layer->mode = NORMAL_MODE; bottom = layer; } @@ -3246,13 +3246,13 @@ gimp_image_active_drawable (GimpImage *gimage) return NULL; } -int +GimpImageBaseType gimp_image_base_type (GimpImage *gimage) { return gimage->base_type; } -int +GimpImageType gimp_image_base_type_with_alpha (GimpImage *gimage) { switch (gimage->base_type) @@ -3352,7 +3352,7 @@ gimp_image_projection (GimpImage *gimage) return gimage->projection; } -int +GimpImageType gimp_image_projection_type (GimpImage *gimage) { return gimage->proj_type; @@ -3386,7 +3386,7 @@ gimp_image_composite (GimpImage *gimage) return gimp_image_projection (gimage); } -int +GimpImageType gimp_image_composite_type (GimpImage *gimage) { return gimp_image_projection_type (gimage); diff --git a/app/core/gimpimage-guides.h b/app/core/gimpimage-guides.h index 7cc3e051af..3bcb3c53f2 100644 --- a/app/core/gimpimage-guides.h +++ b/app/core/gimpimage-guides.h @@ -1,9 +1,9 @@ #ifndef __GIMPIMAGE_H__ #define __GIMPIMAGE_H__ +#include "apptypes.h" #include "procedural_db.h" #include "gimpimageF.h" - #include "boundary.h" #include "drawable.h" #include "channel.h" @@ -22,20 +22,6 @@ #define GIMP_IS_IMAGE(obj) GTK_CHECK_TYPE (obj, GIMP_TYPE_IMAGE) - -/* the image types */ -typedef enum -{ - RGB_GIMAGE, /*< nick=RGB_IMAGE >*/ - RGBA_GIMAGE, /*< nick=RGBA_IMAGE >*/ - GRAY_GIMAGE, /*< nick=GRAY_IMAGE >*/ - GRAYA_GIMAGE, /*< nick=GRAYA_IMAGE >*/ - INDEXED_GIMAGE, /*< nick=INDEXED_IMAGE >*/ - INDEXEDA_GIMAGE /*< nick=INDEXEDA_IMAGE >*/ -} GimpImageType; - - - #define TYPE_HAS_ALPHA(t) ((t)==RGBA_GIMAGE || (t)==GRAYA_GIMAGE || (t)==INDEXEDA_GIMAGE) #define GRAY_PIX 0 @@ -47,14 +33,6 @@ typedef enum #define INDEXED_PIX 0 #define ALPHA_I_PIX 1 -typedef enum -{ - RGB, - GRAY, - INDEXED -} GimpImageBaseType; - - #define COLORMAP_SIZE 768 typedef enum { @@ -113,7 +91,8 @@ GtkType gimp_image_get_type(void); /* function declarations */ -GimpImage * gimp_image_new (int, int, int); +GimpImage * gimp_image_new (int, int, + GimpImageBaseType); void gimp_image_set_filename (GimpImage *, char *); void gimp_image_set_resolution (GimpImage *, double, double); @@ -122,8 +101,9 @@ void gimp_image_get_resolution (GimpImage *, double *); void gimp_image_set_unit (GimpImage *, GUnit); GUnit gimp_image_get_unit (GimpImage *); -void gimp_image_set_save_proc (GimpImage *, PlugInProcDef *); -PlugInProcDef * gimp_image_get_save_proc (GimpImage *); +void gimp_image_set_save_proc (GimpImage *, + PlugInProcDef *); +PlugInProcDef * gimp_image_get_save_proc (GimpImage *); void gimp_image_resize (GimpImage *, int, int, int, int); void gimp_image_scale (GimpImage *, int, int); GimpImage * gimp_image_get_named (char *); @@ -132,7 +112,8 @@ TileManager * gimp_image_shadow (GimpImage *, int, int, int); void gimp_image_free_shadow (GimpImage *); void gimp_image_apply_image (GimpImage *, GimpDrawable *, PixelRegion *, int, - int, int, + int, + LayerModeEffects, TileManager *, int, int); void gimp_image_replace_image (GimpImage *, GimpDrawable *, PixelRegion *, int, int, @@ -143,12 +124,15 @@ void gimp_image_get_background (GimpImage *, GimpDrawable *, unsigned char *); unsigned char * gimp_image_get_color_at (GimpImage *, int x, int y); -void gimp_image_get_color (GimpImage *, int, +void gimp_image_get_color (GimpImage *, + GimpImageType, unsigned char *, unsigned char *); -void gimp_image_transform_color (GimpImage *, GimpDrawable *, +void gimp_image_transform_color (GimpImage *, + GimpDrawable *, unsigned char *, - unsigned char *, int); + unsigned char *, + GimpImageBaseType); Guide* gimp_image_add_hguide (GimpImage *); Guide* gimp_image_add_vguide (GimpImage *); void gimp_image_add_guide (GimpImage *, Guide *); @@ -227,8 +211,8 @@ void gimp_image_validate (TileManager *, Tile *); int gimp_image_is_empty (GimpImage *); GimpDrawable * gimp_image_active_drawable (GimpImage *); -int gimp_image_base_type (GimpImage *); -int gimp_image_base_type_with_alpha (GimpImage *); +GimpImageBaseType gimp_image_base_type (GimpImage *); +GimpImageType gimp_image_base_type_with_alpha (GimpImage *); char * gimp_image_filename (GimpImage *); int gimp_image_enable_undo (GimpImage *); int gimp_image_disable_undo (GimpImage *); @@ -242,7 +226,7 @@ unsigned char * gimp_image_cmap (GimpImage *); /* projection access functions */ TileManager * gimp_image_projection (GimpImage *); -int gimp_image_projection_type (GimpImage *); +GimpImageType gimp_image_projection_type (GimpImage *); int gimp_image_projection_bytes (GimpImage *); int gimp_image_projection_opacity (GimpImage *); void gimp_image_projection_realloc (GimpImage *); @@ -251,7 +235,7 @@ void gimp_image_projection_realloc (GimpImage *); /* composite access functions */ TileManager * gimp_image_composite (GimpImage *); -int gimp_image_composite_type (GimpImage *); +GimpImageType gimp_image_composite_type (GimpImage *); int gimp_image_composite_bytes (GimpImage *); TempBuf * gimp_image_composite_preview (GimpImage *, ChannelType, int, int); int gimp_image_preview_valid (GimpImage *, ChannelType); diff --git a/app/core/gimpimage-mask.c b/app/core/gimpimage-mask.c index cccbacda37..83a7f497fb 100644 --- a/app/core/gimpimage-mask.c +++ b/app/core/gimpimage-mask.c @@ -352,7 +352,7 @@ gimage_mask_float (GImage *gimage, /* Create a new layer from the buffer */ layer = layer_from_tiles (gimage, drawable, tiles, _("Floated Layer"), - OPAQUE_OPACITY, NORMAL); + OPAQUE_OPACITY, NORMAL_MODE); /* Set the offsets */ GIMP_DRAWABLE(layer)->offset_x = tiles->x + off_x; diff --git a/app/core/gimpimage-merge.c b/app/core/gimpimage-merge.c index 277a4c9748..e2a4c6401f 100644 --- a/app/core/gimpimage-merge.c +++ b/app/core/gimpimage-merge.c @@ -250,7 +250,7 @@ gimp_image_allocate_shadow (GimpImage *gimage, GimpImage * gimp_image_new (int width, int height, - int base_type) + GimpImageBaseType base_type) { GimpImage *gimage=GIMP_IMAGE(gtk_type_new(gimp_image_get_type ())); int i; @@ -621,16 +621,16 @@ gimp_image_destroy (GtkObject *object) } void -gimp_image_apply_image (GimpImage *gimage, - GimpDrawable *drawable, - PixelRegion *src2PR, - int undo, - int opacity, - int mode, +gimp_image_apply_image (GimpImage *gimage, + GimpDrawable *drawable, + PixelRegion *src2PR, + int undo, + int opacity, + LayerModeEffects mode, /* alternative to using drawable tiles as src1: */ - TileManager *src1_tiles, - int x, - int y) + TileManager *src1_tiles, + int x, + int y) { Channel *mask; int x1, y1, x2, y2; @@ -893,7 +893,7 @@ gimp_image_get_color_at (GimpImage *gimage, void gimp_image_get_color (GimpImage *gimage, - int d_type, + GimpImageType d_type, unsigned char *rgb, unsigned char *src) { @@ -913,14 +913,14 @@ gimp_image_get_color (GimpImage *gimage, void -gimp_image_transform_color (GimpImage *gimage, - GimpDrawable *drawable, - unsigned char *src, - unsigned char *dest, - int type) +gimp_image_transform_color (GimpImage *gimage, + GimpDrawable *drawable, + unsigned char *src, + unsigned char *dest, + GimpImageBaseType type) { #define INTENSITY(r,g,b) (r * 0.30 + g * 0.59 + b * 0.11 + 0.001) - int d_type; + GimpImageType d_type; d_type = (drawable != NULL) ? drawable_type (drawable) : gimp_image_base_type_with_alpha (gimage); @@ -1214,14 +1214,14 @@ project_channel (GimpImage *gimage, type = (channel->show_masked) ? INITIAL_CHANNEL_MASK : INITIAL_CHANNEL_SELECTION; initial_region (src2, src, NULL, channel->col, channel->opacity, - NORMAL, NULL, type); + NORMAL_MODE, NULL, type); } else { type = (channel->show_masked) ? COMBINE_INTEN_A_CHANNEL_MASK : COMBINE_INTEN_A_CHANNEL_SELECTION; combine_regions (src, src2, src, NULL, channel->col, channel->opacity, - NORMAL, NULL, type); + NORMAL_MODE, NULL, type); } } @@ -2569,7 +2569,7 @@ gimp_image_merge_layers (GimpImage *gimage, Layer *layer; Layer *bottom; unsigned char bg[4] = {0, 0, 0, 0}; - int type; + GimpImageType type; int count; int x1, y1, x2, y2; int x3, y3, x4, y4; @@ -2721,7 +2721,7 @@ gimp_image_merge_layers (GimpImage *gimage, * Keep a pointer to it so that we can set the mode right after it's been * merged so that undo works correctly. */ - layer -> mode =NORMAL; + layer->mode = NORMAL_MODE; bottom = layer; } @@ -3246,13 +3246,13 @@ gimp_image_active_drawable (GimpImage *gimage) return NULL; } -int +GimpImageBaseType gimp_image_base_type (GimpImage *gimage) { return gimage->base_type; } -int +GimpImageType gimp_image_base_type_with_alpha (GimpImage *gimage) { switch (gimage->base_type) @@ -3352,7 +3352,7 @@ gimp_image_projection (GimpImage *gimage) return gimage->projection; } -int +GimpImageType gimp_image_projection_type (GimpImage *gimage) { return gimage->proj_type; @@ -3386,7 +3386,7 @@ gimp_image_composite (GimpImage *gimage) return gimp_image_projection (gimage); } -int +GimpImageType gimp_image_composite_type (GimpImage *gimage) { return gimp_image_projection_type (gimage); diff --git a/app/core/gimpimage-merge.h b/app/core/gimpimage-merge.h index 7cc3e051af..3bcb3c53f2 100644 --- a/app/core/gimpimage-merge.h +++ b/app/core/gimpimage-merge.h @@ -1,9 +1,9 @@ #ifndef __GIMPIMAGE_H__ #define __GIMPIMAGE_H__ +#include "apptypes.h" #include "procedural_db.h" #include "gimpimageF.h" - #include "boundary.h" #include "drawable.h" #include "channel.h" @@ -22,20 +22,6 @@ #define GIMP_IS_IMAGE(obj) GTK_CHECK_TYPE (obj, GIMP_TYPE_IMAGE) - -/* the image types */ -typedef enum -{ - RGB_GIMAGE, /*< nick=RGB_IMAGE >*/ - RGBA_GIMAGE, /*< nick=RGBA_IMAGE >*/ - GRAY_GIMAGE, /*< nick=GRAY_IMAGE >*/ - GRAYA_GIMAGE, /*< nick=GRAYA_IMAGE >*/ - INDEXED_GIMAGE, /*< nick=INDEXED_IMAGE >*/ - INDEXEDA_GIMAGE /*< nick=INDEXEDA_IMAGE >*/ -} GimpImageType; - - - #define TYPE_HAS_ALPHA(t) ((t)==RGBA_GIMAGE || (t)==GRAYA_GIMAGE || (t)==INDEXEDA_GIMAGE) #define GRAY_PIX 0 @@ -47,14 +33,6 @@ typedef enum #define INDEXED_PIX 0 #define ALPHA_I_PIX 1 -typedef enum -{ - RGB, - GRAY, - INDEXED -} GimpImageBaseType; - - #define COLORMAP_SIZE 768 typedef enum { @@ -113,7 +91,8 @@ GtkType gimp_image_get_type(void); /* function declarations */ -GimpImage * gimp_image_new (int, int, int); +GimpImage * gimp_image_new (int, int, + GimpImageBaseType); void gimp_image_set_filename (GimpImage *, char *); void gimp_image_set_resolution (GimpImage *, double, double); @@ -122,8 +101,9 @@ void gimp_image_get_resolution (GimpImage *, double *); void gimp_image_set_unit (GimpImage *, GUnit); GUnit gimp_image_get_unit (GimpImage *); -void gimp_image_set_save_proc (GimpImage *, PlugInProcDef *); -PlugInProcDef * gimp_image_get_save_proc (GimpImage *); +void gimp_image_set_save_proc (GimpImage *, + PlugInProcDef *); +PlugInProcDef * gimp_image_get_save_proc (GimpImage *); void gimp_image_resize (GimpImage *, int, int, int, int); void gimp_image_scale (GimpImage *, int, int); GimpImage * gimp_image_get_named (char *); @@ -132,7 +112,8 @@ TileManager * gimp_image_shadow (GimpImage *, int, int, int); void gimp_image_free_shadow (GimpImage *); void gimp_image_apply_image (GimpImage *, GimpDrawable *, PixelRegion *, int, - int, int, + int, + LayerModeEffects, TileManager *, int, int); void gimp_image_replace_image (GimpImage *, GimpDrawable *, PixelRegion *, int, int, @@ -143,12 +124,15 @@ void gimp_image_get_background (GimpImage *, GimpDrawable *, unsigned char *); unsigned char * gimp_image_get_color_at (GimpImage *, int x, int y); -void gimp_image_get_color (GimpImage *, int, +void gimp_image_get_color (GimpImage *, + GimpImageType, unsigned char *, unsigned char *); -void gimp_image_transform_color (GimpImage *, GimpDrawable *, +void gimp_image_transform_color (GimpImage *, + GimpDrawable *, unsigned char *, - unsigned char *, int); + unsigned char *, + GimpImageBaseType); Guide* gimp_image_add_hguide (GimpImage *); Guide* gimp_image_add_vguide (GimpImage *); void gimp_image_add_guide (GimpImage *, Guide *); @@ -227,8 +211,8 @@ void gimp_image_validate (TileManager *, Tile *); int gimp_image_is_empty (GimpImage *); GimpDrawable * gimp_image_active_drawable (GimpImage *); -int gimp_image_base_type (GimpImage *); -int gimp_image_base_type_with_alpha (GimpImage *); +GimpImageBaseType gimp_image_base_type (GimpImage *); +GimpImageType gimp_image_base_type_with_alpha (GimpImage *); char * gimp_image_filename (GimpImage *); int gimp_image_enable_undo (GimpImage *); int gimp_image_disable_undo (GimpImage *); @@ -242,7 +226,7 @@ unsigned char * gimp_image_cmap (GimpImage *); /* projection access functions */ TileManager * gimp_image_projection (GimpImage *); -int gimp_image_projection_type (GimpImage *); +GimpImageType gimp_image_projection_type (GimpImage *); int gimp_image_projection_bytes (GimpImage *); int gimp_image_projection_opacity (GimpImage *); void gimp_image_projection_realloc (GimpImage *); @@ -251,7 +235,7 @@ void gimp_image_projection_realloc (GimpImage *); /* composite access functions */ TileManager * gimp_image_composite (GimpImage *); -int gimp_image_composite_type (GimpImage *); +GimpImageType gimp_image_composite_type (GimpImage *); int gimp_image_composite_bytes (GimpImage *); TempBuf * gimp_image_composite_preview (GimpImage *, ChannelType, int, int); int gimp_image_preview_valid (GimpImage *, ChannelType); diff --git a/app/core/gimpimage-projection.c b/app/core/gimpimage-projection.c index 277a4c9748..e2a4c6401f 100644 --- a/app/core/gimpimage-projection.c +++ b/app/core/gimpimage-projection.c @@ -250,7 +250,7 @@ gimp_image_allocate_shadow (GimpImage *gimage, GimpImage * gimp_image_new (int width, int height, - int base_type) + GimpImageBaseType base_type) { GimpImage *gimage=GIMP_IMAGE(gtk_type_new(gimp_image_get_type ())); int i; @@ -621,16 +621,16 @@ gimp_image_destroy (GtkObject *object) } void -gimp_image_apply_image (GimpImage *gimage, - GimpDrawable *drawable, - PixelRegion *src2PR, - int undo, - int opacity, - int mode, +gimp_image_apply_image (GimpImage *gimage, + GimpDrawable *drawable, + PixelRegion *src2PR, + int undo, + int opacity, + LayerModeEffects mode, /* alternative to using drawable tiles as src1: */ - TileManager *src1_tiles, - int x, - int y) + TileManager *src1_tiles, + int x, + int y) { Channel *mask; int x1, y1, x2, y2; @@ -893,7 +893,7 @@ gimp_image_get_color_at (GimpImage *gimage, void gimp_image_get_color (GimpImage *gimage, - int d_type, + GimpImageType d_type, unsigned char *rgb, unsigned char *src) { @@ -913,14 +913,14 @@ gimp_image_get_color (GimpImage *gimage, void -gimp_image_transform_color (GimpImage *gimage, - GimpDrawable *drawable, - unsigned char *src, - unsigned char *dest, - int type) +gimp_image_transform_color (GimpImage *gimage, + GimpDrawable *drawable, + unsigned char *src, + unsigned char *dest, + GimpImageBaseType type) { #define INTENSITY(r,g,b) (r * 0.30 + g * 0.59 + b * 0.11 + 0.001) - int d_type; + GimpImageType d_type; d_type = (drawable != NULL) ? drawable_type (drawable) : gimp_image_base_type_with_alpha (gimage); @@ -1214,14 +1214,14 @@ project_channel (GimpImage *gimage, type = (channel->show_masked) ? INITIAL_CHANNEL_MASK : INITIAL_CHANNEL_SELECTION; initial_region (src2, src, NULL, channel->col, channel->opacity, - NORMAL, NULL, type); + NORMAL_MODE, NULL, type); } else { type = (channel->show_masked) ? COMBINE_INTEN_A_CHANNEL_MASK : COMBINE_INTEN_A_CHANNEL_SELECTION; combine_regions (src, src2, src, NULL, channel->col, channel->opacity, - NORMAL, NULL, type); + NORMAL_MODE, NULL, type); } } @@ -2569,7 +2569,7 @@ gimp_image_merge_layers (GimpImage *gimage, Layer *layer; Layer *bottom; unsigned char bg[4] = {0, 0, 0, 0}; - int type; + GimpImageType type; int count; int x1, y1, x2, y2; int x3, y3, x4, y4; @@ -2721,7 +2721,7 @@ gimp_image_merge_layers (GimpImage *gimage, * Keep a pointer to it so that we can set the mode right after it's been * merged so that undo works correctly. */ - layer -> mode =NORMAL; + layer->mode = NORMAL_MODE; bottom = layer; } @@ -3246,13 +3246,13 @@ gimp_image_active_drawable (GimpImage *gimage) return NULL; } -int +GimpImageBaseType gimp_image_base_type (GimpImage *gimage) { return gimage->base_type; } -int +GimpImageType gimp_image_base_type_with_alpha (GimpImage *gimage) { switch (gimage->base_type) @@ -3352,7 +3352,7 @@ gimp_image_projection (GimpImage *gimage) return gimage->projection; } -int +GimpImageType gimp_image_projection_type (GimpImage *gimage) { return gimage->proj_type; @@ -3386,7 +3386,7 @@ gimp_image_composite (GimpImage *gimage) return gimp_image_projection (gimage); } -int +GimpImageType gimp_image_composite_type (GimpImage *gimage) { return gimp_image_projection_type (gimage); diff --git a/app/core/gimpimage-projection.h b/app/core/gimpimage-projection.h index 7cc3e051af..3bcb3c53f2 100644 --- a/app/core/gimpimage-projection.h +++ b/app/core/gimpimage-projection.h @@ -1,9 +1,9 @@ #ifndef __GIMPIMAGE_H__ #define __GIMPIMAGE_H__ +#include "apptypes.h" #include "procedural_db.h" #include "gimpimageF.h" - #include "boundary.h" #include "drawable.h" #include "channel.h" @@ -22,20 +22,6 @@ #define GIMP_IS_IMAGE(obj) GTK_CHECK_TYPE (obj, GIMP_TYPE_IMAGE) - -/* the image types */ -typedef enum -{ - RGB_GIMAGE, /*< nick=RGB_IMAGE >*/ - RGBA_GIMAGE, /*< nick=RGBA_IMAGE >*/ - GRAY_GIMAGE, /*< nick=GRAY_IMAGE >*/ - GRAYA_GIMAGE, /*< nick=GRAYA_IMAGE >*/ - INDEXED_GIMAGE, /*< nick=INDEXED_IMAGE >*/ - INDEXEDA_GIMAGE /*< nick=INDEXEDA_IMAGE >*/ -} GimpImageType; - - - #define TYPE_HAS_ALPHA(t) ((t)==RGBA_GIMAGE || (t)==GRAYA_GIMAGE || (t)==INDEXEDA_GIMAGE) #define GRAY_PIX 0 @@ -47,14 +33,6 @@ typedef enum #define INDEXED_PIX 0 #define ALPHA_I_PIX 1 -typedef enum -{ - RGB, - GRAY, - INDEXED -} GimpImageBaseType; - - #define COLORMAP_SIZE 768 typedef enum { @@ -113,7 +91,8 @@ GtkType gimp_image_get_type(void); /* function declarations */ -GimpImage * gimp_image_new (int, int, int); +GimpImage * gimp_image_new (int, int, + GimpImageBaseType); void gimp_image_set_filename (GimpImage *, char *); void gimp_image_set_resolution (GimpImage *, double, double); @@ -122,8 +101,9 @@ void gimp_image_get_resolution (GimpImage *, double *); void gimp_image_set_unit (GimpImage *, GUnit); GUnit gimp_image_get_unit (GimpImage *); -void gimp_image_set_save_proc (GimpImage *, PlugInProcDef *); -PlugInProcDef * gimp_image_get_save_proc (GimpImage *); +void gimp_image_set_save_proc (GimpImage *, + PlugInProcDef *); +PlugInProcDef * gimp_image_get_save_proc (GimpImage *); void gimp_image_resize (GimpImage *, int, int, int, int); void gimp_image_scale (GimpImage *, int, int); GimpImage * gimp_image_get_named (char *); @@ -132,7 +112,8 @@ TileManager * gimp_image_shadow (GimpImage *, int, int, int); void gimp_image_free_shadow (GimpImage *); void gimp_image_apply_image (GimpImage *, GimpDrawable *, PixelRegion *, int, - int, int, + int, + LayerModeEffects, TileManager *, int, int); void gimp_image_replace_image (GimpImage *, GimpDrawable *, PixelRegion *, int, int, @@ -143,12 +124,15 @@ void gimp_image_get_background (GimpImage *, GimpDrawable *, unsigned char *); unsigned char * gimp_image_get_color_at (GimpImage *, int x, int y); -void gimp_image_get_color (GimpImage *, int, +void gimp_image_get_color (GimpImage *, + GimpImageType, unsigned char *, unsigned char *); -void gimp_image_transform_color (GimpImage *, GimpDrawable *, +void gimp_image_transform_color (GimpImage *, + GimpDrawable *, unsigned char *, - unsigned char *, int); + unsigned char *, + GimpImageBaseType); Guide* gimp_image_add_hguide (GimpImage *); Guide* gimp_image_add_vguide (GimpImage *); void gimp_image_add_guide (GimpImage *, Guide *); @@ -227,8 +211,8 @@ void gimp_image_validate (TileManager *, Tile *); int gimp_image_is_empty (GimpImage *); GimpDrawable * gimp_image_active_drawable (GimpImage *); -int gimp_image_base_type (GimpImage *); -int gimp_image_base_type_with_alpha (GimpImage *); +GimpImageBaseType gimp_image_base_type (GimpImage *); +GimpImageType gimp_image_base_type_with_alpha (GimpImage *); char * gimp_image_filename (GimpImage *); int gimp_image_enable_undo (GimpImage *); int gimp_image_disable_undo (GimpImage *); @@ -242,7 +226,7 @@ unsigned char * gimp_image_cmap (GimpImage *); /* projection access functions */ TileManager * gimp_image_projection (GimpImage *); -int gimp_image_projection_type (GimpImage *); +GimpImageType gimp_image_projection_type (GimpImage *); int gimp_image_projection_bytes (GimpImage *); int gimp_image_projection_opacity (GimpImage *); void gimp_image_projection_realloc (GimpImage *); @@ -251,7 +235,7 @@ void gimp_image_projection_realloc (GimpImage *); /* composite access functions */ TileManager * gimp_image_composite (GimpImage *); -int gimp_image_composite_type (GimpImage *); +GimpImageType gimp_image_composite_type (GimpImage *); int gimp_image_composite_bytes (GimpImage *); TempBuf * gimp_image_composite_preview (GimpImage *, ChannelType, int, int); int gimp_image_preview_valid (GimpImage *, ChannelType); diff --git a/app/core/gimpimage-resize.c b/app/core/gimpimage-resize.c index 277a4c9748..e2a4c6401f 100644 --- a/app/core/gimpimage-resize.c +++ b/app/core/gimpimage-resize.c @@ -250,7 +250,7 @@ gimp_image_allocate_shadow (GimpImage *gimage, GimpImage * gimp_image_new (int width, int height, - int base_type) + GimpImageBaseType base_type) { GimpImage *gimage=GIMP_IMAGE(gtk_type_new(gimp_image_get_type ())); int i; @@ -621,16 +621,16 @@ gimp_image_destroy (GtkObject *object) } void -gimp_image_apply_image (GimpImage *gimage, - GimpDrawable *drawable, - PixelRegion *src2PR, - int undo, - int opacity, - int mode, +gimp_image_apply_image (GimpImage *gimage, + GimpDrawable *drawable, + PixelRegion *src2PR, + int undo, + int opacity, + LayerModeEffects mode, /* alternative to using drawable tiles as src1: */ - TileManager *src1_tiles, - int x, - int y) + TileManager *src1_tiles, + int x, + int y) { Channel *mask; int x1, y1, x2, y2; @@ -893,7 +893,7 @@ gimp_image_get_color_at (GimpImage *gimage, void gimp_image_get_color (GimpImage *gimage, - int d_type, + GimpImageType d_type, unsigned char *rgb, unsigned char *src) { @@ -913,14 +913,14 @@ gimp_image_get_color (GimpImage *gimage, void -gimp_image_transform_color (GimpImage *gimage, - GimpDrawable *drawable, - unsigned char *src, - unsigned char *dest, - int type) +gimp_image_transform_color (GimpImage *gimage, + GimpDrawable *drawable, + unsigned char *src, + unsigned char *dest, + GimpImageBaseType type) { #define INTENSITY(r,g,b) (r * 0.30 + g * 0.59 + b * 0.11 + 0.001) - int d_type; + GimpImageType d_type; d_type = (drawable != NULL) ? drawable_type (drawable) : gimp_image_base_type_with_alpha (gimage); @@ -1214,14 +1214,14 @@ project_channel (GimpImage *gimage, type = (channel->show_masked) ? INITIAL_CHANNEL_MASK : INITIAL_CHANNEL_SELECTION; initial_region (src2, src, NULL, channel->col, channel->opacity, - NORMAL, NULL, type); + NORMAL_MODE, NULL, type); } else { type = (channel->show_masked) ? COMBINE_INTEN_A_CHANNEL_MASK : COMBINE_INTEN_A_CHANNEL_SELECTION; combine_regions (src, src2, src, NULL, channel->col, channel->opacity, - NORMAL, NULL, type); + NORMAL_MODE, NULL, type); } } @@ -2569,7 +2569,7 @@ gimp_image_merge_layers (GimpImage *gimage, Layer *layer; Layer *bottom; unsigned char bg[4] = {0, 0, 0, 0}; - int type; + GimpImageType type; int count; int x1, y1, x2, y2; int x3, y3, x4, y4; @@ -2721,7 +2721,7 @@ gimp_image_merge_layers (GimpImage *gimage, * Keep a pointer to it so that we can set the mode right after it's been * merged so that undo works correctly. */ - layer -> mode =NORMAL; + layer->mode = NORMAL_MODE; bottom = layer; } @@ -3246,13 +3246,13 @@ gimp_image_active_drawable (GimpImage *gimage) return NULL; } -int +GimpImageBaseType gimp_image_base_type (GimpImage *gimage) { return gimage->base_type; } -int +GimpImageType gimp_image_base_type_with_alpha (GimpImage *gimage) { switch (gimage->base_type) @@ -3352,7 +3352,7 @@ gimp_image_projection (GimpImage *gimage) return gimage->projection; } -int +GimpImageType gimp_image_projection_type (GimpImage *gimage) { return gimage->proj_type; @@ -3386,7 +3386,7 @@ gimp_image_composite (GimpImage *gimage) return gimp_image_projection (gimage); } -int +GimpImageType gimp_image_composite_type (GimpImage *gimage) { return gimp_image_projection_type (gimage); diff --git a/app/core/gimpimage-resize.h b/app/core/gimpimage-resize.h index 7cc3e051af..3bcb3c53f2 100644 --- a/app/core/gimpimage-resize.h +++ b/app/core/gimpimage-resize.h @@ -1,9 +1,9 @@ #ifndef __GIMPIMAGE_H__ #define __GIMPIMAGE_H__ +#include "apptypes.h" #include "procedural_db.h" #include "gimpimageF.h" - #include "boundary.h" #include "drawable.h" #include "channel.h" @@ -22,20 +22,6 @@ #define GIMP_IS_IMAGE(obj) GTK_CHECK_TYPE (obj, GIMP_TYPE_IMAGE) - -/* the image types */ -typedef enum -{ - RGB_GIMAGE, /*< nick=RGB_IMAGE >*/ - RGBA_GIMAGE, /*< nick=RGBA_IMAGE >*/ - GRAY_GIMAGE, /*< nick=GRAY_IMAGE >*/ - GRAYA_GIMAGE, /*< nick=GRAYA_IMAGE >*/ - INDEXED_GIMAGE, /*< nick=INDEXED_IMAGE >*/ - INDEXEDA_GIMAGE /*< nick=INDEXEDA_IMAGE >*/ -} GimpImageType; - - - #define TYPE_HAS_ALPHA(t) ((t)==RGBA_GIMAGE || (t)==GRAYA_GIMAGE || (t)==INDEXEDA_GIMAGE) #define GRAY_PIX 0 @@ -47,14 +33,6 @@ typedef enum #define INDEXED_PIX 0 #define ALPHA_I_PIX 1 -typedef enum -{ - RGB, - GRAY, - INDEXED -} GimpImageBaseType; - - #define COLORMAP_SIZE 768 typedef enum { @@ -113,7 +91,8 @@ GtkType gimp_image_get_type(void); /* function declarations */ -GimpImage * gimp_image_new (int, int, int); +GimpImage * gimp_image_new (int, int, + GimpImageBaseType); void gimp_image_set_filename (GimpImage *, char *); void gimp_image_set_resolution (GimpImage *, double, double); @@ -122,8 +101,9 @@ void gimp_image_get_resolution (GimpImage *, double *); void gimp_image_set_unit (GimpImage *, GUnit); GUnit gimp_image_get_unit (GimpImage *); -void gimp_image_set_save_proc (GimpImage *, PlugInProcDef *); -PlugInProcDef * gimp_image_get_save_proc (GimpImage *); +void gimp_image_set_save_proc (GimpImage *, + PlugInProcDef *); +PlugInProcDef * gimp_image_get_save_proc (GimpImage *); void gimp_image_resize (GimpImage *, int, int, int, int); void gimp_image_scale (GimpImage *, int, int); GimpImage * gimp_image_get_named (char *); @@ -132,7 +112,8 @@ TileManager * gimp_image_shadow (GimpImage *, int, int, int); void gimp_image_free_shadow (GimpImage *); void gimp_image_apply_image (GimpImage *, GimpDrawable *, PixelRegion *, int, - int, int, + int, + LayerModeEffects, TileManager *, int, int); void gimp_image_replace_image (GimpImage *, GimpDrawable *, PixelRegion *, int, int, @@ -143,12 +124,15 @@ void gimp_image_get_background (GimpImage *, GimpDrawable *, unsigned char *); unsigned char * gimp_image_get_color_at (GimpImage *, int x, int y); -void gimp_image_get_color (GimpImage *, int, +void gimp_image_get_color (GimpImage *, + GimpImageType, unsigned char *, unsigned char *); -void gimp_image_transform_color (GimpImage *, GimpDrawable *, +void gimp_image_transform_color (GimpImage *, + GimpDrawable *, unsigned char *, - unsigned char *, int); + unsigned char *, + GimpImageBaseType); Guide* gimp_image_add_hguide (GimpImage *); Guide* gimp_image_add_vguide (GimpImage *); void gimp_image_add_guide (GimpImage *, Guide *); @@ -227,8 +211,8 @@ void gimp_image_validate (TileManager *, Tile *); int gimp_image_is_empty (GimpImage *); GimpDrawable * gimp_image_active_drawable (GimpImage *); -int gimp_image_base_type (GimpImage *); -int gimp_image_base_type_with_alpha (GimpImage *); +GimpImageBaseType gimp_image_base_type (GimpImage *); +GimpImageType gimp_image_base_type_with_alpha (GimpImage *); char * gimp_image_filename (GimpImage *); int gimp_image_enable_undo (GimpImage *); int gimp_image_disable_undo (GimpImage *); @@ -242,7 +226,7 @@ unsigned char * gimp_image_cmap (GimpImage *); /* projection access functions */ TileManager * gimp_image_projection (GimpImage *); -int gimp_image_projection_type (GimpImage *); +GimpImageType gimp_image_projection_type (GimpImage *); int gimp_image_projection_bytes (GimpImage *); int gimp_image_projection_opacity (GimpImage *); void gimp_image_projection_realloc (GimpImage *); @@ -251,7 +235,7 @@ void gimp_image_projection_realloc (GimpImage *); /* composite access functions */ TileManager * gimp_image_composite (GimpImage *); -int gimp_image_composite_type (GimpImage *); +GimpImageType gimp_image_composite_type (GimpImage *); int gimp_image_composite_bytes (GimpImage *); TempBuf * gimp_image_composite_preview (GimpImage *, ChannelType, int, int); int gimp_image_preview_valid (GimpImage *, ChannelType); diff --git a/app/core/gimpimage-scale.c b/app/core/gimpimage-scale.c index 277a4c9748..e2a4c6401f 100644 --- a/app/core/gimpimage-scale.c +++ b/app/core/gimpimage-scale.c @@ -250,7 +250,7 @@ gimp_image_allocate_shadow (GimpImage *gimage, GimpImage * gimp_image_new (int width, int height, - int base_type) + GimpImageBaseType base_type) { GimpImage *gimage=GIMP_IMAGE(gtk_type_new(gimp_image_get_type ())); int i; @@ -621,16 +621,16 @@ gimp_image_destroy (GtkObject *object) } void -gimp_image_apply_image (GimpImage *gimage, - GimpDrawable *drawable, - PixelRegion *src2PR, - int undo, - int opacity, - int mode, +gimp_image_apply_image (GimpImage *gimage, + GimpDrawable *drawable, + PixelRegion *src2PR, + int undo, + int opacity, + LayerModeEffects mode, /* alternative to using drawable tiles as src1: */ - TileManager *src1_tiles, - int x, - int y) + TileManager *src1_tiles, + int x, + int y) { Channel *mask; int x1, y1, x2, y2; @@ -893,7 +893,7 @@ gimp_image_get_color_at (GimpImage *gimage, void gimp_image_get_color (GimpImage *gimage, - int d_type, + GimpImageType d_type, unsigned char *rgb, unsigned char *src) { @@ -913,14 +913,14 @@ gimp_image_get_color (GimpImage *gimage, void -gimp_image_transform_color (GimpImage *gimage, - GimpDrawable *drawable, - unsigned char *src, - unsigned char *dest, - int type) +gimp_image_transform_color (GimpImage *gimage, + GimpDrawable *drawable, + unsigned char *src, + unsigned char *dest, + GimpImageBaseType type) { #define INTENSITY(r,g,b) (r * 0.30 + g * 0.59 + b * 0.11 + 0.001) - int d_type; + GimpImageType d_type; d_type = (drawable != NULL) ? drawable_type (drawable) : gimp_image_base_type_with_alpha (gimage); @@ -1214,14 +1214,14 @@ project_channel (GimpImage *gimage, type = (channel->show_masked) ? INITIAL_CHANNEL_MASK : INITIAL_CHANNEL_SELECTION; initial_region (src2, src, NULL, channel->col, channel->opacity, - NORMAL, NULL, type); + NORMAL_MODE, NULL, type); } else { type = (channel->show_masked) ? COMBINE_INTEN_A_CHANNEL_MASK : COMBINE_INTEN_A_CHANNEL_SELECTION; combine_regions (src, src2, src, NULL, channel->col, channel->opacity, - NORMAL, NULL, type); + NORMAL_MODE, NULL, type); } } @@ -2569,7 +2569,7 @@ gimp_image_merge_layers (GimpImage *gimage, Layer *layer; Layer *bottom; unsigned char bg[4] = {0, 0, 0, 0}; - int type; + GimpImageType type; int count; int x1, y1, x2, y2; int x3, y3, x4, y4; @@ -2721,7 +2721,7 @@ gimp_image_merge_layers (GimpImage *gimage, * Keep a pointer to it so that we can set the mode right after it's been * merged so that undo works correctly. */ - layer -> mode =NORMAL; + layer->mode = NORMAL_MODE; bottom = layer; } @@ -3246,13 +3246,13 @@ gimp_image_active_drawable (GimpImage *gimage) return NULL; } -int +GimpImageBaseType gimp_image_base_type (GimpImage *gimage) { return gimage->base_type; } -int +GimpImageType gimp_image_base_type_with_alpha (GimpImage *gimage) { switch (gimage->base_type) @@ -3352,7 +3352,7 @@ gimp_image_projection (GimpImage *gimage) return gimage->projection; } -int +GimpImageType gimp_image_projection_type (GimpImage *gimage) { return gimage->proj_type; @@ -3386,7 +3386,7 @@ gimp_image_composite (GimpImage *gimage) return gimp_image_projection (gimage); } -int +GimpImageType gimp_image_composite_type (GimpImage *gimage) { return gimp_image_projection_type (gimage); diff --git a/app/core/gimpimage-scale.h b/app/core/gimpimage-scale.h index 7cc3e051af..3bcb3c53f2 100644 --- a/app/core/gimpimage-scale.h +++ b/app/core/gimpimage-scale.h @@ -1,9 +1,9 @@ #ifndef __GIMPIMAGE_H__ #define __GIMPIMAGE_H__ +#include "apptypes.h" #include "procedural_db.h" #include "gimpimageF.h" - #include "boundary.h" #include "drawable.h" #include "channel.h" @@ -22,20 +22,6 @@ #define GIMP_IS_IMAGE(obj) GTK_CHECK_TYPE (obj, GIMP_TYPE_IMAGE) - -/* the image types */ -typedef enum -{ - RGB_GIMAGE, /*< nick=RGB_IMAGE >*/ - RGBA_GIMAGE, /*< nick=RGBA_IMAGE >*/ - GRAY_GIMAGE, /*< nick=GRAY_IMAGE >*/ - GRAYA_GIMAGE, /*< nick=GRAYA_IMAGE >*/ - INDEXED_GIMAGE, /*< nick=INDEXED_IMAGE >*/ - INDEXEDA_GIMAGE /*< nick=INDEXEDA_IMAGE >*/ -} GimpImageType; - - - #define TYPE_HAS_ALPHA(t) ((t)==RGBA_GIMAGE || (t)==GRAYA_GIMAGE || (t)==INDEXEDA_GIMAGE) #define GRAY_PIX 0 @@ -47,14 +33,6 @@ typedef enum #define INDEXED_PIX 0 #define ALPHA_I_PIX 1 -typedef enum -{ - RGB, - GRAY, - INDEXED -} GimpImageBaseType; - - #define COLORMAP_SIZE 768 typedef enum { @@ -113,7 +91,8 @@ GtkType gimp_image_get_type(void); /* function declarations */ -GimpImage * gimp_image_new (int, int, int); +GimpImage * gimp_image_new (int, int, + GimpImageBaseType); void gimp_image_set_filename (GimpImage *, char *); void gimp_image_set_resolution (GimpImage *, double, double); @@ -122,8 +101,9 @@ void gimp_image_get_resolution (GimpImage *, double *); void gimp_image_set_unit (GimpImage *, GUnit); GUnit gimp_image_get_unit (GimpImage *); -void gimp_image_set_save_proc (GimpImage *, PlugInProcDef *); -PlugInProcDef * gimp_image_get_save_proc (GimpImage *); +void gimp_image_set_save_proc (GimpImage *, + PlugInProcDef *); +PlugInProcDef * gimp_image_get_save_proc (GimpImage *); void gimp_image_resize (GimpImage *, int, int, int, int); void gimp_image_scale (GimpImage *, int, int); GimpImage * gimp_image_get_named (char *); @@ -132,7 +112,8 @@ TileManager * gimp_image_shadow (GimpImage *, int, int, int); void gimp_image_free_shadow (GimpImage *); void gimp_image_apply_image (GimpImage *, GimpDrawable *, PixelRegion *, int, - int, int, + int, + LayerModeEffects, TileManager *, int, int); void gimp_image_replace_image (GimpImage *, GimpDrawable *, PixelRegion *, int, int, @@ -143,12 +124,15 @@ void gimp_image_get_background (GimpImage *, GimpDrawable *, unsigned char *); unsigned char * gimp_image_get_color_at (GimpImage *, int x, int y); -void gimp_image_get_color (GimpImage *, int, +void gimp_image_get_color (GimpImage *, + GimpImageType, unsigned char *, unsigned char *); -void gimp_image_transform_color (GimpImage *, GimpDrawable *, +void gimp_image_transform_color (GimpImage *, + GimpDrawable *, unsigned char *, - unsigned char *, int); + unsigned char *, + GimpImageBaseType); Guide* gimp_image_add_hguide (GimpImage *); Guide* gimp_image_add_vguide (GimpImage *); void gimp_image_add_guide (GimpImage *, Guide *); @@ -227,8 +211,8 @@ void gimp_image_validate (TileManager *, Tile *); int gimp_image_is_empty (GimpImage *); GimpDrawable * gimp_image_active_drawable (GimpImage *); -int gimp_image_base_type (GimpImage *); -int gimp_image_base_type_with_alpha (GimpImage *); +GimpImageBaseType gimp_image_base_type (GimpImage *); +GimpImageType gimp_image_base_type_with_alpha (GimpImage *); char * gimp_image_filename (GimpImage *); int gimp_image_enable_undo (GimpImage *); int gimp_image_disable_undo (GimpImage *); @@ -242,7 +226,7 @@ unsigned char * gimp_image_cmap (GimpImage *); /* projection access functions */ TileManager * gimp_image_projection (GimpImage *); -int gimp_image_projection_type (GimpImage *); +GimpImageType gimp_image_projection_type (GimpImage *); int gimp_image_projection_bytes (GimpImage *); int gimp_image_projection_opacity (GimpImage *); void gimp_image_projection_realloc (GimpImage *); @@ -251,7 +235,7 @@ void gimp_image_projection_realloc (GimpImage *); /* composite access functions */ TileManager * gimp_image_composite (GimpImage *); -int gimp_image_composite_type (GimpImage *); +GimpImageType gimp_image_composite_type (GimpImage *); int gimp_image_composite_bytes (GimpImage *); TempBuf * gimp_image_composite_preview (GimpImage *, ChannelType, int, int); int gimp_image_preview_valid (GimpImage *, ChannelType); diff --git a/app/core/gimpimage.c b/app/core/gimpimage.c index 277a4c9748..e2a4c6401f 100644 --- a/app/core/gimpimage.c +++ b/app/core/gimpimage.c @@ -250,7 +250,7 @@ gimp_image_allocate_shadow (GimpImage *gimage, GimpImage * gimp_image_new (int width, int height, - int base_type) + GimpImageBaseType base_type) { GimpImage *gimage=GIMP_IMAGE(gtk_type_new(gimp_image_get_type ())); int i; @@ -621,16 +621,16 @@ gimp_image_destroy (GtkObject *object) } void -gimp_image_apply_image (GimpImage *gimage, - GimpDrawable *drawable, - PixelRegion *src2PR, - int undo, - int opacity, - int mode, +gimp_image_apply_image (GimpImage *gimage, + GimpDrawable *drawable, + PixelRegion *src2PR, + int undo, + int opacity, + LayerModeEffects mode, /* alternative to using drawable tiles as src1: */ - TileManager *src1_tiles, - int x, - int y) + TileManager *src1_tiles, + int x, + int y) { Channel *mask; int x1, y1, x2, y2; @@ -893,7 +893,7 @@ gimp_image_get_color_at (GimpImage *gimage, void gimp_image_get_color (GimpImage *gimage, - int d_type, + GimpImageType d_type, unsigned char *rgb, unsigned char *src) { @@ -913,14 +913,14 @@ gimp_image_get_color (GimpImage *gimage, void -gimp_image_transform_color (GimpImage *gimage, - GimpDrawable *drawable, - unsigned char *src, - unsigned char *dest, - int type) +gimp_image_transform_color (GimpImage *gimage, + GimpDrawable *drawable, + unsigned char *src, + unsigned char *dest, + GimpImageBaseType type) { #define INTENSITY(r,g,b) (r * 0.30 + g * 0.59 + b * 0.11 + 0.001) - int d_type; + GimpImageType d_type; d_type = (drawable != NULL) ? drawable_type (drawable) : gimp_image_base_type_with_alpha (gimage); @@ -1214,14 +1214,14 @@ project_channel (GimpImage *gimage, type = (channel->show_masked) ? INITIAL_CHANNEL_MASK : INITIAL_CHANNEL_SELECTION; initial_region (src2, src, NULL, channel->col, channel->opacity, - NORMAL, NULL, type); + NORMAL_MODE, NULL, type); } else { type = (channel->show_masked) ? COMBINE_INTEN_A_CHANNEL_MASK : COMBINE_INTEN_A_CHANNEL_SELECTION; combine_regions (src, src2, src, NULL, channel->col, channel->opacity, - NORMAL, NULL, type); + NORMAL_MODE, NULL, type); } } @@ -2569,7 +2569,7 @@ gimp_image_merge_layers (GimpImage *gimage, Layer *layer; Layer *bottom; unsigned char bg[4] = {0, 0, 0, 0}; - int type; + GimpImageType type; int count; int x1, y1, x2, y2; int x3, y3, x4, y4; @@ -2721,7 +2721,7 @@ gimp_image_merge_layers (GimpImage *gimage, * Keep a pointer to it so that we can set the mode right after it's been * merged so that undo works correctly. */ - layer -> mode =NORMAL; + layer->mode = NORMAL_MODE; bottom = layer; } @@ -3246,13 +3246,13 @@ gimp_image_active_drawable (GimpImage *gimage) return NULL; } -int +GimpImageBaseType gimp_image_base_type (GimpImage *gimage) { return gimage->base_type; } -int +GimpImageType gimp_image_base_type_with_alpha (GimpImage *gimage) { switch (gimage->base_type) @@ -3352,7 +3352,7 @@ gimp_image_projection (GimpImage *gimage) return gimage->projection; } -int +GimpImageType gimp_image_projection_type (GimpImage *gimage) { return gimage->proj_type; @@ -3386,7 +3386,7 @@ gimp_image_composite (GimpImage *gimage) return gimp_image_projection (gimage); } -int +GimpImageType gimp_image_composite_type (GimpImage *gimage) { return gimp_image_projection_type (gimage); diff --git a/app/core/gimpimage.h b/app/core/gimpimage.h index 7cc3e051af..3bcb3c53f2 100644 --- a/app/core/gimpimage.h +++ b/app/core/gimpimage.h @@ -1,9 +1,9 @@ #ifndef __GIMPIMAGE_H__ #define __GIMPIMAGE_H__ +#include "apptypes.h" #include "procedural_db.h" #include "gimpimageF.h" - #include "boundary.h" #include "drawable.h" #include "channel.h" @@ -22,20 +22,6 @@ #define GIMP_IS_IMAGE(obj) GTK_CHECK_TYPE (obj, GIMP_TYPE_IMAGE) - -/* the image types */ -typedef enum -{ - RGB_GIMAGE, /*< nick=RGB_IMAGE >*/ - RGBA_GIMAGE, /*< nick=RGBA_IMAGE >*/ - GRAY_GIMAGE, /*< nick=GRAY_IMAGE >*/ - GRAYA_GIMAGE, /*< nick=GRAYA_IMAGE >*/ - INDEXED_GIMAGE, /*< nick=INDEXED_IMAGE >*/ - INDEXEDA_GIMAGE /*< nick=INDEXEDA_IMAGE >*/ -} GimpImageType; - - - #define TYPE_HAS_ALPHA(t) ((t)==RGBA_GIMAGE || (t)==GRAYA_GIMAGE || (t)==INDEXEDA_GIMAGE) #define GRAY_PIX 0 @@ -47,14 +33,6 @@ typedef enum #define INDEXED_PIX 0 #define ALPHA_I_PIX 1 -typedef enum -{ - RGB, - GRAY, - INDEXED -} GimpImageBaseType; - - #define COLORMAP_SIZE 768 typedef enum { @@ -113,7 +91,8 @@ GtkType gimp_image_get_type(void); /* function declarations */ -GimpImage * gimp_image_new (int, int, int); +GimpImage * gimp_image_new (int, int, + GimpImageBaseType); void gimp_image_set_filename (GimpImage *, char *); void gimp_image_set_resolution (GimpImage *, double, double); @@ -122,8 +101,9 @@ void gimp_image_get_resolution (GimpImage *, double *); void gimp_image_set_unit (GimpImage *, GUnit); GUnit gimp_image_get_unit (GimpImage *); -void gimp_image_set_save_proc (GimpImage *, PlugInProcDef *); -PlugInProcDef * gimp_image_get_save_proc (GimpImage *); +void gimp_image_set_save_proc (GimpImage *, + PlugInProcDef *); +PlugInProcDef * gimp_image_get_save_proc (GimpImage *); void gimp_image_resize (GimpImage *, int, int, int, int); void gimp_image_scale (GimpImage *, int, int); GimpImage * gimp_image_get_named (char *); @@ -132,7 +112,8 @@ TileManager * gimp_image_shadow (GimpImage *, int, int, int); void gimp_image_free_shadow (GimpImage *); void gimp_image_apply_image (GimpImage *, GimpDrawable *, PixelRegion *, int, - int, int, + int, + LayerModeEffects, TileManager *, int, int); void gimp_image_replace_image (GimpImage *, GimpDrawable *, PixelRegion *, int, int, @@ -143,12 +124,15 @@ void gimp_image_get_background (GimpImage *, GimpDrawable *, unsigned char *); unsigned char * gimp_image_get_color_at (GimpImage *, int x, int y); -void gimp_image_get_color (GimpImage *, int, +void gimp_image_get_color (GimpImage *, + GimpImageType, unsigned char *, unsigned char *); -void gimp_image_transform_color (GimpImage *, GimpDrawable *, +void gimp_image_transform_color (GimpImage *, + GimpDrawable *, unsigned char *, - unsigned char *, int); + unsigned char *, + GimpImageBaseType); Guide* gimp_image_add_hguide (GimpImage *); Guide* gimp_image_add_vguide (GimpImage *); void gimp_image_add_guide (GimpImage *, Guide *); @@ -227,8 +211,8 @@ void gimp_image_validate (TileManager *, Tile *); int gimp_image_is_empty (GimpImage *); GimpDrawable * gimp_image_active_drawable (GimpImage *); -int gimp_image_base_type (GimpImage *); -int gimp_image_base_type_with_alpha (GimpImage *); +GimpImageBaseType gimp_image_base_type (GimpImage *); +GimpImageType gimp_image_base_type_with_alpha (GimpImage *); char * gimp_image_filename (GimpImage *); int gimp_image_enable_undo (GimpImage *); int gimp_image_disable_undo (GimpImage *); @@ -242,7 +226,7 @@ unsigned char * gimp_image_cmap (GimpImage *); /* projection access functions */ TileManager * gimp_image_projection (GimpImage *); -int gimp_image_projection_type (GimpImage *); +GimpImageType gimp_image_projection_type (GimpImage *); int gimp_image_projection_bytes (GimpImage *); int gimp_image_projection_opacity (GimpImage *); void gimp_image_projection_realloc (GimpImage *); @@ -251,7 +235,7 @@ void gimp_image_projection_realloc (GimpImage *); /* composite access functions */ TileManager * gimp_image_composite (GimpImage *); -int gimp_image_composite_type (GimpImage *); +GimpImageType gimp_image_composite_type (GimpImage *); int gimp_image_composite_bytes (GimpImage *); TempBuf * gimp_image_composite_preview (GimpImage *, ChannelType, int, int); int gimp_image_preview_valid (GimpImage *, ChannelType); diff --git a/app/core/gimplayer.c b/app/core/gimplayer.c index 5821431325..4a17df8d7f 100644 --- a/app/core/gimplayer.c +++ b/app/core/gimplayer.c @@ -165,7 +165,8 @@ gimp_layer_mask_init (GimpLayerMask *layermask) /* static functions */ static void transform_color (GImage *, PixelRegion *, - PixelRegion *, GimpDrawable *, int); + PixelRegion *, GimpDrawable *, + GimpImageBaseType); static void layer_preview_scale (int, unsigned char *, PixelRegion *, PixelRegion *, int); @@ -195,12 +196,11 @@ layer_invalidate_preview (GtkObject *object) } static void -transform_color (gimage, layerPR, bufPR, drawable, type) - GImage * gimage; - PixelRegion * layerPR; - PixelRegion * bufPR; - GimpDrawable *drawable; - int type; +transform_color (GImage * gimage, + PixelRegion * layerPR, + PixelRegion * bufPR, + GimpDrawable *drawable, + GimpImageBaseType type) { int i, h; unsigned char * s, * d; @@ -234,13 +234,13 @@ transform_color (gimage, layerPR, bufPR, drawable, type) Layer * -layer_new (gimage, width, height, type, name, opacity, mode) - GimpImage* gimage; - int width, height; - int type; - char * name; - int opacity; - int mode; +layer_new (GimpImage* gimage, + int width, + int height, + GimpImageType type, + char * name, + int opacity, + LayerModeEffects mode) { Layer * layer; @@ -251,7 +251,7 @@ layer_new (gimage, width, height, type, name, opacity, mode) layer = gtk_type_new (gimp_layer_get_type ()); - gimp_drawable_configure (GIMP_DRAWABLE(layer), + gimp_drawable_configure (GIMP_DRAWABLE(layer), gimage, width, height, type, name); /* allocate the memory for this layer */ @@ -303,7 +303,7 @@ layer_copy (layer, add_alpha) { char * layer_name; Layer * new_layer; - int new_type; + GimpImageType new_type; char *ext; int number; char *name; @@ -397,17 +397,16 @@ layer_copy (layer, add_alpha) Layer * -layer_from_tiles (gimage_ptr, drawable, tiles, name, opacity, mode) - void *gimage_ptr; - GimpDrawable *drawable; - TileManager *tiles; - char *name; - int opacity; - int mode; +layer_from_tiles (void *gimage_ptr, + GimpDrawable *drawable, + TileManager *tiles, + char *name, + int opacity, + LayerModeEffects mode) { GImage * gimage; Layer * new_layer; - int layer_type; + GimpImageType layer_type; PixelRegion layerPR, bufPR; /* Function copies buffer to a layer @@ -692,7 +691,7 @@ layer_add_alpha (layer) { PixelRegion srcPR, destPR; TileManager *new_tiles; - int type; + GimpImageType type; /* Don't bother if the layer already has alpha */ switch (GIMP_DRAWABLE(layer)->type) @@ -1062,24 +1061,21 @@ layer_get_name (Layer *layer) unsigned char * -layer_data (layer) - Layer * layer; +layer_data (Layer * layer) { return NULL; } LayerMask * -layer_mask (layer) - Layer * layer; +layer_mask (Layer * layer) { return layer->mask; } int -layer_has_alpha (layer) - Layer * layer; +layer_has_alpha (Layer * layer) { if (GIMP_DRAWABLE(layer)->type == RGBA_GIMAGE || GIMP_DRAWABLE(layer)->type == GRAYA_GIMAGE || @@ -1091,8 +1087,7 @@ layer_has_alpha (layer) int -layer_is_floating_sel (layer) - Layer *layer; +layer_is_floating_sel (Layer *layer) { if (layer->fs.drawable != NULL) return 1; @@ -1107,9 +1102,9 @@ layer_linked (Layer *layer) } TempBuf * -layer_preview (layer, w, h) - Layer *layer; - int w, h; +layer_preview (Layer *layer, + int w, + int h) { GImage *gimage; TempBuf *preview_buf; diff --git a/app/core/gimplayer.h b/app/core/gimplayer.h index 9f3a7aeda5..e1250cb629 100644 --- a/app/core/gimplayer.h +++ b/app/core/gimplayer.h @@ -18,18 +18,13 @@ #ifndef __LAYER_H__ #define __LAYER_H__ +#include "apptypes.h" #include "drawable.h" - #include "boundary.h" #include "channel.h" #include "temp_buf.h" #include "tile_manager.h" -typedef enum { - APPLY, - DISCARD -} MaskApplyMode; - #include "layerF.h" /* structure declarations */ @@ -81,12 +76,17 @@ struct _fs_to_layer_undo /* function declarations */ -Layer * layer_new (GimpImage*, int, int, int, char *, int, int); +Layer * layer_new (GimpImage*, int, int, + GimpImageType, + char *, int, + LayerModeEffects); Layer * layer_copy (Layer *, int); Layer * layer_ref (Layer *); void layer_unref (Layer *); -Layer * layer_from_tiles (void *, GimpDrawable *, TileManager *, char *, int, int); +Layer * layer_from_tiles (void *, GimpDrawable *, TileManager *, + char *, int, + LayerModeEffects); LayerMask * layer_add_mask (Layer *, LayerMask *); LayerMask * layer_create_mask (Layer *, AddMaskType); Layer * layer_get_ID (int); diff --git a/app/core/gimpprojection-construct.c b/app/core/gimpprojection-construct.c index 277a4c9748..e2a4c6401f 100644 --- a/app/core/gimpprojection-construct.c +++ b/app/core/gimpprojection-construct.c @@ -250,7 +250,7 @@ gimp_image_allocate_shadow (GimpImage *gimage, GimpImage * gimp_image_new (int width, int height, - int base_type) + GimpImageBaseType base_type) { GimpImage *gimage=GIMP_IMAGE(gtk_type_new(gimp_image_get_type ())); int i; @@ -621,16 +621,16 @@ gimp_image_destroy (GtkObject *object) } void -gimp_image_apply_image (GimpImage *gimage, - GimpDrawable *drawable, - PixelRegion *src2PR, - int undo, - int opacity, - int mode, +gimp_image_apply_image (GimpImage *gimage, + GimpDrawable *drawable, + PixelRegion *src2PR, + int undo, + int opacity, + LayerModeEffects mode, /* alternative to using drawable tiles as src1: */ - TileManager *src1_tiles, - int x, - int y) + TileManager *src1_tiles, + int x, + int y) { Channel *mask; int x1, y1, x2, y2; @@ -893,7 +893,7 @@ gimp_image_get_color_at (GimpImage *gimage, void gimp_image_get_color (GimpImage *gimage, - int d_type, + GimpImageType d_type, unsigned char *rgb, unsigned char *src) { @@ -913,14 +913,14 @@ gimp_image_get_color (GimpImage *gimage, void -gimp_image_transform_color (GimpImage *gimage, - GimpDrawable *drawable, - unsigned char *src, - unsigned char *dest, - int type) +gimp_image_transform_color (GimpImage *gimage, + GimpDrawable *drawable, + unsigned char *src, + unsigned char *dest, + GimpImageBaseType type) { #define INTENSITY(r,g,b) (r * 0.30 + g * 0.59 + b * 0.11 + 0.001) - int d_type; + GimpImageType d_type; d_type = (drawable != NULL) ? drawable_type (drawable) : gimp_image_base_type_with_alpha (gimage); @@ -1214,14 +1214,14 @@ project_channel (GimpImage *gimage, type = (channel->show_masked) ? INITIAL_CHANNEL_MASK : INITIAL_CHANNEL_SELECTION; initial_region (src2, src, NULL, channel->col, channel->opacity, - NORMAL, NULL, type); + NORMAL_MODE, NULL, type); } else { type = (channel->show_masked) ? COMBINE_INTEN_A_CHANNEL_MASK : COMBINE_INTEN_A_CHANNEL_SELECTION; combine_regions (src, src2, src, NULL, channel->col, channel->opacity, - NORMAL, NULL, type); + NORMAL_MODE, NULL, type); } } @@ -2569,7 +2569,7 @@ gimp_image_merge_layers (GimpImage *gimage, Layer *layer; Layer *bottom; unsigned char bg[4] = {0, 0, 0, 0}; - int type; + GimpImageType type; int count; int x1, y1, x2, y2; int x3, y3, x4, y4; @@ -2721,7 +2721,7 @@ gimp_image_merge_layers (GimpImage *gimage, * Keep a pointer to it so that we can set the mode right after it's been * merged so that undo works correctly. */ - layer -> mode =NORMAL; + layer->mode = NORMAL_MODE; bottom = layer; } @@ -3246,13 +3246,13 @@ gimp_image_active_drawable (GimpImage *gimage) return NULL; } -int +GimpImageBaseType gimp_image_base_type (GimpImage *gimage) { return gimage->base_type; } -int +GimpImageType gimp_image_base_type_with_alpha (GimpImage *gimage) { switch (gimage->base_type) @@ -3352,7 +3352,7 @@ gimp_image_projection (GimpImage *gimage) return gimage->projection; } -int +GimpImageType gimp_image_projection_type (GimpImage *gimage) { return gimage->proj_type; @@ -3386,7 +3386,7 @@ gimp_image_composite (GimpImage *gimage) return gimp_image_projection (gimage); } -int +GimpImageType gimp_image_composite_type (GimpImage *gimage) { return gimp_image_projection_type (gimage); diff --git a/app/core/gimpprojection-construct.h b/app/core/gimpprojection-construct.h index 7cc3e051af..3bcb3c53f2 100644 --- a/app/core/gimpprojection-construct.h +++ b/app/core/gimpprojection-construct.h @@ -1,9 +1,9 @@ #ifndef __GIMPIMAGE_H__ #define __GIMPIMAGE_H__ +#include "apptypes.h" #include "procedural_db.h" #include "gimpimageF.h" - #include "boundary.h" #include "drawable.h" #include "channel.h" @@ -22,20 +22,6 @@ #define GIMP_IS_IMAGE(obj) GTK_CHECK_TYPE (obj, GIMP_TYPE_IMAGE) - -/* the image types */ -typedef enum -{ - RGB_GIMAGE, /*< nick=RGB_IMAGE >*/ - RGBA_GIMAGE, /*< nick=RGBA_IMAGE >*/ - GRAY_GIMAGE, /*< nick=GRAY_IMAGE >*/ - GRAYA_GIMAGE, /*< nick=GRAYA_IMAGE >*/ - INDEXED_GIMAGE, /*< nick=INDEXED_IMAGE >*/ - INDEXEDA_GIMAGE /*< nick=INDEXEDA_IMAGE >*/ -} GimpImageType; - - - #define TYPE_HAS_ALPHA(t) ((t)==RGBA_GIMAGE || (t)==GRAYA_GIMAGE || (t)==INDEXEDA_GIMAGE) #define GRAY_PIX 0 @@ -47,14 +33,6 @@ typedef enum #define INDEXED_PIX 0 #define ALPHA_I_PIX 1 -typedef enum -{ - RGB, - GRAY, - INDEXED -} GimpImageBaseType; - - #define COLORMAP_SIZE 768 typedef enum { @@ -113,7 +91,8 @@ GtkType gimp_image_get_type(void); /* function declarations */ -GimpImage * gimp_image_new (int, int, int); +GimpImage * gimp_image_new (int, int, + GimpImageBaseType); void gimp_image_set_filename (GimpImage *, char *); void gimp_image_set_resolution (GimpImage *, double, double); @@ -122,8 +101,9 @@ void gimp_image_get_resolution (GimpImage *, double *); void gimp_image_set_unit (GimpImage *, GUnit); GUnit gimp_image_get_unit (GimpImage *); -void gimp_image_set_save_proc (GimpImage *, PlugInProcDef *); -PlugInProcDef * gimp_image_get_save_proc (GimpImage *); +void gimp_image_set_save_proc (GimpImage *, + PlugInProcDef *); +PlugInProcDef * gimp_image_get_save_proc (GimpImage *); void gimp_image_resize (GimpImage *, int, int, int, int); void gimp_image_scale (GimpImage *, int, int); GimpImage * gimp_image_get_named (char *); @@ -132,7 +112,8 @@ TileManager * gimp_image_shadow (GimpImage *, int, int, int); void gimp_image_free_shadow (GimpImage *); void gimp_image_apply_image (GimpImage *, GimpDrawable *, PixelRegion *, int, - int, int, + int, + LayerModeEffects, TileManager *, int, int); void gimp_image_replace_image (GimpImage *, GimpDrawable *, PixelRegion *, int, int, @@ -143,12 +124,15 @@ void gimp_image_get_background (GimpImage *, GimpDrawable *, unsigned char *); unsigned char * gimp_image_get_color_at (GimpImage *, int x, int y); -void gimp_image_get_color (GimpImage *, int, +void gimp_image_get_color (GimpImage *, + GimpImageType, unsigned char *, unsigned char *); -void gimp_image_transform_color (GimpImage *, GimpDrawable *, +void gimp_image_transform_color (GimpImage *, + GimpDrawable *, unsigned char *, - unsigned char *, int); + unsigned char *, + GimpImageBaseType); Guide* gimp_image_add_hguide (GimpImage *); Guide* gimp_image_add_vguide (GimpImage *); void gimp_image_add_guide (GimpImage *, Guide *); @@ -227,8 +211,8 @@ void gimp_image_validate (TileManager *, Tile *); int gimp_image_is_empty (GimpImage *); GimpDrawable * gimp_image_active_drawable (GimpImage *); -int gimp_image_base_type (GimpImage *); -int gimp_image_base_type_with_alpha (GimpImage *); +GimpImageBaseType gimp_image_base_type (GimpImage *); +GimpImageType gimp_image_base_type_with_alpha (GimpImage *); char * gimp_image_filename (GimpImage *); int gimp_image_enable_undo (GimpImage *); int gimp_image_disable_undo (GimpImage *); @@ -242,7 +226,7 @@ unsigned char * gimp_image_cmap (GimpImage *); /* projection access functions */ TileManager * gimp_image_projection (GimpImage *); -int gimp_image_projection_type (GimpImage *); +GimpImageType gimp_image_projection_type (GimpImage *); int gimp_image_projection_bytes (GimpImage *); int gimp_image_projection_opacity (GimpImage *); void gimp_image_projection_realloc (GimpImage *); @@ -251,7 +235,7 @@ void gimp_image_projection_realloc (GimpImage *); /* composite access functions */ TileManager * gimp_image_composite (GimpImage *); -int gimp_image_composite_type (GimpImage *); +GimpImageType gimp_image_composite_type (GimpImage *); int gimp_image_composite_bytes (GimpImage *); TempBuf * gimp_image_composite_preview (GimpImage *, ChannelType, int, int); int gimp_image_preview_valid (GimpImage *, ChannelType); diff --git a/app/core/gimpprojection.c b/app/core/gimpprojection.c index 4cf27edf64..874e01fc0e 100644 --- a/app/core/gimpprojection.c +++ b/app/core/gimpprojection.c @@ -1566,8 +1566,8 @@ gdisplay_set_menu_sensitivity (GDisplay *gdisp) gint lp = FALSE; gint alpha = FALSE; GimpDrawable *drawable = NULL; - gint base_type = 0; - gint type = -1; + GimpImageBaseType base_type = 0; + GimpImageType type = -1; gint lind = -1; gint lnum = -1; diff --git a/app/devices.c b/app/devices.c index 3817cd8ab7..712dd24144 100644 --- a/app/devices.c +++ b/app/devices.c @@ -1205,7 +1205,7 @@ device_update_brush (GimpBrushP brush, { offset_x = CELL_SIZE - brush_scale_indicator_width - 1; gtk_preview_draw_row (GTK_PREVIEW (deviceD->brushes[preview_id]), - brush_scale_indicator_bits[i], + brush_scale_indicator_bits[i][0], offset_x, offset_y + i, brush_scale_indicator_width); } diff --git a/app/dialogs/image-new-dialog.c b/app/dialogs/image-new-dialog.c index 128311550c..0fcd71275e 100644 --- a/app/dialogs/image-new-dialog.c +++ b/app/dialogs/image-new-dialog.c @@ -57,8 +57,8 @@ typedef struct gdouble size; /* in bytes */ - gint type; - gint fill_type; + GimpImageBaseType type; + GimpFillType fill_type; } NewImageValues; /* new image local functions */ @@ -83,8 +83,8 @@ static gdouble last_xresolution = 72.0; static gdouble last_yresolution = 72.0; static GUnit last_res_unit = UNIT_INCH; -static gint last_type = RGB; -static gint last_fill_type = BACKGROUND_FILL; +static GimpImageBaseType last_type = RGB; +static GimpFillType last_fill_type = BACKGROUND_FILL; static gboolean last_new_image = FALSE; static gboolean new_dialog_run = FALSE; @@ -98,7 +98,7 @@ file_new_create_image (NewImageValues *vals) GImage *gimage; GDisplay *gdisplay; Layer *layer; - gint type; + GimpImageType type; last_width = vals->width; last_height = vals->height; @@ -132,7 +132,7 @@ file_new_create_image (NewImageValues *vals) /* Make the background (or first) layer */ layer = layer_new (gimage, gimage->width, gimage->height, - type, _("Background"), OPAQUE_OPACITY, NORMAL); + type, _("Background"), OPAQUE_OPACITY, NORMAL_MODE); if (layer) { diff --git a/app/display/gimpdisplay.c b/app/display/gimpdisplay.c index 4cf27edf64..874e01fc0e 100644 --- a/app/display/gimpdisplay.c +++ b/app/display/gimpdisplay.c @@ -1566,8 +1566,8 @@ gdisplay_set_menu_sensitivity (GDisplay *gdisp) gint lp = FALSE; gint alpha = FALSE; GimpDrawable *drawable = NULL; - gint base_type = 0; - gint type = -1; + GimpImageBaseType base_type = 0; + GimpImageType type = -1; gint lind = -1; gint lnum = -1; diff --git a/app/display/gimpnavigationeditor.c b/app/display/gimpnavigationeditor.c index 67d3df2e02..5d6d1d6cc3 100644 --- a/app/display/gimpnavigationeditor.c +++ b/app/display/gimpnavigationeditor.c @@ -549,6 +549,7 @@ nav_window_preview_events (GtkWidget *widget, } break; default: + break; } break; @@ -564,6 +565,7 @@ nav_window_preview_events (GtkWidget *widget, gtk_grab_remove(widget); break; default: + break; } break; diff --git a/app/display/gimpnavigationview.c b/app/display/gimpnavigationview.c index 67d3df2e02..5d6d1d6cc3 100644 --- a/app/display/gimpnavigationview.c +++ b/app/display/gimpnavigationview.c @@ -549,6 +549,7 @@ nav_window_preview_events (GtkWidget *widget, } break; default: + break; } break; @@ -564,6 +565,7 @@ nav_window_preview_events (GtkWidget *widget, gtk_grab_remove(widget); break; default: + break; } break; diff --git a/app/drawable.c b/app/drawable.c index 9621b49891..7a474d71c0 100644 --- a/app/drawable.c +++ b/app/drawable.c @@ -37,39 +37,43 @@ drawable_ID (GimpDrawable *drawable) } void -drawable_fill (GimpDrawable *drawable, int fill_type){ - guchar r,g,b,a; - a=255; - switch(fill_type){ - case FOREGROUND_FILL: - palette_get_foreground(&r, &g, &b); - break; - - case BACKGROUND_FILL: - palette_get_background(&r, &g, &b); - break; - - case WHITE_FILL: - r=g=b=255; - break; - - case TRANSPARENT_FILL: - a=r=g=b=0; - break; - - case NO_FILL: - return; - - default: - g_warning (_("drawable_fill called with unknown fill type")); - a=r=g=b=0; - break; - } - gimp_drawable_fill(drawable,r,g,b,a); - - drawable_update (drawable, 0, 0, - gimp_drawable_width (drawable), - gimp_drawable_height (drawable)); +drawable_fill (GimpDrawable *drawable, + GimpFillType fill_type) +{ + guchar r,g,b,a; + + a=255; + switch (fill_type) + { + case FOREGROUND_FILL: + palette_get_foreground(&r, &g, &b); + break; + + case BACKGROUND_FILL: + palette_get_background(&r, &g, &b); + break; + + case WHITE_FILL: + r=g=b=255; + break; + + case TRANSPARENT_FILL: + a=r=g=b=0; + break; + + case NO_FILL: + return; + + default: + g_warning (_("drawable_fill called with unknown fill type")); + a=r=g=b=0; + break; + } + gimp_drawable_fill(drawable,r,g,b,a); + + drawable_update (drawable, 0, 0, + gimp_drawable_width (drawable), + gimp_drawable_height (drawable)); } void diff --git a/app/drawable.h b/app/drawable.h index a85a1748b5..9d8634e5a8 100644 --- a/app/drawable.h +++ b/app/drawable.h @@ -20,8 +20,8 @@ #include "gimpdrawable.h" -int drawable_ID (GimpDrawable *); -void drawable_fill (GimpDrawable *drawable, int fill_type); +int drawable_ID (GimpDrawable *); +void drawable_fill (GimpDrawable *drawable, GimpFillType fill_type); void drawable_update (GimpDrawable *drawable, int x, int y, int w, int h); void drawable_apply_image (GimpDrawable *, int, int, int, int, TileManager *, int); diff --git a/app/drawable_cmds.c b/app/drawable_cmds.c index 7616715a72..8e99a949d3 100644 --- a/app/drawable_cmds.c +++ b/app/drawable_cmds.c @@ -139,7 +139,7 @@ drawable_fill_invoker (Argument *args) success = FALSE; if (success) - drawable_fill (drawable, fill_type); + drawable_fill (drawable, (GimpFillType) fill_type); return procedural_db_return_args (&drawable_fill_proc, success); } diff --git a/app/file_new_dialog.c b/app/file_new_dialog.c index 128311550c..0fcd71275e 100644 --- a/app/file_new_dialog.c +++ b/app/file_new_dialog.c @@ -57,8 +57,8 @@ typedef struct gdouble size; /* in bytes */ - gint type; - gint fill_type; + GimpImageBaseType type; + GimpFillType fill_type; } NewImageValues; /* new image local functions */ @@ -83,8 +83,8 @@ static gdouble last_xresolution = 72.0; static gdouble last_yresolution = 72.0; static GUnit last_res_unit = UNIT_INCH; -static gint last_type = RGB; -static gint last_fill_type = BACKGROUND_FILL; +static GimpImageBaseType last_type = RGB; +static GimpFillType last_fill_type = BACKGROUND_FILL; static gboolean last_new_image = FALSE; static gboolean new_dialog_run = FALSE; @@ -98,7 +98,7 @@ file_new_create_image (NewImageValues *vals) GImage *gimage; GDisplay *gdisplay; Layer *layer; - gint type; + GimpImageType type; last_width = vals->width; last_height = vals->height; @@ -132,7 +132,7 @@ file_new_create_image (NewImageValues *vals) /* Make the background (or first) layer */ layer = layer_new (gimage, gimage->width, gimage->height, - type, _("Background"), OPAQUE_OPACITY, NORMAL); + type, _("Background"), OPAQUE_OPACITY, NORMAL_MODE); if (layer) { diff --git a/app/gdisplay.c b/app/gdisplay.c index 4cf27edf64..874e01fc0e 100644 --- a/app/gdisplay.c +++ b/app/gdisplay.c @@ -1566,8 +1566,8 @@ gdisplay_set_menu_sensitivity (GDisplay *gdisp) gint lp = FALSE; gint alpha = FALSE; GimpDrawable *drawable = NULL; - gint base_type = 0; - gint type = -1; + GimpImageBaseType base_type = 0; + GimpImageType type = -1; gint lind = -1; gint lnum = -1; diff --git a/app/gimage_mask.c b/app/gimage_mask.c index cccbacda37..83a7f497fb 100644 --- a/app/gimage_mask.c +++ b/app/gimage_mask.c @@ -352,7 +352,7 @@ gimage_mask_float (GImage *gimage, /* Create a new layer from the buffer */ layer = layer_from_tiles (gimage, drawable, tiles, _("Floated Layer"), - OPAQUE_OPACITY, NORMAL); + OPAQUE_OPACITY, NORMAL_MODE); /* Set the offsets */ GIMP_DRAWABLE(layer)->offset_x = tiles->x + off_x; diff --git a/app/gimpbrushhose.c b/app/gimpbrushhose.c index b324c0c873..918a506597 100644 --- a/app/gimpbrushhose.c +++ b/app/gimpbrushhose.c @@ -86,7 +86,7 @@ gimp_brush_hose_load (char *file_name) hose = GIMP_BRUSH_HOSE(gimp_type_new(gimp_brush_hose_get_type())); GIMP_BRUSH_HOSE(hose)->filename = g_strdup(file_name); - brush = GIMP_BRUSH (hose); + brush = GIMP_BRUSH_PIXMAP (hose); list = gimp_brush_list_new(); diff --git a/app/gimpbrushpixmap.c b/app/gimpbrushpixmap.c index a24a5577f5..d38ecb5038 100644 --- a/app/gimpbrushpixmap.c +++ b/app/gimpbrushpixmap.c @@ -216,6 +216,5 @@ gimp_brush_pixmap_load (char *file_name) /* Clean up */ fclose (fp); - return GIMP_BRUSH(brush); - + return brush; } diff --git a/app/gimpchannel.h b/app/gimpchannel.h index 1e00178211..c9024dcfef 100644 --- a/app/gimpchannel.h +++ b/app/gimpchannel.h @@ -18,8 +18,8 @@ #ifndef __CHANNEL_H__ #define __CHANNEL_H__ +#include "apptypes.h" #include "drawable.h" - #include "boundary.h" #include "temp_buf.h" #include "tile_manager.h" @@ -47,11 +47,6 @@ typedef enum #define GIMP_IS_CHANNEL_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_CHANNEL)) -typedef struct _GimpChannel GimpChannel; -typedef struct _GimpChannelClass GimpChannelClass; - -typedef GimpChannel Channel; /* convenience */ - GtkType gimp_channel_get_type (void); /* Special undo type */ diff --git a/app/gimpcontext.c b/app/gimpcontext.c index e1ddc7873e..afd677b3bd 100644 --- a/app/gimpcontext.c +++ b/app/gimpcontext.c @@ -428,7 +428,7 @@ gimp_context_define_opacity (GimpContext *context, /* paint mode */ -gint +LayerModeEffects gimp_context_get_paint_mode (GimpContext *context) { context_check_current (context); @@ -439,8 +439,8 @@ gimp_context_get_paint_mode (GimpContext *context) } void -gimp_context_set_paint_mode (GimpContext *context, - gint paint_mode) +gimp_context_set_paint_mode (GimpContext *context, + LayerModeEffects paint_mode) { context_check_current (context); context_return_if_fail (context); diff --git a/app/gimpcontext.h b/app/gimpcontext.h index 08714b7798..485ad9e80a 100644 --- a/app/gimpcontext.h +++ b/app/gimpcontext.h @@ -51,26 +51,26 @@ typedef struct _GimpContextClass GimpContextClass; struct _GimpContext { - GimpObject object; + GimpObject object; - gchar *name; - GimpContext *parent; + gchar *name; + GimpContext *parent; /* FIXME: the solution of having a boolean for each attribute and the * name "defined" need some brainstorming */ - gboolean opacity_defined; - gdouble opacity; + gboolean opacity_defined; + gdouble opacity; - gboolean paint_mode_defined; - gint paint_mode; + gboolean paint_mode_defined; + LayerModeEffects paint_mode; - gboolean image_defined; - GimpImage *image; + gboolean image_defined; + GimpImage *image; - gboolean display_defined; - GDisplay *display; + gboolean display_defined; + GDisplay *display; }; struct _GimpContextClass @@ -136,9 +136,10 @@ gboolean gimp_context_opacity_defined (GimpContext *context); void gimp_context_define_opacity (GimpContext *context, gboolean defined); -gint gimp_context_get_paint_mode (GimpContext *context); +LayerModeEffects + gimp_context_get_paint_mode (GimpContext *context); void gimp_context_set_paint_mode (GimpContext *context, - gint paint_mode); + LayerModeEffects paint_mode); gboolean gimp_context_paint_mode_defined (GimpContext *context); void gimp_context_define_paint_mode (GimpContext *context, gboolean defined); diff --git a/app/gimpdrawable.c b/app/gimpdrawable.c index 38c8ac83e6..9169a81c21 100644 --- a/app/gimpdrawable.c +++ b/app/gimpdrawable.c @@ -274,7 +274,7 @@ gimp_drawable_set_gimage (GimpDrawable *drawable, GimpImage *gimage) } -int +GimpImageType gimp_drawable_type (GimpDrawable *drawable) { if (drawable) @@ -498,7 +498,7 @@ gimp_drawable_get_tattoo(const GimpDrawable *drawable) int gimp_drawable_type_with_alpha (GimpDrawable *drawable) { - int type = gimp_drawable_type (drawable); + GimpImageType type = gimp_drawable_type (drawable); int has_alpha = gimp_drawable_has_alpha (drawable); if (has_alpha) @@ -692,7 +692,7 @@ gimp_drawable_destroy (GtkObject *object) void gimp_drawable_configure (GimpDrawable *drawable, GimpImage* gimage, int width, int height, - int type, char *name) + GimpImageType type, char *name) { int bpp; int alpha; @@ -743,4 +743,3 @@ gimp_drawable_configure (GimpDrawable *drawable, drawable->preview_cache = NULL; drawable->preview_valid = FALSE; } - diff --git a/app/gimpdrawable.h b/app/gimpdrawable.h index d8f9132d37..ba7b4dad53 100644 --- a/app/gimpdrawable.h +++ b/app/gimpdrawable.h @@ -18,6 +18,7 @@ #ifndef __GIMPDRAWABLE_H__ #define __GIMPDRAWABLE_H__ +#include "apptypes.h" #include "gimpobject.h" #include "gimpdrawableF.h" #include "tile_manager.h" @@ -31,16 +32,6 @@ GtkType gimp_drawable_get_type (void); -typedef enum -{ - FOREGROUND_FILL, /*< nick=FG_IMAGE_FILL >*/ - BACKGROUND_FILL, /*< nick=BG_IMAGE_FILL >*/ - WHITE_FILL, /*< nick=WHITE_IMAGE_FILL >*/ - TRANSPARENT_FILL, /*< nick=TRANS_IMAGE_FILL >*/ - NO_FILL /*< nick=NO_IMAGE_FILL >*/ -} GimpFillType; - - /* drawable access functions */ void gimp_drawable_merge_shadow (GimpDrawable *, int); void gimp_drawable_fill (GimpDrawable *drawable, @@ -54,7 +45,7 @@ int gimp_drawable_mask_bounds (GimpDrawable *, void gimp_drawable_invalidate_preview (GimpDrawable *); int gimp_drawable_dirty (GimpDrawable *); int gimp_drawable_clean (GimpDrawable *); -int gimp_drawable_type (GimpDrawable *); +GimpImageType gimp_drawable_type (GimpDrawable *); int gimp_drawable_has_alpha (GimpDrawable *); int gimp_drawable_type_with_alpha (GimpDrawable *); int gimp_drawable_color (GimpDrawable *); diff --git a/app/gimpdrawableP.h b/app/gimpdrawableP.h index 987983669a..15b97d3f93 100644 --- a/app/gimpdrawableP.h +++ b/app/gimpdrawableP.h @@ -38,7 +38,7 @@ struct _GimpDrawable int ID; /* provides a unique ID */ guint32 tattoo; /* provides a perminant ID */ GimpImage* gimage; /* gimage owner */ - int type; /* type of drawable */ + GimpImageType type; /* type of drawable */ int has_alpha; /* drawable has alpha */ ParasiteList *parasites; /* Plug-in parasite data */ @@ -62,6 +62,6 @@ typedef struct _GimpDrawableClass GimpDrawableClass; #define GIMP_IS_DRAWABLE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_DRAWABLE)) void gimp_drawable_configure (GimpDrawable *, GimpImage*, - gint, gint, gint, gchar*); + gint, gint, GimpImageType, gchar*); #endif /* __GIMPDRAWABLEP_H__ */ diff --git a/app/gimpimage-convert.c b/app/gimpimage-convert.c index b621f47eea..4a93f5b6ee 100644 --- a/app/gimpimage-convert.c +++ b/app/gimpimage-convert.c @@ -736,18 +736,21 @@ indexed_dither_update (GtkWidget *w, } void -convert_image (GImage *gimage, - int new_type, - int num_cols, /* used only for new_type == INDEXED */ - int dither, /* used only for new_type == INDEXED */ - int palette_type) /* used only for new_type == INDEXED */ +convert_image (GImage *gimage, + GimpImageBaseType new_type, + /* The following three params used only for + * new_type == INDEXED + */ + int num_cols, + int dither, + ConvertPaletteType palette_type) { QuantizeObj *quantobj; Layer *layer; Layer *floating_layer; - int old_type; + GimpImageBaseType old_type; GSList *list; - int new_layer_type; + GimpImageType new_layer_type; int new_layer_bytes; int has_alpha; TileManager *new_tiles; diff --git a/app/gimpimage-convert.h b/app/gimpimage-convert.h index dee8e8abdc..2372e83101 100644 --- a/app/gimpimage-convert.h +++ b/app/gimpimage-convert.h @@ -18,6 +18,7 @@ #ifndef __CONVERT_H__ #define __CONVERT_H__ +#include "apptypes.h" #include "procedural_db.h" #include "gimpimageF.h" #include "palette_entries.h" @@ -38,7 +39,10 @@ void convert_to_rgb (GimpImage *); void convert_to_grayscale (GimpImage *); void convert_to_indexed (GimpImage *); -void convert_image (GimpImage *, int, int, int, int); +void convert_image (GimpImage *, + GimpImageBaseType, + int, int, + ConvertPaletteType); extern PaletteEntriesP theCustomPalette; diff --git a/app/gimpimage.c b/app/gimpimage.c index 277a4c9748..e2a4c6401f 100644 --- a/app/gimpimage.c +++ b/app/gimpimage.c @@ -250,7 +250,7 @@ gimp_image_allocate_shadow (GimpImage *gimage, GimpImage * gimp_image_new (int width, int height, - int base_type) + GimpImageBaseType base_type) { GimpImage *gimage=GIMP_IMAGE(gtk_type_new(gimp_image_get_type ())); int i; @@ -621,16 +621,16 @@ gimp_image_destroy (GtkObject *object) } void -gimp_image_apply_image (GimpImage *gimage, - GimpDrawable *drawable, - PixelRegion *src2PR, - int undo, - int opacity, - int mode, +gimp_image_apply_image (GimpImage *gimage, + GimpDrawable *drawable, + PixelRegion *src2PR, + int undo, + int opacity, + LayerModeEffects mode, /* alternative to using drawable tiles as src1: */ - TileManager *src1_tiles, - int x, - int y) + TileManager *src1_tiles, + int x, + int y) { Channel *mask; int x1, y1, x2, y2; @@ -893,7 +893,7 @@ gimp_image_get_color_at (GimpImage *gimage, void gimp_image_get_color (GimpImage *gimage, - int d_type, + GimpImageType d_type, unsigned char *rgb, unsigned char *src) { @@ -913,14 +913,14 @@ gimp_image_get_color (GimpImage *gimage, void -gimp_image_transform_color (GimpImage *gimage, - GimpDrawable *drawable, - unsigned char *src, - unsigned char *dest, - int type) +gimp_image_transform_color (GimpImage *gimage, + GimpDrawable *drawable, + unsigned char *src, + unsigned char *dest, + GimpImageBaseType type) { #define INTENSITY(r,g,b) (r * 0.30 + g * 0.59 + b * 0.11 + 0.001) - int d_type; + GimpImageType d_type; d_type = (drawable != NULL) ? drawable_type (drawable) : gimp_image_base_type_with_alpha (gimage); @@ -1214,14 +1214,14 @@ project_channel (GimpImage *gimage, type = (channel->show_masked) ? INITIAL_CHANNEL_MASK : INITIAL_CHANNEL_SELECTION; initial_region (src2, src, NULL, channel->col, channel->opacity, - NORMAL, NULL, type); + NORMAL_MODE, NULL, type); } else { type = (channel->show_masked) ? COMBINE_INTEN_A_CHANNEL_MASK : COMBINE_INTEN_A_CHANNEL_SELECTION; combine_regions (src, src2, src, NULL, channel->col, channel->opacity, - NORMAL, NULL, type); + NORMAL_MODE, NULL, type); } } @@ -2569,7 +2569,7 @@ gimp_image_merge_layers (GimpImage *gimage, Layer *layer; Layer *bottom; unsigned char bg[4] = {0, 0, 0, 0}; - int type; + GimpImageType type; int count; int x1, y1, x2, y2; int x3, y3, x4, y4; @@ -2721,7 +2721,7 @@ gimp_image_merge_layers (GimpImage *gimage, * Keep a pointer to it so that we can set the mode right after it's been * merged so that undo works correctly. */ - layer -> mode =NORMAL; + layer->mode = NORMAL_MODE; bottom = layer; } @@ -3246,13 +3246,13 @@ gimp_image_active_drawable (GimpImage *gimage) return NULL; } -int +GimpImageBaseType gimp_image_base_type (GimpImage *gimage) { return gimage->base_type; } -int +GimpImageType gimp_image_base_type_with_alpha (GimpImage *gimage) { switch (gimage->base_type) @@ -3352,7 +3352,7 @@ gimp_image_projection (GimpImage *gimage) return gimage->projection; } -int +GimpImageType gimp_image_projection_type (GimpImage *gimage) { return gimage->proj_type; @@ -3386,7 +3386,7 @@ gimp_image_composite (GimpImage *gimage) return gimp_image_projection (gimage); } -int +GimpImageType gimp_image_composite_type (GimpImage *gimage) { return gimp_image_projection_type (gimage); diff --git a/app/gimpimage.h b/app/gimpimage.h index 7cc3e051af..3bcb3c53f2 100644 --- a/app/gimpimage.h +++ b/app/gimpimage.h @@ -1,9 +1,9 @@ #ifndef __GIMPIMAGE_H__ #define __GIMPIMAGE_H__ +#include "apptypes.h" #include "procedural_db.h" #include "gimpimageF.h" - #include "boundary.h" #include "drawable.h" #include "channel.h" @@ -22,20 +22,6 @@ #define GIMP_IS_IMAGE(obj) GTK_CHECK_TYPE (obj, GIMP_TYPE_IMAGE) - -/* the image types */ -typedef enum -{ - RGB_GIMAGE, /*< nick=RGB_IMAGE >*/ - RGBA_GIMAGE, /*< nick=RGBA_IMAGE >*/ - GRAY_GIMAGE, /*< nick=GRAY_IMAGE >*/ - GRAYA_GIMAGE, /*< nick=GRAYA_IMAGE >*/ - INDEXED_GIMAGE, /*< nick=INDEXED_IMAGE >*/ - INDEXEDA_GIMAGE /*< nick=INDEXEDA_IMAGE >*/ -} GimpImageType; - - - #define TYPE_HAS_ALPHA(t) ((t)==RGBA_GIMAGE || (t)==GRAYA_GIMAGE || (t)==INDEXEDA_GIMAGE) #define GRAY_PIX 0 @@ -47,14 +33,6 @@ typedef enum #define INDEXED_PIX 0 #define ALPHA_I_PIX 1 -typedef enum -{ - RGB, - GRAY, - INDEXED -} GimpImageBaseType; - - #define COLORMAP_SIZE 768 typedef enum { @@ -113,7 +91,8 @@ GtkType gimp_image_get_type(void); /* function declarations */ -GimpImage * gimp_image_new (int, int, int); +GimpImage * gimp_image_new (int, int, + GimpImageBaseType); void gimp_image_set_filename (GimpImage *, char *); void gimp_image_set_resolution (GimpImage *, double, double); @@ -122,8 +101,9 @@ void gimp_image_get_resolution (GimpImage *, double *); void gimp_image_set_unit (GimpImage *, GUnit); GUnit gimp_image_get_unit (GimpImage *); -void gimp_image_set_save_proc (GimpImage *, PlugInProcDef *); -PlugInProcDef * gimp_image_get_save_proc (GimpImage *); +void gimp_image_set_save_proc (GimpImage *, + PlugInProcDef *); +PlugInProcDef * gimp_image_get_save_proc (GimpImage *); void gimp_image_resize (GimpImage *, int, int, int, int); void gimp_image_scale (GimpImage *, int, int); GimpImage * gimp_image_get_named (char *); @@ -132,7 +112,8 @@ TileManager * gimp_image_shadow (GimpImage *, int, int, int); void gimp_image_free_shadow (GimpImage *); void gimp_image_apply_image (GimpImage *, GimpDrawable *, PixelRegion *, int, - int, int, + int, + LayerModeEffects, TileManager *, int, int); void gimp_image_replace_image (GimpImage *, GimpDrawable *, PixelRegion *, int, int, @@ -143,12 +124,15 @@ void gimp_image_get_background (GimpImage *, GimpDrawable *, unsigned char *); unsigned char * gimp_image_get_color_at (GimpImage *, int x, int y); -void gimp_image_get_color (GimpImage *, int, +void gimp_image_get_color (GimpImage *, + GimpImageType, unsigned char *, unsigned char *); -void gimp_image_transform_color (GimpImage *, GimpDrawable *, +void gimp_image_transform_color (GimpImage *, + GimpDrawable *, unsigned char *, - unsigned char *, int); + unsigned char *, + GimpImageBaseType); Guide* gimp_image_add_hguide (GimpImage *); Guide* gimp_image_add_vguide (GimpImage *); void gimp_image_add_guide (GimpImage *, Guide *); @@ -227,8 +211,8 @@ void gimp_image_validate (TileManager *, Tile *); int gimp_image_is_empty (GimpImage *); GimpDrawable * gimp_image_active_drawable (GimpImage *); -int gimp_image_base_type (GimpImage *); -int gimp_image_base_type_with_alpha (GimpImage *); +GimpImageBaseType gimp_image_base_type (GimpImage *); +GimpImageType gimp_image_base_type_with_alpha (GimpImage *); char * gimp_image_filename (GimpImage *); int gimp_image_enable_undo (GimpImage *); int gimp_image_disable_undo (GimpImage *); @@ -242,7 +226,7 @@ unsigned char * gimp_image_cmap (GimpImage *); /* projection access functions */ TileManager * gimp_image_projection (GimpImage *); -int gimp_image_projection_type (GimpImage *); +GimpImageType gimp_image_projection_type (GimpImage *); int gimp_image_projection_bytes (GimpImage *); int gimp_image_projection_opacity (GimpImage *); void gimp_image_projection_realloc (GimpImage *); @@ -251,7 +235,7 @@ void gimp_image_projection_realloc (GimpImage *); /* composite access functions */ TileManager * gimp_image_composite (GimpImage *); -int gimp_image_composite_type (GimpImage *); +GimpImageType gimp_image_composite_type (GimpImage *); int gimp_image_composite_bytes (GimpImage *); TempBuf * gimp_image_composite_preview (GimpImage *, ChannelType, int, int); int gimp_image_preview_valid (GimpImage *, ChannelType); diff --git a/app/gimpimageP.h b/app/gimpimageP.h index 25b72ddc52..839005e960 100644 --- a/app/gimpimageP.h +++ b/app/gimpimageP.h @@ -25,7 +25,7 @@ struct _GimpImage double xresolution; /* image x-res, in dpi */ double yresolution; /* image y-res, in dpi */ GUnit unit; /* image unit */ - int base_type; /* base gimp_image type */ + GimpImageBaseType base_type; /* base gimp_image type */ unsigned char * cmap; /* colormap--for indexed */ int num_cols; /* number of cols--for indexed */ @@ -42,7 +42,7 @@ struct _GimpImage /* Projection attributes */ int construct_flag; /* flag for construction */ - int proj_type; /* type of the projection image */ + GimpImageType proj_type; /* type of the projection image */ int proj_bytes; /* bpp in projection image */ int proj_level; /* projection level */ TileManager *projection; /* The projection--layers & */ diff --git a/app/gimplayer.c b/app/gimplayer.c index 5821431325..4a17df8d7f 100644 --- a/app/gimplayer.c +++ b/app/gimplayer.c @@ -165,7 +165,8 @@ gimp_layer_mask_init (GimpLayerMask *layermask) /* static functions */ static void transform_color (GImage *, PixelRegion *, - PixelRegion *, GimpDrawable *, int); + PixelRegion *, GimpDrawable *, + GimpImageBaseType); static void layer_preview_scale (int, unsigned char *, PixelRegion *, PixelRegion *, int); @@ -195,12 +196,11 @@ layer_invalidate_preview (GtkObject *object) } static void -transform_color (gimage, layerPR, bufPR, drawable, type) - GImage * gimage; - PixelRegion * layerPR; - PixelRegion * bufPR; - GimpDrawable *drawable; - int type; +transform_color (GImage * gimage, + PixelRegion * layerPR, + PixelRegion * bufPR, + GimpDrawable *drawable, + GimpImageBaseType type) { int i, h; unsigned char * s, * d; @@ -234,13 +234,13 @@ transform_color (gimage, layerPR, bufPR, drawable, type) Layer * -layer_new (gimage, width, height, type, name, opacity, mode) - GimpImage* gimage; - int width, height; - int type; - char * name; - int opacity; - int mode; +layer_new (GimpImage* gimage, + int width, + int height, + GimpImageType type, + char * name, + int opacity, + LayerModeEffects mode) { Layer * layer; @@ -251,7 +251,7 @@ layer_new (gimage, width, height, type, name, opacity, mode) layer = gtk_type_new (gimp_layer_get_type ()); - gimp_drawable_configure (GIMP_DRAWABLE(layer), + gimp_drawable_configure (GIMP_DRAWABLE(layer), gimage, width, height, type, name); /* allocate the memory for this layer */ @@ -303,7 +303,7 @@ layer_copy (layer, add_alpha) { char * layer_name; Layer * new_layer; - int new_type; + GimpImageType new_type; char *ext; int number; char *name; @@ -397,17 +397,16 @@ layer_copy (layer, add_alpha) Layer * -layer_from_tiles (gimage_ptr, drawable, tiles, name, opacity, mode) - void *gimage_ptr; - GimpDrawable *drawable; - TileManager *tiles; - char *name; - int opacity; - int mode; +layer_from_tiles (void *gimage_ptr, + GimpDrawable *drawable, + TileManager *tiles, + char *name, + int opacity, + LayerModeEffects mode) { GImage * gimage; Layer * new_layer; - int layer_type; + GimpImageType layer_type; PixelRegion layerPR, bufPR; /* Function copies buffer to a layer @@ -692,7 +691,7 @@ layer_add_alpha (layer) { PixelRegion srcPR, destPR; TileManager *new_tiles; - int type; + GimpImageType type; /* Don't bother if the layer already has alpha */ switch (GIMP_DRAWABLE(layer)->type) @@ -1062,24 +1061,21 @@ layer_get_name (Layer *layer) unsigned char * -layer_data (layer) - Layer * layer; +layer_data (Layer * layer) { return NULL; } LayerMask * -layer_mask (layer) - Layer * layer; +layer_mask (Layer * layer) { return layer->mask; } int -layer_has_alpha (layer) - Layer * layer; +layer_has_alpha (Layer * layer) { if (GIMP_DRAWABLE(layer)->type == RGBA_GIMAGE || GIMP_DRAWABLE(layer)->type == GRAYA_GIMAGE || @@ -1091,8 +1087,7 @@ layer_has_alpha (layer) int -layer_is_floating_sel (layer) - Layer *layer; +layer_is_floating_sel (Layer *layer) { if (layer->fs.drawable != NULL) return 1; @@ -1107,9 +1102,9 @@ layer_linked (Layer *layer) } TempBuf * -layer_preview (layer, w, h) - Layer *layer; - int w, h; +layer_preview (Layer *layer, + int w, + int h) { GImage *gimage; TempBuf *preview_buf; diff --git a/app/gimplayer.h b/app/gimplayer.h index 9f3a7aeda5..e1250cb629 100644 --- a/app/gimplayer.h +++ b/app/gimplayer.h @@ -18,18 +18,13 @@ #ifndef __LAYER_H__ #define __LAYER_H__ +#include "apptypes.h" #include "drawable.h" - #include "boundary.h" #include "channel.h" #include "temp_buf.h" #include "tile_manager.h" -typedef enum { - APPLY, - DISCARD -} MaskApplyMode; - #include "layerF.h" /* structure declarations */ @@ -81,12 +76,17 @@ struct _fs_to_layer_undo /* function declarations */ -Layer * layer_new (GimpImage*, int, int, int, char *, int, int); +Layer * layer_new (GimpImage*, int, int, + GimpImageType, + char *, int, + LayerModeEffects); Layer * layer_copy (Layer *, int); Layer * layer_ref (Layer *); void layer_unref (Layer *); -Layer * layer_from_tiles (void *, GimpDrawable *, TileManager *, char *, int, int); +Layer * layer_from_tiles (void *, GimpDrawable *, TileManager *, + char *, int, + LayerModeEffects); LayerMask * layer_add_mask (Layer *, LayerMask *); LayerMask * layer_create_mask (Layer *, AddMaskType); Layer * layer_get_ID (int); diff --git a/app/global_edit.c b/app/global_edit.c index 24e866504c..7eb22f00c2 100644 --- a/app/global_edit.c +++ b/app/global_edit.c @@ -285,7 +285,7 @@ edit_paste (GImage *gimage, int cx, cy; /* Make a new floating layer */ - float_layer = layer_from_tiles (gimage, drawable, paste, _("Pasted Layer"), OPAQUE_OPACITY, NORMAL); + float_layer = layer_from_tiles (gimage, drawable, paste, _("Pasted Layer"), OPAQUE_OPACITY, NORMAL_MODE); if (float_layer) { @@ -340,7 +340,7 @@ edit_paste_as_new (GImage *invoke, layer = layer_new (gimage, gimage->width, gimage->height, (invoke->base_type == RGB) ? RGBA_GIMAGE : GRAYA_GIMAGE, - _("Pasted Layer"), OPAQUE_OPACITY, NORMAL); + _("Pasted Layer"), OPAQUE_OPACITY, NORMAL_MODE); /* add the new layer to the image */ gimage_disable_undo (gimage); @@ -350,7 +350,7 @@ edit_paste_as_new (GImage *invoke, /* make a new floating layer */ float_layer = layer_from_tiles (gimage, drawable, paste, - _("Pasted Layer"), OPAQUE_OPACITY, NORMAL); + _("Pasted Layer"), OPAQUE_OPACITY, NORMAL_MODE); /* add the new floating selection */ floating_sel_attach (float_layer, drawable); diff --git a/app/gui/brush-select.c b/app/gui/brush-select.c index fa843f4e51..e08e28346d 100644 --- a/app/gui/brush-select.c +++ b/app/gui/brush-select.c @@ -901,7 +901,7 @@ display_brush (BrushSelectP bsp, { if (offset_y > 0 && offset_y < bsp->preview->allocation.height) gtk_preview_draw_row (GTK_PREVIEW (bsp->preview), - brush_scale_indicator_bits[i], + brush_scale_indicator_bits[i][0], offset_x, offset_y, brush_scale_indicator_width); } diff --git a/app/gui/device-status-dialog.c b/app/gui/device-status-dialog.c index 3817cd8ab7..712dd24144 100644 --- a/app/gui/device-status-dialog.c +++ b/app/gui/device-status-dialog.c @@ -1205,7 +1205,7 @@ device_update_brush (GimpBrushP brush, { offset_x = CELL_SIZE - brush_scale_indicator_width - 1; gtk_preview_draw_row (GTK_PREVIEW (deviceD->brushes[preview_id]), - brush_scale_indicator_bits[i], + brush_scale_indicator_bits[i][0], offset_x, offset_y + i, brush_scale_indicator_width); } diff --git a/app/gui/file-new-dialog.c b/app/gui/file-new-dialog.c index 128311550c..0fcd71275e 100644 --- a/app/gui/file-new-dialog.c +++ b/app/gui/file-new-dialog.c @@ -57,8 +57,8 @@ typedef struct gdouble size; /* in bytes */ - gint type; - gint fill_type; + GimpImageBaseType type; + GimpFillType fill_type; } NewImageValues; /* new image local functions */ @@ -83,8 +83,8 @@ static gdouble last_xresolution = 72.0; static gdouble last_yresolution = 72.0; static GUnit last_res_unit = UNIT_INCH; -static gint last_type = RGB; -static gint last_fill_type = BACKGROUND_FILL; +static GimpImageBaseType last_type = RGB; +static GimpFillType last_fill_type = BACKGROUND_FILL; static gboolean last_new_image = FALSE; static gboolean new_dialog_run = FALSE; @@ -98,7 +98,7 @@ file_new_create_image (NewImageValues *vals) GImage *gimage; GDisplay *gdisplay; Layer *layer; - gint type; + GimpImageType type; last_width = vals->width; last_height = vals->height; @@ -132,7 +132,7 @@ file_new_create_image (NewImageValues *vals) /* Make the background (or first) layer */ layer = layer_new (gimage, gimage->width, gimage->height, - type, _("Background"), OPAQUE_OPACITY, NORMAL); + type, _("Background"), OPAQUE_OPACITY, NORMAL_MODE); if (layer) { diff --git a/app/gui/indicator-area.c b/app/gui/indicator-area.c index b2c3d78460..ac1502cce7 100644 --- a/app/gui/indicator-area.c +++ b/app/gui/indicator-area.c @@ -191,7 +191,7 @@ brush_area_update () { offset_x = CELL_SIZE - brush_scale_indicator_width - 1; gtk_preview_draw_row (GTK_PREVIEW (brush_preview), - brush_scale_indicator_bits[i], + brush_scale_indicator_bits[i][0], offset_x, offset_y + i, brush_scale_indicator_width); } diff --git a/app/gui/input-dialog.c b/app/gui/input-dialog.c index 3817cd8ab7..712dd24144 100644 --- a/app/gui/input-dialog.c +++ b/app/gui/input-dialog.c @@ -1205,7 +1205,7 @@ device_update_brush (GimpBrushP brush, { offset_x = CELL_SIZE - brush_scale_indicator_width - 1; gtk_preview_draw_row (GTK_PREVIEW (deviceD->brushes[preview_id]), - brush_scale_indicator_bits[i], + brush_scale_indicator_bits[i][0], offset_x, offset_y + i, brush_scale_indicator_width); } diff --git a/app/gui/plug-in-commands.c b/app/gui/plug-in-commands.c index 84174dda12..4f85f32aeb 100644 --- a/app/gui/plug-in-commands.c +++ b/app/gui/plug-in-commands.c @@ -1240,7 +1240,7 @@ plug_in_repeat (int with_interface) } void -plug_in_set_menu_sensitivity (int base_type) +plug_in_set_menu_sensitivity (GimpImageType type) { PlugInProcDef *proc_def; GSList *tmp; @@ -1254,7 +1254,7 @@ plug_in_set_menu_sensitivity (int base_type) if (proc_def->image_types_val && proc_def->menu_path) { - switch (base_type) + switch (type) { case -1: sensitive = FALSE; diff --git a/app/gui/plug-in-menus.c b/app/gui/plug-in-menus.c index 84174dda12..4f85f32aeb 100644 --- a/app/gui/plug-in-menus.c +++ b/app/gui/plug-in-menus.c @@ -1240,7 +1240,7 @@ plug_in_repeat (int with_interface) } void -plug_in_set_menu_sensitivity (int base_type) +plug_in_set_menu_sensitivity (GimpImageType type) { PlugInProcDef *proc_def; GSList *tmp; @@ -1254,7 +1254,7 @@ plug_in_set_menu_sensitivity (int base_type) if (proc_def->image_types_val && proc_def->menu_path) { - switch (base_type) + switch (type) { case -1: sensitive = FALSE; diff --git a/app/indicator_area.c b/app/indicator_area.c index b2c3d78460..ac1502cce7 100644 --- a/app/indicator_area.c +++ b/app/indicator_area.c @@ -191,7 +191,7 @@ brush_area_update () { offset_x = CELL_SIZE - brush_scale_indicator_width - 1; gtk_preview_draw_row (GTK_PREVIEW (brush_preview), - brush_scale_indicator_bits[i], + brush_scale_indicator_bits[i][0], offset_x, offset_y + i, brush_scale_indicator_width); } diff --git a/app/iscissors.c b/app/iscissors.c index 97f755fc03..c0c1e564d2 100644 --- a/app/iscissors.c +++ b/app/iscissors.c @@ -1680,7 +1680,7 @@ gradmap_tile_validate (TileManager *tm, Tile *tile) /* Blur the source to get rid of noise */ destPR.rowstride = TILE_WIDTH * 4; destPR.data = maxgrad_conv0; - convolve_region (&srcPR, &destPR, blur_32, 3, 32, NORMAL); + convolve_region (&srcPR, &destPR, blur_32, 3, 32, NORMAL_CONVOL); /* Set the "src" temp buf up as the new source Pixel Region */ srcPR.rowstride = destPR.rowstride; @@ -1688,11 +1688,11 @@ gradmap_tile_validate (TileManager *tm, Tile *tile) /* Get the horizontal derivative */ destPR.data = maxgrad_conv1; - convolve_region (&srcPR, &destPR, horz_deriv, 3, 1, NEGATIVE); + convolve_region (&srcPR, &destPR, horz_deriv, 3, 1, NEGATIVE_CONVOL); /* Get the vertical derivative */ destPR.data = maxgrad_conv2; - convolve_region (&srcPR, &destPR, vert_deriv, 3, 1, NEGATIVE); + convolve_region (&srcPR, &destPR, vert_deriv, 3, 1, NEGATIVE_CONVOL); /* calculate overall gradient */ tiledata = tile_data_pointer (tile, 0, 0); diff --git a/app/layer.c b/app/layer.c index 5821431325..4a17df8d7f 100644 --- a/app/layer.c +++ b/app/layer.c @@ -165,7 +165,8 @@ gimp_layer_mask_init (GimpLayerMask *layermask) /* static functions */ static void transform_color (GImage *, PixelRegion *, - PixelRegion *, GimpDrawable *, int); + PixelRegion *, GimpDrawable *, + GimpImageBaseType); static void layer_preview_scale (int, unsigned char *, PixelRegion *, PixelRegion *, int); @@ -195,12 +196,11 @@ layer_invalidate_preview (GtkObject *object) } static void -transform_color (gimage, layerPR, bufPR, drawable, type) - GImage * gimage; - PixelRegion * layerPR; - PixelRegion * bufPR; - GimpDrawable *drawable; - int type; +transform_color (GImage * gimage, + PixelRegion * layerPR, + PixelRegion * bufPR, + GimpDrawable *drawable, + GimpImageBaseType type) { int i, h; unsigned char * s, * d; @@ -234,13 +234,13 @@ transform_color (gimage, layerPR, bufPR, drawable, type) Layer * -layer_new (gimage, width, height, type, name, opacity, mode) - GimpImage* gimage; - int width, height; - int type; - char * name; - int opacity; - int mode; +layer_new (GimpImage* gimage, + int width, + int height, + GimpImageType type, + char * name, + int opacity, + LayerModeEffects mode) { Layer * layer; @@ -251,7 +251,7 @@ layer_new (gimage, width, height, type, name, opacity, mode) layer = gtk_type_new (gimp_layer_get_type ()); - gimp_drawable_configure (GIMP_DRAWABLE(layer), + gimp_drawable_configure (GIMP_DRAWABLE(layer), gimage, width, height, type, name); /* allocate the memory for this layer */ @@ -303,7 +303,7 @@ layer_copy (layer, add_alpha) { char * layer_name; Layer * new_layer; - int new_type; + GimpImageType new_type; char *ext; int number; char *name; @@ -397,17 +397,16 @@ layer_copy (layer, add_alpha) Layer * -layer_from_tiles (gimage_ptr, drawable, tiles, name, opacity, mode) - void *gimage_ptr; - GimpDrawable *drawable; - TileManager *tiles; - char *name; - int opacity; - int mode; +layer_from_tiles (void *gimage_ptr, + GimpDrawable *drawable, + TileManager *tiles, + char *name, + int opacity, + LayerModeEffects mode) { GImage * gimage; Layer * new_layer; - int layer_type; + GimpImageType layer_type; PixelRegion layerPR, bufPR; /* Function copies buffer to a layer @@ -692,7 +691,7 @@ layer_add_alpha (layer) { PixelRegion srcPR, destPR; TileManager *new_tiles; - int type; + GimpImageType type; /* Don't bother if the layer already has alpha */ switch (GIMP_DRAWABLE(layer)->type) @@ -1062,24 +1061,21 @@ layer_get_name (Layer *layer) unsigned char * -layer_data (layer) - Layer * layer; +layer_data (Layer * layer) { return NULL; } LayerMask * -layer_mask (layer) - Layer * layer; +layer_mask (Layer * layer) { return layer->mask; } int -layer_has_alpha (layer) - Layer * layer; +layer_has_alpha (Layer * layer) { if (GIMP_DRAWABLE(layer)->type == RGBA_GIMAGE || GIMP_DRAWABLE(layer)->type == GRAYA_GIMAGE || @@ -1091,8 +1087,7 @@ layer_has_alpha (layer) int -layer_is_floating_sel (layer) - Layer *layer; +layer_is_floating_sel (Layer *layer) { if (layer->fs.drawable != NULL) return 1; @@ -1107,9 +1102,9 @@ layer_linked (Layer *layer) } TempBuf * -layer_preview (layer, w, h) - Layer *layer; - int w, h; +layer_preview (Layer *layer, + int w, + int h) { GImage *gimage; TempBuf *preview_buf; diff --git a/app/layer.h b/app/layer.h index 9f3a7aeda5..e1250cb629 100644 --- a/app/layer.h +++ b/app/layer.h @@ -18,18 +18,13 @@ #ifndef __LAYER_H__ #define __LAYER_H__ +#include "apptypes.h" #include "drawable.h" - #include "boundary.h" #include "channel.h" #include "temp_buf.h" #include "tile_manager.h" -typedef enum { - APPLY, - DISCARD -} MaskApplyMode; - #include "layerF.h" /* structure declarations */ @@ -81,12 +76,17 @@ struct _fs_to_layer_undo /* function declarations */ -Layer * layer_new (GimpImage*, int, int, int, char *, int, int); +Layer * layer_new (GimpImage*, int, int, + GimpImageType, + char *, int, + LayerModeEffects); Layer * layer_copy (Layer *, int); Layer * layer_ref (Layer *); void layer_unref (Layer *); -Layer * layer_from_tiles (void *, GimpDrawable *, TileManager *, char *, int, int); +Layer * layer_from_tiles (void *, GimpDrawable *, TileManager *, + char *, int, + LayerModeEffects); LayerMask * layer_add_mask (Layer *, LayerMask *); LayerMask * layer_create_mask (Layer *, AddMaskType); Layer * layer_get_ID (int); diff --git a/app/layerF.h b/app/layerF.h index cb251529b4..40cc983cff 100644 --- a/app/layerF.h +++ b/app/layerF.h @@ -1,25 +1,6 @@ #ifndef __LAYER_F_H__ #define __LAYER_F_H__ -typedef enum /*< chop=ADD_ >*/ -{ - ADD_WHITE_MASK, - ADD_BLACK_MASK, - ADD_ALPHA_MASK -} AddMaskType; - -typedef struct _GimpLayer GimpLayer; -typedef struct _GimpLayerClass GimpLayerClass; -typedef struct _GimpLayerMask GimpLayerMask; -typedef struct _GimpLayerMaskClass GimpLayerMaskClass; - -typedef GimpLayer Layer; /* convenience */ -typedef GimpLayerMask LayerMask; /* convenience */ - -typedef struct _layer_undo LayerUndo; - -typedef struct _layer_mask_undo LayerMaskUndo; - -typedef struct _fs_to_layer_undo FStoLayerUndo; +#include "apptypes.h" #endif diff --git a/app/layer_cmds.c b/app/layer_cmds.c index 7a5285ae25..c680546f6e 100644 --- a/app/layer_cmds.c +++ b/app/layer_cmds.c @@ -142,7 +142,8 @@ layer_new_invoker (Argument *args) if (success) { opacity = (int) ((opacity_arg * 255) / 100); - layer = layer_new (gimage, width, height, type, name, opacity, mode); + layer = layer_new (gimage, width, height, (GimpImageType) type, + name, opacity, (LayerModeEffects) mode); success = layer != NULL; } @@ -301,7 +302,7 @@ layer_create_mask_invoker (Argument *args) success = FALSE; if (success) - success = (mask = layer_create_mask (layer, mask_type)) != NULL; + success = (mask = layer_create_mask (layer, (AddMaskType) mask_type)) != NULL; return_args = procedural_db_return_args (&layer_create_mask_proc, success); diff --git a/app/layer_pvt.h b/app/layer_pvt.h index c8fc011bc5..d9247bfc81 100644 --- a/app/layer_pvt.h +++ b/app/layer_pvt.h @@ -42,7 +42,7 @@ struct _GimpLayer int show_mask; /* show mask or layer? */ int opacity; /* layer opacity */ - int mode; /* layer combination mode */ + LayerModeEffects mode; /* layer combination mode */ /* Floating selections */ struct diff --git a/app/makefile.msc b/app/makefile.msc index 603a01f2b2..48ea661436 100644 --- a/app/makefile.msc +++ b/app/makefile.msc @@ -268,6 +268,9 @@ gimp.exe : ..\config.h $(gimp_OBJECTS) gimpim.lib gimp.def gimp.res ..\libgimp\g .c.obj: $(CC) $(CFLAGS) -c $< +.c.i : + $(CC) $(CFLAGS) -E $< >$@ + clean: del *.exe del *.lib diff --git a/app/menus/plug-in-menus.c b/app/menus/plug-in-menus.c index 84174dda12..4f85f32aeb 100644 --- a/app/menus/plug-in-menus.c +++ b/app/menus/plug-in-menus.c @@ -1240,7 +1240,7 @@ plug_in_repeat (int with_interface) } void -plug_in_set_menu_sensitivity (int base_type) +plug_in_set_menu_sensitivity (GimpImageType type) { PlugInProcDef *proc_def; GSList *tmp; @@ -1254,7 +1254,7 @@ plug_in_set_menu_sensitivity (int base_type) if (proc_def->image_types_val && proc_def->menu_path) { - switch (base_type) + switch (type) { case -1: sensitive = FALSE; diff --git a/app/nav_window.c b/app/nav_window.c index 67d3df2e02..5d6d1d6cc3 100644 --- a/app/nav_window.c +++ b/app/nav_window.c @@ -549,6 +549,7 @@ nav_window_preview_events (GtkWidget *widget, } break; default: + break; } break; @@ -564,6 +565,7 @@ nav_window_preview_events (GtkWidget *widget, gtk_grab_remove(widget); break; default: + break; } break; diff --git a/app/paint-funcs/paint-funcs.c b/app/paint-funcs/paint-funcs.c index 2314e05670..3c008999ef 100644 --- a/app/paint-funcs/paint-funcs.c +++ b/app/paint-funcs/paint-funcs.c @@ -74,7 +74,10 @@ struct _LayerMode char *name; /* layer mode specification */ }; -LayerMode layer_modes[] = +LayerMode layer_modes[] = /* This must obviously be in the same + * order as the corresponding values + * in the LayerModeEffects enumeration. + */ { { 1, 1, 0, N_("Normal") }, { 1, 1, 0, N_("Dissolve") }, @@ -3374,12 +3377,12 @@ extract_from_region (PixelRegion *src, void -convolve_region (PixelRegion *srcR, - PixelRegion *destR, - int *matrix, - int size, - int divisor, - int mode) +convolve_region (PixelRegion *srcR, + PixelRegion *destR, + int *matrix, + int size, + int divisor, + ConvolutionType mode) { /* Convolve the src image using the convolution matrix, writing to dest */ /* Convolve is not tile-enabled--use accordingly */ @@ -3395,11 +3398,11 @@ convolve_region (PixelRegion *srcR, int x, y; int offset; - /* If the mode is NEGATIVE, the offset should be 128 */ - if (mode == NEGATIVE) + /* If the mode is NEGATIVE_CONVOL, the offset should be 128 */ + if (mode == NEGATIVE_CONVOL) { offset = 128; - mode = 0; + mode = NORMAL_CONVOL; } else offset = 0; @@ -3465,8 +3468,7 @@ convolve_region (PixelRegion *srcR, { total [b] = total [b] / divisor + offset; - /* only if mode was ABSOLUTE will mode by non-zero here */ - if (total [b] < 0 && mode) + if (total [b] < 0 && mode != NORMAL_CONVOL) total [b] = - total [b]; if (total [b] < 0) @@ -5049,7 +5051,7 @@ copy_gray_to_region (PixelRegion *src, struct initial_regions_struct { int opacity; - int mode; + LayerModeEffects mode; int *affect; int type; unsigned char *data; @@ -5063,12 +5065,12 @@ initial_sub_region(struct initial_regions_struct *st, { int h; unsigned char * s, * d, * m; - unsigned char buf[512]; - unsigned char *data; - int opacity; - int mode; - int *affect; - int type; + unsigned char buf[512]; + unsigned char *data; + int opacity; + LayerModeEffects mode; + int *affect; + int type; data = st->data; opacity = st->opacity; @@ -5134,14 +5136,14 @@ initial_sub_region(struct initial_regions_struct *st, } void -initial_region (PixelRegion *src, - PixelRegion *dest, - PixelRegion *mask, - unsigned char *data, - int opacity, - int mode, - int *affect, - int type) +initial_region (PixelRegion *src, + PixelRegion *dest, + PixelRegion *mask, + unsigned char *data, + int opacity, + LayerModeEffects mode, + int *affect, + int type) { struct initial_regions_struct st; @@ -5158,7 +5160,7 @@ initial_region (PixelRegion *src, struct combine_regions_struct { int opacity; - int mode; + LayerModeEffects mode; int *affect; int type; unsigned char *data; @@ -5174,11 +5176,11 @@ combine_sub_region(struct combine_regions_struct *st, PixelRegion *src1, PixelRegion *src2, PixelRegion *dest, PixelRegion *mask) { - unsigned char *data; - int opacity; - int mode; - int *affect; - int type; + unsigned char *data; + int opacity; + LayerModeEffects mode; + int *affect; + int type; int h; int has_alpha1, has_alpha2; int combine = 0; @@ -5422,15 +5424,15 @@ combine_sub_region(struct combine_regions_struct *st, void -combine_regions (PixelRegion *src1, - PixelRegion *src2, - PixelRegion *dest, - PixelRegion *mask, - unsigned char *data, - int opacity, - int mode, - int *affect, - int type) +combine_regions (PixelRegion *src1, + PixelRegion *src2, + PixelRegion *dest, + PixelRegion *mask, + unsigned char *data, + int opacity, + LayerModeEffects mode, + int *affect, + int type) { int has_alpha1, has_alpha2; int i; @@ -5865,19 +5867,19 @@ hls_to_rgb (int *h, /************************************/ int -apply_layer_mode (unsigned char *src1, - unsigned char *src2, - unsigned char **dest, - int x, - int y, - int opacity, - int length, - int mode, - int bytes1, /* bytes */ - int bytes2, /* bytes */ - int has_alpha1, /* has alpha */ - int has_alpha2, /* has alpha */ - int *mode_affect) +apply_layer_mode (unsigned char *src1, + unsigned char *src2, + unsigned char **dest, + int x, + int y, + int opacity, + int length, + LayerModeEffects mode, + int bytes1, /* bytes */ + int bytes2, /* bytes */ + int has_alpha1, /* has alpha */ + int has_alpha2, /* has alpha */ + int *mode_affect) { int combine; @@ -5999,12 +6001,12 @@ apply_layer_mode (unsigned char *src1, int -apply_indexed_layer_mode (unsigned char *src1, - unsigned char *src2, - unsigned char **dest, - int mode, - int has_alpha1, /* has alpha */ - int has_alpha2) /* has alpha */ +apply_indexed_layer_mode (unsigned char *src1, + unsigned char *src2, + unsigned char **dest, + LayerModeEffects mode, + int has_alpha1, /* has alpha */ + int has_alpha2) /* has alpha */ { int combine; diff --git a/app/paint-funcs/paint-funcs.h b/app/paint-funcs/paint-funcs.h index c11580c554..becaebf7e7 100644 --- a/app/paint-funcs/paint-funcs.h +++ b/app/paint-funcs/paint-funcs.h @@ -24,6 +24,7 @@ #ifndef __PAINT_FUNCS_H__ #define __PAINT_FUNCS_H__ +#include "apptypes.h" #include "pixel_region.h" #include "gimpimageF.h" @@ -474,13 +475,10 @@ void extract_from_region (PixelRegion *, PixelRegion *, unsigned char *, int, int, int); -/* The types of convolutions */ -#define NORMAL 0 /* Negative numbers truncated */ -#define ABSOLUTE 1 /* Absolute value */ -#define NEGATIVE 2 /* add 127 to values */ - -void convolve_region (PixelRegion *, PixelRegion *, - int *, int, int, int); +void convolve_region (PixelRegion *, + PixelRegion *, + int *, int, int, + ConvolutionType); void multiply_alpha_region (PixelRegion *); @@ -529,10 +527,6 @@ void copy_gray_to_region (PixelRegion *, PixelRegion *); #define INITIAL_INTENSITY 4 #define INITIAL_INTENSITY_ALPHA 5 -void initial_region (PixelRegion *, PixelRegion *, - PixelRegion *, unsigned char *, - int, int, int *, int); - /* Combine two source regions with the help of an optional mask * region into a destination region. This is used for constructing * layer projections, and for applying image patches to an image @@ -560,17 +554,6 @@ void initial_region (PixelRegion *, PixelRegion *, #define NO_COMBINATION 28 -void combine_regions (PixelRegion *, PixelRegion *, - PixelRegion *, PixelRegion *, - unsigned char *, int, - int, int *, int); - -void combine_regions_replace (PixelRegion *, PixelRegion *, - PixelRegion *, PixelRegion *, - unsigned char *, - int, int *, int); - - /* Color conversion routines */ void rgb_to_hsv (int *, int *, int *); void hsv_to_rgb (int *, int *, int *); @@ -582,36 +565,32 @@ void hls_to_rgb (int *, int *, int *); #define TRANSPARENT_OPACITY 0 #define OPAQUE_OPACITY 255 -/* Layer Modes */ -typedef enum { - NORMAL_MODE, - DISSOLVE_MODE, - BEHIND_MODE, - MULTIPLY_MODE, - SCREEN_MODE, - OVERLAY_MODE, - DIFFERENCE_MODE, - ADDITION_MODE, - SUBTRACT_MODE, - DARKEN_ONLY_MODE, - LIGHTEN_ONLY_MODE, - HUE_MODE, - SATURATION_MODE, - COLOR_MODE, - VALUE_MODE, - DIVIDE_MODE, - ERASE_MODE, /*< skip >*/ - REPLACE_MODE, /*< skip >*/ - ANTI_ERASE_MODE, /*< skip >*/ -} LayerModeEffects; +void initial_region (PixelRegion *, PixelRegion *, + PixelRegion *, unsigned char *, + int, LayerModeEffects, int *, int); + +void combine_regions (PixelRegion *, PixelRegion *, + PixelRegion *, PixelRegion *, + unsigned char *, int, + LayerModeEffects, + int *, int); + +void combine_regions_replace (PixelRegion *, PixelRegion *, + PixelRegion *, PixelRegion *, + unsigned char *, + int, int *, int); + /* Applying layer modes... */ int apply_layer_mode (unsigned char *, unsigned char *, unsigned char **, int, int, int, - int, int, int, int, int, int, int *); + int, + LayerModeEffects, + int, int, int, int, int *); int apply_indexed_layer_mode (unsigned char *, unsigned char *, - unsigned char **, int, int, int); + unsigned char **, + LayerModeEffects, int, int); #endif /* __PAINT_FUNCS_H__ */ diff --git a/app/paint/gimpairbrush.c b/app/paint/gimpairbrush.c index a2db2f578e..52704792bc 100644 --- a/app/paint/gimpairbrush.c +++ b/app/paint/gimpairbrush.c @@ -86,7 +86,7 @@ static double non_gui_pressure; static gboolean non_gui_incremental; /* forward function declarations */ -static void airbrush_motion (PaintCore *, GimpDrawable *, double, gboolean); +static void airbrush_motion (PaintCore *, GimpDrawable *, double, PaintApplicationMode); static gint airbrush_time_out (gpointer); @@ -235,7 +235,8 @@ airbrush_paint_func (PaintCore *paint_core, gtk_timeout_remove (timer); timer_state = OFF; - airbrush_motion (paint_core, drawable, airbrush_options->pressure, airbrush_options->incremental); + airbrush_motion (paint_core, drawable, airbrush_options->pressure, + airbrush_options->incremental ? INCREMENTAL : CONSTANT); if (airbrush_options->rate != 0.0) { @@ -279,7 +280,7 @@ airbrush_time_out (gpointer client_data) airbrush_motion (airbrush_timeout.paint_core, airbrush_timeout.drawable, airbrush_options->pressure, - airbrush_options->incremental); + airbrush_options->incremental ? INCREMENTAL : CONSTANT); gdisplays_flush (); /* restart the timer */ @@ -291,10 +292,10 @@ airbrush_time_out (gpointer client_data) static void -airbrush_motion (PaintCore *paint_core, - GimpDrawable *drawable, - double pressure, - gboolean mode) +airbrush_motion (PaintCore *paint_core, + GimpDrawable *drawable, + double pressure, + PaintApplicationMode mode) { gint opacity; GImage *gimage; @@ -316,9 +317,9 @@ airbrush_motion (PaintCore *paint_core, col[area->bytes - 1] = OPAQUE_OPACITY; - if(GIMP_IS_BRUSH_PIXMAP(paint_core->brush)) + if (GIMP_IS_BRUSH_PIXMAP (paint_core->brush)) { - color_area_with_pixmap(gimage, drawable, area, paint_core->brush); + color_area_with_pixmap (gimage, drawable, area, paint_core->brush); mode = INCREMENTAL; } else diff --git a/app/paint/gimpconvolve.c b/app/paint/gimpconvolve.c index a4c11ff8b6..52ebf40ff5 100644 --- a/app/paint/gimpconvolve.c +++ b/app/paint/gimpconvolve.c @@ -337,7 +337,7 @@ convolve_motion (PaintCore *paint_core, /* Convolve the region */ convolve_region (&tempPR, &destPR, matrix, matrix_size, - matrix_divisor, NORMAL); + matrix_divisor, NORMAL_CONVOL); if (drawable_has_alpha (drawable)) separate_alpha_region (&destPR); diff --git a/app/paint/gimppencil.c b/app/paint/gimppencil.c index 2433ce1d54..294faf6f30 100644 --- a/app/paint/gimppencil.c +++ b/app/paint/gimppencil.c @@ -85,7 +85,7 @@ pencil_paint_func (PaintCore *paint_core, void pencil_options_reset (void) { - paint_options_reset (pencil_options); + paint_options_reset (&pencil_options->paint_options); } Tool * @@ -119,13 +119,13 @@ tools_free_pencil (Tool *tool) static void pencil_motion (PaintCore *paint_core, GimpDrawable *drawable, - gboolean increment) + gboolean increment) { GImage *gimage; TempBuf * area; unsigned char col[MAX_CHANNELS]; gint opacity; - + PaintApplicationMode paint_appl_mode = increment ? INCREMENTAL : CONSTANT; if (! (gimage = drawable_gimage (drawable))) return; @@ -140,11 +140,11 @@ pencil_motion (PaintCore *paint_core, col[area->bytes - 1] = OPAQUE_OPACITY; - if(GIMP_IS_BRUSH_PIXMAP(paint_core->brush)) + if (GIMP_IS_BRUSH_PIXMAP (paint_core->brush)) { /* if its a pixmap, do pixmap stuff */ - color_area_with_pixmap(gimage, drawable, area, paint_core->brush); - increment = INCREMENTAL; + color_area_with_pixmap (gimage, drawable, area, paint_core->brush); + paint_appl_mode = INCREMENTAL; } else { @@ -167,7 +167,7 @@ pencil_motion (PaintCore *paint_core, paint_core_paste_canvas (paint_core, drawable, opacity, (int) (gimp_context_get_opacity (NULL) * 255), gimp_context_get_paint_mode (NULL), - HARD, increment); + HARD, paint_appl_mode); } static void * diff --git a/app/paint_core.c b/app/paint_core.c index 5335d6c466..60f0eb17ec 100644 --- a/app/paint_core.c +++ b/app/paint_core.c @@ -52,11 +52,14 @@ PaintCore non_gui_paint_core; static MaskBuf * paint_core_subsample_mask (MaskBuf *, double, double); static MaskBuf * paint_core_pressurize_mask (MaskBuf *, double, double, double); static MaskBuf * paint_core_solidify_mask (MaskBuf *); -static MaskBuf * paint_core_get_brush_mask (PaintCore *, int); +static MaskBuf * paint_core_get_brush_mask (PaintCore *, BrushApplicationMode); static void paint_core_paste (PaintCore *, MaskBuf *, - GimpDrawable *, int, int, int, int); + GimpDrawable *, int, int, + LayerModeEffects, + PaintApplicationMode); static void paint_core_replace (PaintCore *, MaskBuf *, - GimpDrawable *, int, int, int); + GimpDrawable *, int, int, + PaintApplicationMode); static void brush_to_canvas_tiles (PaintCore *, MaskBuf *, int); static void canvas_tiles_to_canvas_buf (PaintCore *); static void brush_to_canvas_buf (PaintCore *, MaskBuf *, int); @@ -941,13 +944,13 @@ paint_core_get_orig_image (PaintCore *paint_core, } void -paint_core_paste_canvas (PaintCore *paint_core, - GimpDrawable *drawable, - int brush_opacity, - int image_opacity, - int paint_mode, - int brush_hardness, - int mode) +paint_core_paste_canvas (PaintCore *paint_core, + GimpDrawable *drawable, + int brush_opacity, + int image_opacity, + LayerModeEffects paint_mode, + BrushApplicationMode brush_hardness, + PaintApplicationMode mode) { MaskBuf *brush_mask; @@ -963,12 +966,12 @@ paint_core_paste_canvas (PaintCore *paint_core, rather than using it to composite (i.e. transparent over opaque becomes transparent rather than opauqe. */ void -paint_core_replace_canvas (PaintCore *paint_core, - GimpDrawable *drawable, - int brush_opacity, - int image_opacity, - int brush_hardness, - int mode) +paint_core_replace_canvas (PaintCore *paint_core, + GimpDrawable *drawable, + int brush_opacity, + int image_opacity, + BrushApplicationMode brush_hardness, + PaintApplicationMode mode) { MaskBuf *brush_mask; @@ -1203,8 +1206,8 @@ paint_core_solidify_mask (MaskBuf *brush_mask) } static MaskBuf * -paint_core_get_brush_mask (PaintCore *paint_core, - int brush_hardness) +paint_core_get_brush_mask (PaintCore *paint_core, + BrushApplicationMode brush_hardness) { MaskBuf * bm; @@ -1228,13 +1231,13 @@ paint_core_get_brush_mask (PaintCore *paint_core, } static void -paint_core_paste (PaintCore *paint_core, - MaskBuf *brush_mask, - GimpDrawable *drawable, - int brush_opacity, - int image_opacity, - int paint_mode, - int mode) +paint_core_paste (PaintCore *paint_core, + MaskBuf *brush_mask, + GimpDrawable *drawable, + int brush_opacity, + int image_opacity, + LayerModeEffects paint_mode, + PaintApplicationMode mode) { GImage *gimage; PixelRegion srcPR; @@ -1306,12 +1309,12 @@ paint_core_paste (PaintCore *paint_core, mode. */ static void -paint_core_replace (PaintCore *paint_core, - MaskBuf *brush_mask, - GimpDrawable *drawable, - int brush_opacity, - int image_opacity, - int mode) +paint_core_replace (PaintCore *paint_core, + MaskBuf *brush_mask, + GimpDrawable *drawable, + int brush_opacity, + int image_opacity, + PaintApplicationMode mode) { GImage *gimage; PixelRegion srcPR, maskPR; diff --git a/app/paint_core.h b/app/paint_core.h index 8b8e650f2b..5ec84006e4 100644 --- a/app/paint_core.h +++ b/app/paint_core.h @@ -18,6 +18,7 @@ #ifndef __PAINT_CORE_H__ #define __PAINT_CORE_H__ +#include "apptypes.h" #include "draw_core.h" #include "temp_buf.h" #include "gimpbrush.h" @@ -30,21 +31,6 @@ #define RESUME_PAINT 3 #define FINISH_PAINT 4 -/* brush application types */ -typedef enum -{ - HARD, /* pencil */ - SOFT, /* paintbrush */ - PRESSURE /* paintbrush with variable pressure */ -} BrushApplicationMode; - -/* paint application modes */ -typedef enum -{ - CONSTANT, /*< nick=CONTINUOUS >*/ /* pencil, paintbrush, airbrush, clone */ - INCREMENTAL /* convolve, smudge */ -} PaintApplicationMode; - /* gradient paint modes */ typedef enum { ONCE_FORWARD, /* paint through once, then stop */ @@ -127,9 +113,19 @@ void paint_core_finish (PaintCore *, GimpDrawable *, int); void paint_core_cleanup (void); /* paint tool painting functions */ -TempBuf * paint_core_get_paint_area (PaintCore *, GimpDrawable *); -TempBuf * paint_core_get_orig_image (PaintCore *, GimpDrawable *, int, int, int, int); -void paint_core_paste_canvas (PaintCore *, GimpDrawable *, int, int, int, int, int); -void paint_core_replace_canvas (PaintCore *, GimpDrawable *, int, int, int, int); +TempBuf * paint_core_get_paint_area (PaintCore *, + GimpDrawable *); +TempBuf * paint_core_get_orig_image (PaintCore *, + GimpDrawable *, + int, int, int, int); +void paint_core_paste_canvas (PaintCore *, + GimpDrawable *, int, int, + LayerModeEffects, + BrushApplicationMode, + PaintApplicationMode); +void paint_core_replace_canvas (PaintCore *, + GimpDrawable *, int, int, + BrushApplicationMode, + PaintApplicationMode); #endif /* __PAINT_CORE_H__ */ diff --git a/app/paint_funcs.c b/app/paint_funcs.c index 2314e05670..3c008999ef 100644 --- a/app/paint_funcs.c +++ b/app/paint_funcs.c @@ -74,7 +74,10 @@ struct _LayerMode char *name; /* layer mode specification */ }; -LayerMode layer_modes[] = +LayerMode layer_modes[] = /* This must obviously be in the same + * order as the corresponding values + * in the LayerModeEffects enumeration. + */ { { 1, 1, 0, N_("Normal") }, { 1, 1, 0, N_("Dissolve") }, @@ -3374,12 +3377,12 @@ extract_from_region (PixelRegion *src, void -convolve_region (PixelRegion *srcR, - PixelRegion *destR, - int *matrix, - int size, - int divisor, - int mode) +convolve_region (PixelRegion *srcR, + PixelRegion *destR, + int *matrix, + int size, + int divisor, + ConvolutionType mode) { /* Convolve the src image using the convolution matrix, writing to dest */ /* Convolve is not tile-enabled--use accordingly */ @@ -3395,11 +3398,11 @@ convolve_region (PixelRegion *srcR, int x, y; int offset; - /* If the mode is NEGATIVE, the offset should be 128 */ - if (mode == NEGATIVE) + /* If the mode is NEGATIVE_CONVOL, the offset should be 128 */ + if (mode == NEGATIVE_CONVOL) { offset = 128; - mode = 0; + mode = NORMAL_CONVOL; } else offset = 0; @@ -3465,8 +3468,7 @@ convolve_region (PixelRegion *srcR, { total [b] = total [b] / divisor + offset; - /* only if mode was ABSOLUTE will mode by non-zero here */ - if (total [b] < 0 && mode) + if (total [b] < 0 && mode != NORMAL_CONVOL) total [b] = - total [b]; if (total [b] < 0) @@ -5049,7 +5051,7 @@ copy_gray_to_region (PixelRegion *src, struct initial_regions_struct { int opacity; - int mode; + LayerModeEffects mode; int *affect; int type; unsigned char *data; @@ -5063,12 +5065,12 @@ initial_sub_region(struct initial_regions_struct *st, { int h; unsigned char * s, * d, * m; - unsigned char buf[512]; - unsigned char *data; - int opacity; - int mode; - int *affect; - int type; + unsigned char buf[512]; + unsigned char *data; + int opacity; + LayerModeEffects mode; + int *affect; + int type; data = st->data; opacity = st->opacity; @@ -5134,14 +5136,14 @@ initial_sub_region(struct initial_regions_struct *st, } void -initial_region (PixelRegion *src, - PixelRegion *dest, - PixelRegion *mask, - unsigned char *data, - int opacity, - int mode, - int *affect, - int type) +initial_region (PixelRegion *src, + PixelRegion *dest, + PixelRegion *mask, + unsigned char *data, + int opacity, + LayerModeEffects mode, + int *affect, + int type) { struct initial_regions_struct st; @@ -5158,7 +5160,7 @@ initial_region (PixelRegion *src, struct combine_regions_struct { int opacity; - int mode; + LayerModeEffects mode; int *affect; int type; unsigned char *data; @@ -5174,11 +5176,11 @@ combine_sub_region(struct combine_regions_struct *st, PixelRegion *src1, PixelRegion *src2, PixelRegion *dest, PixelRegion *mask) { - unsigned char *data; - int opacity; - int mode; - int *affect; - int type; + unsigned char *data; + int opacity; + LayerModeEffects mode; + int *affect; + int type; int h; int has_alpha1, has_alpha2; int combine = 0; @@ -5422,15 +5424,15 @@ combine_sub_region(struct combine_regions_struct *st, void -combine_regions (PixelRegion *src1, - PixelRegion *src2, - PixelRegion *dest, - PixelRegion *mask, - unsigned char *data, - int opacity, - int mode, - int *affect, - int type) +combine_regions (PixelRegion *src1, + PixelRegion *src2, + PixelRegion *dest, + PixelRegion *mask, + unsigned char *data, + int opacity, + LayerModeEffects mode, + int *affect, + int type) { int has_alpha1, has_alpha2; int i; @@ -5865,19 +5867,19 @@ hls_to_rgb (int *h, /************************************/ int -apply_layer_mode (unsigned char *src1, - unsigned char *src2, - unsigned char **dest, - int x, - int y, - int opacity, - int length, - int mode, - int bytes1, /* bytes */ - int bytes2, /* bytes */ - int has_alpha1, /* has alpha */ - int has_alpha2, /* has alpha */ - int *mode_affect) +apply_layer_mode (unsigned char *src1, + unsigned char *src2, + unsigned char **dest, + int x, + int y, + int opacity, + int length, + LayerModeEffects mode, + int bytes1, /* bytes */ + int bytes2, /* bytes */ + int has_alpha1, /* has alpha */ + int has_alpha2, /* has alpha */ + int *mode_affect) { int combine; @@ -5999,12 +6001,12 @@ apply_layer_mode (unsigned char *src1, int -apply_indexed_layer_mode (unsigned char *src1, - unsigned char *src2, - unsigned char **dest, - int mode, - int has_alpha1, /* has alpha */ - int has_alpha2) /* has alpha */ +apply_indexed_layer_mode (unsigned char *src1, + unsigned char *src2, + unsigned char **dest, + LayerModeEffects mode, + int has_alpha1, /* has alpha */ + int has_alpha2) /* has alpha */ { int combine; diff --git a/app/paint_funcs.h b/app/paint_funcs.h index c11580c554..becaebf7e7 100644 --- a/app/paint_funcs.h +++ b/app/paint_funcs.h @@ -24,6 +24,7 @@ #ifndef __PAINT_FUNCS_H__ #define __PAINT_FUNCS_H__ +#include "apptypes.h" #include "pixel_region.h" #include "gimpimageF.h" @@ -474,13 +475,10 @@ void extract_from_region (PixelRegion *, PixelRegion *, unsigned char *, int, int, int); -/* The types of convolutions */ -#define NORMAL 0 /* Negative numbers truncated */ -#define ABSOLUTE 1 /* Absolute value */ -#define NEGATIVE 2 /* add 127 to values */ - -void convolve_region (PixelRegion *, PixelRegion *, - int *, int, int, int); +void convolve_region (PixelRegion *, + PixelRegion *, + int *, int, int, + ConvolutionType); void multiply_alpha_region (PixelRegion *); @@ -529,10 +527,6 @@ void copy_gray_to_region (PixelRegion *, PixelRegion *); #define INITIAL_INTENSITY 4 #define INITIAL_INTENSITY_ALPHA 5 -void initial_region (PixelRegion *, PixelRegion *, - PixelRegion *, unsigned char *, - int, int, int *, int); - /* Combine two source regions with the help of an optional mask * region into a destination region. This is used for constructing * layer projections, and for applying image patches to an image @@ -560,17 +554,6 @@ void initial_region (PixelRegion *, PixelRegion *, #define NO_COMBINATION 28 -void combine_regions (PixelRegion *, PixelRegion *, - PixelRegion *, PixelRegion *, - unsigned char *, int, - int, int *, int); - -void combine_regions_replace (PixelRegion *, PixelRegion *, - PixelRegion *, PixelRegion *, - unsigned char *, - int, int *, int); - - /* Color conversion routines */ void rgb_to_hsv (int *, int *, int *); void hsv_to_rgb (int *, int *, int *); @@ -582,36 +565,32 @@ void hls_to_rgb (int *, int *, int *); #define TRANSPARENT_OPACITY 0 #define OPAQUE_OPACITY 255 -/* Layer Modes */ -typedef enum { - NORMAL_MODE, - DISSOLVE_MODE, - BEHIND_MODE, - MULTIPLY_MODE, - SCREEN_MODE, - OVERLAY_MODE, - DIFFERENCE_MODE, - ADDITION_MODE, - SUBTRACT_MODE, - DARKEN_ONLY_MODE, - LIGHTEN_ONLY_MODE, - HUE_MODE, - SATURATION_MODE, - COLOR_MODE, - VALUE_MODE, - DIVIDE_MODE, - ERASE_MODE, /*< skip >*/ - REPLACE_MODE, /*< skip >*/ - ANTI_ERASE_MODE, /*< skip >*/ -} LayerModeEffects; +void initial_region (PixelRegion *, PixelRegion *, + PixelRegion *, unsigned char *, + int, LayerModeEffects, int *, int); + +void combine_regions (PixelRegion *, PixelRegion *, + PixelRegion *, PixelRegion *, + unsigned char *, int, + LayerModeEffects, + int *, int); + +void combine_regions_replace (PixelRegion *, PixelRegion *, + PixelRegion *, PixelRegion *, + unsigned char *, + int, int *, int); + /* Applying layer modes... */ int apply_layer_mode (unsigned char *, unsigned char *, unsigned char **, int, int, int, - int, int, int, int, int, int, int *); + int, + LayerModeEffects, + int, int, int, int, int *); int apply_indexed_layer_mode (unsigned char *, unsigned char *, - unsigned char **, int, int, int); + unsigned char **, + LayerModeEffects, int, int); #endif /* __PAINT_FUNCS_H__ */ diff --git a/app/paintbrush.c b/app/paintbrush.c index 6a792514f1..ff9583ad83 100644 --- a/app/paintbrush.c +++ b/app/paintbrush.c @@ -394,6 +394,7 @@ paintbrush_motion (PaintCore *paint_core, unsigned char col[MAX_CHANNELS]; double r,g,b,a; int mode; + PaintApplicationMode paint_appl_mode = incremental ? INCREMENTAL : CONSTANT; position = 0.0; if (! (gimage = drawable_gimage (drawable))) @@ -443,7 +444,7 @@ paintbrush_motion (PaintCore *paint_core, col[2] = (gint)b; /* always use incremental mode with gradients */ /* make the gui cool later */ - incremental = INCREMENTAL; + paint_appl_mode = INCREMENTAL; } /* just leave this because I know as soon as i delete it i'll find a bug */ /* printf("temp_blend: %u grad_len: %f distance: %f \n",temp_blend, gradient_length, distance); */ @@ -453,10 +454,10 @@ paintbrush_motion (PaintCore *paint_core, /* we check to see if this is a pixmap, if so composite the pixmap image into the are instead of the color */ - if(GIMP_IS_BRUSH_PIXMAP(paint_core->brush) && !gradient_length) + if (GIMP_IS_BRUSH_PIXMAP (paint_core->brush) && !gradient_length) { color_area_with_pixmap(gimage, drawable, area, paint_core->brush); - incremental = INCREMENTAL; + paint_appl_mode = INCREMENTAL; } else { @@ -470,7 +471,7 @@ paintbrush_motion (PaintCore *paint_core, (int) (gimp_context_get_opacity (NULL) * 255), gimp_context_get_paint_mode (NULL), PRESSURE, - incremental ? INCREMENTAL : CONSTANT); + paint_appl_mode); } } diff --git a/app/pencil.c b/app/pencil.c index 2433ce1d54..294faf6f30 100644 --- a/app/pencil.c +++ b/app/pencil.c @@ -85,7 +85,7 @@ pencil_paint_func (PaintCore *paint_core, void pencil_options_reset (void) { - paint_options_reset (pencil_options); + paint_options_reset (&pencil_options->paint_options); } Tool * @@ -119,13 +119,13 @@ tools_free_pencil (Tool *tool) static void pencil_motion (PaintCore *paint_core, GimpDrawable *drawable, - gboolean increment) + gboolean increment) { GImage *gimage; TempBuf * area; unsigned char col[MAX_CHANNELS]; gint opacity; - + PaintApplicationMode paint_appl_mode = increment ? INCREMENTAL : CONSTANT; if (! (gimage = drawable_gimage (drawable))) return; @@ -140,11 +140,11 @@ pencil_motion (PaintCore *paint_core, col[area->bytes - 1] = OPAQUE_OPACITY; - if(GIMP_IS_BRUSH_PIXMAP(paint_core->brush)) + if (GIMP_IS_BRUSH_PIXMAP (paint_core->brush)) { /* if its a pixmap, do pixmap stuff */ - color_area_with_pixmap(gimage, drawable, area, paint_core->brush); - increment = INCREMENTAL; + color_area_with_pixmap (gimage, drawable, area, paint_core->brush); + paint_appl_mode = INCREMENTAL; } else { @@ -167,7 +167,7 @@ pencil_motion (PaintCore *paint_core, paint_core_paste_canvas (paint_core, drawable, opacity, (int) (gimp_context_get_opacity (NULL) * 255), gimp_context_get_paint_mode (NULL), - HARD, increment); + HARD, paint_appl_mode); } static void * diff --git a/app/pixmapbrush.c b/app/pixmapbrush.c index 6653f9ff87..4fc7672d7b 100644 --- a/app/pixmapbrush.c +++ b/app/pixmapbrush.c @@ -218,10 +218,11 @@ pixmapbrush_motion (PaintCore *paint_core, if (! (gimage = drawable_gimage (drawable))) return; - if(!( GIMP_IS_BRUSH_HOSE(paint_core->brush))){ - g_print("not gimpbrushhose apparently...but why not i have no idea\n"); - return; - } else + if(!( GIMP_IS_BRUSH_HOSE(paint_core->brush))) + { + return; + } + else { saved_brush = paint_core->brush; /* Set paint_core->brush, restore below before returning. diff --git a/app/plug-in/gimpplugin-message.c b/app/plug-in/gimpplugin-message.c index 84174dda12..4f85f32aeb 100644 --- a/app/plug-in/gimpplugin-message.c +++ b/app/plug-in/gimpplugin-message.c @@ -1240,7 +1240,7 @@ plug_in_repeat (int with_interface) } void -plug_in_set_menu_sensitivity (int base_type) +plug_in_set_menu_sensitivity (GimpImageType type) { PlugInProcDef *proc_def; GSList *tmp; @@ -1254,7 +1254,7 @@ plug_in_set_menu_sensitivity (int base_type) if (proc_def->image_types_val && proc_def->menu_path) { - switch (base_type) + switch (type) { case -1: sensitive = FALSE; diff --git a/app/plug-in/gimpplugin-progress.c b/app/plug-in/gimpplugin-progress.c index 84174dda12..4f85f32aeb 100644 --- a/app/plug-in/gimpplugin-progress.c +++ b/app/plug-in/gimpplugin-progress.c @@ -1240,7 +1240,7 @@ plug_in_repeat (int with_interface) } void -plug_in_set_menu_sensitivity (int base_type) +plug_in_set_menu_sensitivity (GimpImageType type) { PlugInProcDef *proc_def; GSList *tmp; @@ -1254,7 +1254,7 @@ plug_in_set_menu_sensitivity (int base_type) if (proc_def->image_types_val && proc_def->menu_path) { - switch (base_type) + switch (type) { case -1: sensitive = FALSE; diff --git a/app/plug-in/gimpplugin-progress.h b/app/plug-in/gimpplugin-progress.h index c72c24f9e7..7117a8f39a 100644 --- a/app/plug-in/gimpplugin-progress.h +++ b/app/plug-in/gimpplugin-progress.h @@ -21,9 +21,10 @@ #include #include + #include "procedural_db.h" #include "gimpprogress.h" - +#include "drawable.h" #define WRITE_BUFFER_SIZE 512 @@ -44,10 +45,6 @@ typedef enum } RunModeType; -typedef struct _PlugIn PlugIn; -typedef struct _PlugInDef PlugInDef; -typedef struct _PlugInProcDef PlugInProcDef; - struct _PlugIn { unsigned int open : 1; /* Is the plug-in open */ @@ -171,9 +168,9 @@ Argument* plug_in_run (ProcRecord *proc_rec, void plug_in_repeat (int with_interface); /* Set the sensitivity for plug-in menu items based on the image - * base type. + * type. */ -void plug_in_set_menu_sensitivity (int base_type); +void plug_in_set_menu_sensitivity (GimpImageType type); /* Register an internal plug-in. This is for file load-save * handlers, which are organized around the plug-in data structure. diff --git a/app/plug-in/gimpplugin.c b/app/plug-in/gimpplugin.c index 84174dda12..4f85f32aeb 100644 --- a/app/plug-in/gimpplugin.c +++ b/app/plug-in/gimpplugin.c @@ -1240,7 +1240,7 @@ plug_in_repeat (int with_interface) } void -plug_in_set_menu_sensitivity (int base_type) +plug_in_set_menu_sensitivity (GimpImageType type) { PlugInProcDef *proc_def; GSList *tmp; @@ -1254,7 +1254,7 @@ plug_in_set_menu_sensitivity (int base_type) if (proc_def->image_types_val && proc_def->menu_path) { - switch (base_type) + switch (type) { case -1: sensitive = FALSE; diff --git a/app/plug-in/gimpplugin.h b/app/plug-in/gimpplugin.h index c72c24f9e7..7117a8f39a 100644 --- a/app/plug-in/gimpplugin.h +++ b/app/plug-in/gimpplugin.h @@ -21,9 +21,10 @@ #include #include + #include "procedural_db.h" #include "gimpprogress.h" - +#include "drawable.h" #define WRITE_BUFFER_SIZE 512 @@ -44,10 +45,6 @@ typedef enum } RunModeType; -typedef struct _PlugIn PlugIn; -typedef struct _PlugInDef PlugInDef; -typedef struct _PlugInProcDef PlugInProcDef; - struct _PlugIn { unsigned int open : 1; /* Is the plug-in open */ @@ -171,9 +168,9 @@ Argument* plug_in_run (ProcRecord *proc_rec, void plug_in_repeat (int with_interface); /* Set the sensitivity for plug-in menu items based on the image - * base type. + * type. */ -void plug_in_set_menu_sensitivity (int base_type); +void plug_in_set_menu_sensitivity (GimpImageType type); /* Register an internal plug-in. This is for file load-save * handlers, which are organized around the plug-in data structure. diff --git a/app/plug-in/gimppluginmanager-call.c b/app/plug-in/gimppluginmanager-call.c index 84174dda12..4f85f32aeb 100644 --- a/app/plug-in/gimppluginmanager-call.c +++ b/app/plug-in/gimppluginmanager-call.c @@ -1240,7 +1240,7 @@ plug_in_repeat (int with_interface) } void -plug_in_set_menu_sensitivity (int base_type) +plug_in_set_menu_sensitivity (GimpImageType type) { PlugInProcDef *proc_def; GSList *tmp; @@ -1254,7 +1254,7 @@ plug_in_set_menu_sensitivity (int base_type) if (proc_def->image_types_val && proc_def->menu_path) { - switch (base_type) + switch (type) { case -1: sensitive = FALSE; diff --git a/app/plug-in/gimppluginmanager-run.c b/app/plug-in/gimppluginmanager-run.c index 84174dda12..4f85f32aeb 100644 --- a/app/plug-in/gimppluginmanager-run.c +++ b/app/plug-in/gimppluginmanager-run.c @@ -1240,7 +1240,7 @@ plug_in_repeat (int with_interface) } void -plug_in_set_menu_sensitivity (int base_type) +plug_in_set_menu_sensitivity (GimpImageType type) { PlugInProcDef *proc_def; GSList *tmp; @@ -1254,7 +1254,7 @@ plug_in_set_menu_sensitivity (int base_type) if (proc_def->image_types_val && proc_def->menu_path) { - switch (base_type) + switch (type) { case -1: sensitive = FALSE; diff --git a/app/plug-in/gimppluginmanager.c b/app/plug-in/gimppluginmanager.c index 84174dda12..4f85f32aeb 100644 --- a/app/plug-in/gimppluginmanager.c +++ b/app/plug-in/gimppluginmanager.c @@ -1240,7 +1240,7 @@ plug_in_repeat (int with_interface) } void -plug_in_set_menu_sensitivity (int base_type) +plug_in_set_menu_sensitivity (GimpImageType type) { PlugInProcDef *proc_def; GSList *tmp; @@ -1254,7 +1254,7 @@ plug_in_set_menu_sensitivity (int base_type) if (proc_def->image_types_val && proc_def->menu_path) { - switch (base_type) + switch (type) { case -1: sensitive = FALSE; diff --git a/app/plug-in/gimppluginmanager.h b/app/plug-in/gimppluginmanager.h index c72c24f9e7..7117a8f39a 100644 --- a/app/plug-in/gimppluginmanager.h +++ b/app/plug-in/gimppluginmanager.h @@ -21,9 +21,10 @@ #include #include + #include "procedural_db.h" #include "gimpprogress.h" - +#include "drawable.h" #define WRITE_BUFFER_SIZE 512 @@ -44,10 +45,6 @@ typedef enum } RunModeType; -typedef struct _PlugIn PlugIn; -typedef struct _PlugInDef PlugInDef; -typedef struct _PlugInProcDef PlugInProcDef; - struct _PlugIn { unsigned int open : 1; /* Is the plug-in open */ @@ -171,9 +168,9 @@ Argument* plug_in_run (ProcRecord *proc_rec, void plug_in_repeat (int with_interface); /* Set the sensitivity for plug-in menu items based on the image - * base type. + * type. */ -void plug_in_set_menu_sensitivity (int base_type); +void plug_in_set_menu_sensitivity (GimpImageType type); /* Register an internal plug-in. This is for file load-save * handlers, which are organized around the plug-in data structure. diff --git a/app/plug-in/gimppluginshm.c b/app/plug-in/gimppluginshm.c index 84174dda12..4f85f32aeb 100644 --- a/app/plug-in/gimppluginshm.c +++ b/app/plug-in/gimppluginshm.c @@ -1240,7 +1240,7 @@ plug_in_repeat (int with_interface) } void -plug_in_set_menu_sensitivity (int base_type) +plug_in_set_menu_sensitivity (GimpImageType type) { PlugInProcDef *proc_def; GSList *tmp; @@ -1254,7 +1254,7 @@ plug_in_set_menu_sensitivity (int base_type) if (proc_def->image_types_val && proc_def->menu_path) { - switch (base_type) + switch (type) { case -1: sensitive = FALSE; diff --git a/app/plug-in/plug-in-def.c b/app/plug-in/plug-in-def.c index 84174dda12..4f85f32aeb 100644 --- a/app/plug-in/plug-in-def.c +++ b/app/plug-in/plug-in-def.c @@ -1240,7 +1240,7 @@ plug_in_repeat (int with_interface) } void -plug_in_set_menu_sensitivity (int base_type) +plug_in_set_menu_sensitivity (GimpImageType type) { PlugInProcDef *proc_def; GSList *tmp; @@ -1254,7 +1254,7 @@ plug_in_set_menu_sensitivity (int base_type) if (proc_def->image_types_val && proc_def->menu_path) { - switch (base_type) + switch (type) { case -1: sensitive = FALSE; diff --git a/app/plug-in/plug-in-def.h b/app/plug-in/plug-in-def.h index c72c24f9e7..7117a8f39a 100644 --- a/app/plug-in/plug-in-def.h +++ b/app/plug-in/plug-in-def.h @@ -21,9 +21,10 @@ #include #include + #include "procedural_db.h" #include "gimpprogress.h" - +#include "drawable.h" #define WRITE_BUFFER_SIZE 512 @@ -44,10 +45,6 @@ typedef enum } RunModeType; -typedef struct _PlugIn PlugIn; -typedef struct _PlugInDef PlugInDef; -typedef struct _PlugInProcDef PlugInProcDef; - struct _PlugIn { unsigned int open : 1; /* Is the plug-in open */ @@ -171,9 +168,9 @@ Argument* plug_in_run (ProcRecord *proc_rec, void plug_in_repeat (int with_interface); /* Set the sensitivity for plug-in menu items based on the image - * base type. + * type. */ -void plug_in_set_menu_sensitivity (int base_type); +void plug_in_set_menu_sensitivity (GimpImageType type); /* Register an internal plug-in. This is for file load-save * handlers, which are organized around the plug-in data structure. diff --git a/app/plug-in/plug-in-message.c b/app/plug-in/plug-in-message.c index 84174dda12..4f85f32aeb 100644 --- a/app/plug-in/plug-in-message.c +++ b/app/plug-in/plug-in-message.c @@ -1240,7 +1240,7 @@ plug_in_repeat (int with_interface) } void -plug_in_set_menu_sensitivity (int base_type) +plug_in_set_menu_sensitivity (GimpImageType type) { PlugInProcDef *proc_def; GSList *tmp; @@ -1254,7 +1254,7 @@ plug_in_set_menu_sensitivity (int base_type) if (proc_def->image_types_val && proc_def->menu_path) { - switch (base_type) + switch (type) { case -1: sensitive = FALSE; diff --git a/app/plug-in/plug-in-params.c b/app/plug-in/plug-in-params.c index 84174dda12..4f85f32aeb 100644 --- a/app/plug-in/plug-in-params.c +++ b/app/plug-in/plug-in-params.c @@ -1240,7 +1240,7 @@ plug_in_repeat (int with_interface) } void -plug_in_set_menu_sensitivity (int base_type) +plug_in_set_menu_sensitivity (GimpImageType type) { PlugInProcDef *proc_def; GSList *tmp; @@ -1254,7 +1254,7 @@ plug_in_set_menu_sensitivity (int base_type) if (proc_def->image_types_val && proc_def->menu_path) { - switch (base_type) + switch (type) { case -1: sensitive = FALSE; diff --git a/app/plug-in/plug-in-params.h b/app/plug-in/plug-in-params.h index c72c24f9e7..7117a8f39a 100644 --- a/app/plug-in/plug-in-params.h +++ b/app/plug-in/plug-in-params.h @@ -21,9 +21,10 @@ #include #include + #include "procedural_db.h" #include "gimpprogress.h" - +#include "drawable.h" #define WRITE_BUFFER_SIZE 512 @@ -44,10 +45,6 @@ typedef enum } RunModeType; -typedef struct _PlugIn PlugIn; -typedef struct _PlugInDef PlugInDef; -typedef struct _PlugInProcDef PlugInProcDef; - struct _PlugIn { unsigned int open : 1; /* Is the plug-in open */ @@ -171,9 +168,9 @@ Argument* plug_in_run (ProcRecord *proc_rec, void plug_in_repeat (int with_interface); /* Set the sensitivity for plug-in menu items based on the image - * base type. + * type. */ -void plug_in_set_menu_sensitivity (int base_type); +void plug_in_set_menu_sensitivity (GimpImageType type); /* Register an internal plug-in. This is for file load-save * handlers, which are organized around the plug-in data structure. diff --git a/app/plug-in/plug-in-progress.c b/app/plug-in/plug-in-progress.c index 84174dda12..4f85f32aeb 100644 --- a/app/plug-in/plug-in-progress.c +++ b/app/plug-in/plug-in-progress.c @@ -1240,7 +1240,7 @@ plug_in_repeat (int with_interface) } void -plug_in_set_menu_sensitivity (int base_type) +plug_in_set_menu_sensitivity (GimpImageType type) { PlugInProcDef *proc_def; GSList *tmp; @@ -1254,7 +1254,7 @@ plug_in_set_menu_sensitivity (int base_type) if (proc_def->image_types_val && proc_def->menu_path) { - switch (base_type) + switch (type) { case -1: sensitive = FALSE; diff --git a/app/plug-in/plug-in-progress.h b/app/plug-in/plug-in-progress.h index c72c24f9e7..7117a8f39a 100644 --- a/app/plug-in/plug-in-progress.h +++ b/app/plug-in/plug-in-progress.h @@ -21,9 +21,10 @@ #include #include + #include "procedural_db.h" #include "gimpprogress.h" - +#include "drawable.h" #define WRITE_BUFFER_SIZE 512 @@ -44,10 +45,6 @@ typedef enum } RunModeType; -typedef struct _PlugIn PlugIn; -typedef struct _PlugInDef PlugInDef; -typedef struct _PlugInProcDef PlugInProcDef; - struct _PlugIn { unsigned int open : 1; /* Is the plug-in open */ @@ -171,9 +168,9 @@ Argument* plug_in_run (ProcRecord *proc_rec, void plug_in_repeat (int with_interface); /* Set the sensitivity for plug-in menu items based on the image - * base type. + * type. */ -void plug_in_set_menu_sensitivity (int base_type); +void plug_in_set_menu_sensitivity (GimpImageType type); /* Register an internal plug-in. This is for file load-save * handlers, which are organized around the plug-in data structure. diff --git a/app/plug-in/plug-in-run.c b/app/plug-in/plug-in-run.c index 84174dda12..4f85f32aeb 100644 --- a/app/plug-in/plug-in-run.c +++ b/app/plug-in/plug-in-run.c @@ -1240,7 +1240,7 @@ plug_in_repeat (int with_interface) } void -plug_in_set_menu_sensitivity (int base_type) +plug_in_set_menu_sensitivity (GimpImageType type) { PlugInProcDef *proc_def; GSList *tmp; @@ -1254,7 +1254,7 @@ plug_in_set_menu_sensitivity (int base_type) if (proc_def->image_types_val && proc_def->menu_path) { - switch (base_type) + switch (type) { case -1: sensitive = FALSE; diff --git a/app/plug-in/plug-in-shm.c b/app/plug-in/plug-in-shm.c index 84174dda12..4f85f32aeb 100644 --- a/app/plug-in/plug-in-shm.c +++ b/app/plug-in/plug-in-shm.c @@ -1240,7 +1240,7 @@ plug_in_repeat (int with_interface) } void -plug_in_set_menu_sensitivity (int base_type) +plug_in_set_menu_sensitivity (GimpImageType type) { PlugInProcDef *proc_def; GSList *tmp; @@ -1254,7 +1254,7 @@ plug_in_set_menu_sensitivity (int base_type) if (proc_def->image_types_val && proc_def->menu_path) { - switch (base_type) + switch (type) { case -1: sensitive = FALSE; diff --git a/app/plug-in/plug-in.c b/app/plug-in/plug-in.c index 84174dda12..4f85f32aeb 100644 --- a/app/plug-in/plug-in.c +++ b/app/plug-in/plug-in.c @@ -1240,7 +1240,7 @@ plug_in_repeat (int with_interface) } void -plug_in_set_menu_sensitivity (int base_type) +plug_in_set_menu_sensitivity (GimpImageType type) { PlugInProcDef *proc_def; GSList *tmp; @@ -1254,7 +1254,7 @@ plug_in_set_menu_sensitivity (int base_type) if (proc_def->image_types_val && proc_def->menu_path) { - switch (base_type) + switch (type) { case -1: sensitive = FALSE; diff --git a/app/plug-in/plug-in.h b/app/plug-in/plug-in.h index c72c24f9e7..7117a8f39a 100644 --- a/app/plug-in/plug-in.h +++ b/app/plug-in/plug-in.h @@ -21,9 +21,10 @@ #include #include + #include "procedural_db.h" #include "gimpprogress.h" - +#include "drawable.h" #define WRITE_BUFFER_SIZE 512 @@ -44,10 +45,6 @@ typedef enum } RunModeType; -typedef struct _PlugIn PlugIn; -typedef struct _PlugInDef PlugInDef; -typedef struct _PlugInProcDef PlugInProcDef; - struct _PlugIn { unsigned int open : 1; /* Is the plug-in open */ @@ -171,9 +168,9 @@ Argument* plug_in_run (ProcRecord *proc_rec, void plug_in_repeat (int with_interface); /* Set the sensitivity for plug-in menu items based on the image - * base type. + * type. */ -void plug_in_set_menu_sensitivity (int base_type); +void plug_in_set_menu_sensitivity (GimpImageType type); /* Register an internal plug-in. This is for file load-save * handlers, which are organized around the plug-in data structure. diff --git a/app/plug-in/plug-ins.c b/app/plug-in/plug-ins.c index 84174dda12..4f85f32aeb 100644 --- a/app/plug-in/plug-ins.c +++ b/app/plug-in/plug-ins.c @@ -1240,7 +1240,7 @@ plug_in_repeat (int with_interface) } void -plug_in_set_menu_sensitivity (int base_type) +plug_in_set_menu_sensitivity (GimpImageType type) { PlugInProcDef *proc_def; GSList *tmp; @@ -1254,7 +1254,7 @@ plug_in_set_menu_sensitivity (int base_type) if (proc_def->image_types_val && proc_def->menu_path) { - switch (base_type) + switch (type) { case -1: sensitive = FALSE; diff --git a/app/plug-in/plug-ins.h b/app/plug-in/plug-ins.h index c72c24f9e7..7117a8f39a 100644 --- a/app/plug-in/plug-ins.h +++ b/app/plug-in/plug-ins.h @@ -21,9 +21,10 @@ #include #include + #include "procedural_db.h" #include "gimpprogress.h" - +#include "drawable.h" #define WRITE_BUFFER_SIZE 512 @@ -44,10 +45,6 @@ typedef enum } RunModeType; -typedef struct _PlugIn PlugIn; -typedef struct _PlugInDef PlugInDef; -typedef struct _PlugInProcDef PlugInProcDef; - struct _PlugIn { unsigned int open : 1; /* Is the plug-in open */ @@ -171,9 +168,9 @@ Argument* plug_in_run (ProcRecord *proc_rec, void plug_in_repeat (int with_interface); /* Set the sensitivity for plug-in menu items based on the image - * base type. + * type. */ -void plug_in_set_menu_sensitivity (int base_type); +void plug_in_set_menu_sensitivity (GimpImageType type); /* Register an internal plug-in. This is for file load-save * handlers, which are organized around the plug-in data structure. diff --git a/app/plug_in.c b/app/plug_in.c index 84174dda12..4f85f32aeb 100644 --- a/app/plug_in.c +++ b/app/plug_in.c @@ -1240,7 +1240,7 @@ plug_in_repeat (int with_interface) } void -plug_in_set_menu_sensitivity (int base_type) +plug_in_set_menu_sensitivity (GimpImageType type) { PlugInProcDef *proc_def; GSList *tmp; @@ -1254,7 +1254,7 @@ plug_in_set_menu_sensitivity (int base_type) if (proc_def->image_types_val && proc_def->menu_path) { - switch (base_type) + switch (type) { case -1: sensitive = FALSE; diff --git a/app/plug_in.h b/app/plug_in.h index c72c24f9e7..7117a8f39a 100644 --- a/app/plug_in.h +++ b/app/plug_in.h @@ -21,9 +21,10 @@ #include #include + #include "procedural_db.h" #include "gimpprogress.h" - +#include "drawable.h" #define WRITE_BUFFER_SIZE 512 @@ -44,10 +45,6 @@ typedef enum } RunModeType; -typedef struct _PlugIn PlugIn; -typedef struct _PlugInDef PlugInDef; -typedef struct _PlugInProcDef PlugInProcDef; - struct _PlugIn { unsigned int open : 1; /* Is the plug-in open */ @@ -171,9 +168,9 @@ Argument* plug_in_run (ProcRecord *proc_rec, void plug_in_repeat (int with_interface); /* Set the sensitivity for plug-in menu items based on the image - * base type. + * type. */ -void plug_in_set_menu_sensitivity (int base_type); +void plug_in_set_menu_sensitivity (GimpImageType type); /* Register an internal plug-in. This is for file load-save * handlers, which are organized around the plug-in data structure. diff --git a/app/tools/airbrush.c b/app/tools/airbrush.c index a2db2f578e..52704792bc 100644 --- a/app/tools/airbrush.c +++ b/app/tools/airbrush.c @@ -86,7 +86,7 @@ static double non_gui_pressure; static gboolean non_gui_incremental; /* forward function declarations */ -static void airbrush_motion (PaintCore *, GimpDrawable *, double, gboolean); +static void airbrush_motion (PaintCore *, GimpDrawable *, double, PaintApplicationMode); static gint airbrush_time_out (gpointer); @@ -235,7 +235,8 @@ airbrush_paint_func (PaintCore *paint_core, gtk_timeout_remove (timer); timer_state = OFF; - airbrush_motion (paint_core, drawable, airbrush_options->pressure, airbrush_options->incremental); + airbrush_motion (paint_core, drawable, airbrush_options->pressure, + airbrush_options->incremental ? INCREMENTAL : CONSTANT); if (airbrush_options->rate != 0.0) { @@ -279,7 +280,7 @@ airbrush_time_out (gpointer client_data) airbrush_motion (airbrush_timeout.paint_core, airbrush_timeout.drawable, airbrush_options->pressure, - airbrush_options->incremental); + airbrush_options->incremental ? INCREMENTAL : CONSTANT); gdisplays_flush (); /* restart the timer */ @@ -291,10 +292,10 @@ airbrush_time_out (gpointer client_data) static void -airbrush_motion (PaintCore *paint_core, - GimpDrawable *drawable, - double pressure, - gboolean mode) +airbrush_motion (PaintCore *paint_core, + GimpDrawable *drawable, + double pressure, + PaintApplicationMode mode) { gint opacity; GImage *gimage; @@ -316,9 +317,9 @@ airbrush_motion (PaintCore *paint_core, col[area->bytes - 1] = OPAQUE_OPACITY; - if(GIMP_IS_BRUSH_PIXMAP(paint_core->brush)) + if (GIMP_IS_BRUSH_PIXMAP (paint_core->brush)) { - color_area_with_pixmap(gimage, drawable, area, paint_core->brush); + color_area_with_pixmap (gimage, drawable, area, paint_core->brush); mode = INCREMENTAL; } else diff --git a/app/tools/color_picker.c b/app/tools/color_picker.c index c6c4d127a7..8ff7f08212 100644 --- a/app/tools/color_picker.c +++ b/app/tools/color_picker.c @@ -70,7 +70,7 @@ gint col_value[5] = { 0, 0, 0, 0, 0 }; /* the color picker dialog */ static gint update_type; -static gint sample_type; +static GimpImageType sample_type; static InfoDialog * color_picker_info = NULL; static gchar red_buf [MAX_INFO_BUF]; static gchar green_buf [MAX_INFO_BUF]; diff --git a/app/tools/convolve.c b/app/tools/convolve.c index a4c11ff8b6..52ebf40ff5 100644 --- a/app/tools/convolve.c +++ b/app/tools/convolve.c @@ -337,7 +337,7 @@ convolve_motion (PaintCore *paint_core, /* Convolve the region */ convolve_region (&tempPR, &destPR, matrix, matrix_size, - matrix_divisor, NORMAL); + matrix_divisor, NORMAL_CONVOL); if (drawable_has_alpha (drawable)) separate_alpha_region (&destPR); diff --git a/app/tools/gimpairbrushtool.c b/app/tools/gimpairbrushtool.c index a2db2f578e..52704792bc 100644 --- a/app/tools/gimpairbrushtool.c +++ b/app/tools/gimpairbrushtool.c @@ -86,7 +86,7 @@ static double non_gui_pressure; static gboolean non_gui_incremental; /* forward function declarations */ -static void airbrush_motion (PaintCore *, GimpDrawable *, double, gboolean); +static void airbrush_motion (PaintCore *, GimpDrawable *, double, PaintApplicationMode); static gint airbrush_time_out (gpointer); @@ -235,7 +235,8 @@ airbrush_paint_func (PaintCore *paint_core, gtk_timeout_remove (timer); timer_state = OFF; - airbrush_motion (paint_core, drawable, airbrush_options->pressure, airbrush_options->incremental); + airbrush_motion (paint_core, drawable, airbrush_options->pressure, + airbrush_options->incremental ? INCREMENTAL : CONSTANT); if (airbrush_options->rate != 0.0) { @@ -279,7 +280,7 @@ airbrush_time_out (gpointer client_data) airbrush_motion (airbrush_timeout.paint_core, airbrush_timeout.drawable, airbrush_options->pressure, - airbrush_options->incremental); + airbrush_options->incremental ? INCREMENTAL : CONSTANT); gdisplays_flush (); /* restart the timer */ @@ -291,10 +292,10 @@ airbrush_time_out (gpointer client_data) static void -airbrush_motion (PaintCore *paint_core, - GimpDrawable *drawable, - double pressure, - gboolean mode) +airbrush_motion (PaintCore *paint_core, + GimpDrawable *drawable, + double pressure, + PaintApplicationMode mode) { gint opacity; GImage *gimage; @@ -316,9 +317,9 @@ airbrush_motion (PaintCore *paint_core, col[area->bytes - 1] = OPAQUE_OPACITY; - if(GIMP_IS_BRUSH_PIXMAP(paint_core->brush)) + if (GIMP_IS_BRUSH_PIXMAP (paint_core->brush)) { - color_area_with_pixmap(gimage, drawable, area, paint_core->brush); + color_area_with_pixmap (gimage, drawable, area, paint_core->brush); mode = INCREMENTAL; } else diff --git a/app/tools/gimpconvolvetool.c b/app/tools/gimpconvolvetool.c index a4c11ff8b6..52ebf40ff5 100644 --- a/app/tools/gimpconvolvetool.c +++ b/app/tools/gimpconvolvetool.c @@ -337,7 +337,7 @@ convolve_motion (PaintCore *paint_core, /* Convolve the region */ convolve_region (&tempPR, &destPR, matrix, matrix_size, - matrix_divisor, NORMAL); + matrix_divisor, NORMAL_CONVOL); if (drawable_has_alpha (drawable)) separate_alpha_region (&destPR); diff --git a/app/tools/gimpiscissorstool.c b/app/tools/gimpiscissorstool.c index 97f755fc03..c0c1e564d2 100644 --- a/app/tools/gimpiscissorstool.c +++ b/app/tools/gimpiscissorstool.c @@ -1680,7 +1680,7 @@ gradmap_tile_validate (TileManager *tm, Tile *tile) /* Blur the source to get rid of noise */ destPR.rowstride = TILE_WIDTH * 4; destPR.data = maxgrad_conv0; - convolve_region (&srcPR, &destPR, blur_32, 3, 32, NORMAL); + convolve_region (&srcPR, &destPR, blur_32, 3, 32, NORMAL_CONVOL); /* Set the "src" temp buf up as the new source Pixel Region */ srcPR.rowstride = destPR.rowstride; @@ -1688,11 +1688,11 @@ gradmap_tile_validate (TileManager *tm, Tile *tile) /* Get the horizontal derivative */ destPR.data = maxgrad_conv1; - convolve_region (&srcPR, &destPR, horz_deriv, 3, 1, NEGATIVE); + convolve_region (&srcPR, &destPR, horz_deriv, 3, 1, NEGATIVE_CONVOL); /* Get the vertical derivative */ destPR.data = maxgrad_conv2; - convolve_region (&srcPR, &destPR, vert_deriv, 3, 1, NEGATIVE); + convolve_region (&srcPR, &destPR, vert_deriv, 3, 1, NEGATIVE_CONVOL); /* calculate overall gradient */ tiledata = tile_data_pointer (tile, 0, 0); diff --git a/app/tools/gimppenciltool.c b/app/tools/gimppenciltool.c index 2433ce1d54..294faf6f30 100644 --- a/app/tools/gimppenciltool.c +++ b/app/tools/gimppenciltool.c @@ -85,7 +85,7 @@ pencil_paint_func (PaintCore *paint_core, void pencil_options_reset (void) { - paint_options_reset (pencil_options); + paint_options_reset (&pencil_options->paint_options); } Tool * @@ -119,13 +119,13 @@ tools_free_pencil (Tool *tool) static void pencil_motion (PaintCore *paint_core, GimpDrawable *drawable, - gboolean increment) + gboolean increment) { GImage *gimage; TempBuf * area; unsigned char col[MAX_CHANNELS]; gint opacity; - + PaintApplicationMode paint_appl_mode = increment ? INCREMENTAL : CONSTANT; if (! (gimage = drawable_gimage (drawable))) return; @@ -140,11 +140,11 @@ pencil_motion (PaintCore *paint_core, col[area->bytes - 1] = OPAQUE_OPACITY; - if(GIMP_IS_BRUSH_PIXMAP(paint_core->brush)) + if (GIMP_IS_BRUSH_PIXMAP (paint_core->brush)) { /* if its a pixmap, do pixmap stuff */ - color_area_with_pixmap(gimage, drawable, area, paint_core->brush); - increment = INCREMENTAL; + color_area_with_pixmap (gimage, drawable, area, paint_core->brush); + paint_appl_mode = INCREMENTAL; } else { @@ -167,7 +167,7 @@ pencil_motion (PaintCore *paint_core, paint_core_paste_canvas (paint_core, drawable, opacity, (int) (gimp_context_get_opacity (NULL) * 255), gimp_context_get_paint_mode (NULL), - HARD, increment); + HARD, paint_appl_mode); } static void * diff --git a/app/tools/iscissors.c b/app/tools/iscissors.c index 97f755fc03..c0c1e564d2 100644 --- a/app/tools/iscissors.c +++ b/app/tools/iscissors.c @@ -1680,7 +1680,7 @@ gradmap_tile_validate (TileManager *tm, Tile *tile) /* Blur the source to get rid of noise */ destPR.rowstride = TILE_WIDTH * 4; destPR.data = maxgrad_conv0; - convolve_region (&srcPR, &destPR, blur_32, 3, 32, NORMAL); + convolve_region (&srcPR, &destPR, blur_32, 3, 32, NORMAL_CONVOL); /* Set the "src" temp buf up as the new source Pixel Region */ srcPR.rowstride = destPR.rowstride; @@ -1688,11 +1688,11 @@ gradmap_tile_validate (TileManager *tm, Tile *tile) /* Get the horizontal derivative */ destPR.data = maxgrad_conv1; - convolve_region (&srcPR, &destPR, horz_deriv, 3, 1, NEGATIVE); + convolve_region (&srcPR, &destPR, horz_deriv, 3, 1, NEGATIVE_CONVOL); /* Get the vertical derivative */ destPR.data = maxgrad_conv2; - convolve_region (&srcPR, &destPR, vert_deriv, 3, 1, NEGATIVE); + convolve_region (&srcPR, &destPR, vert_deriv, 3, 1, NEGATIVE_CONVOL); /* calculate overall gradient */ tiledata = tile_data_pointer (tile, 0, 0); diff --git a/app/tools/paint_core.c b/app/tools/paint_core.c index 5335d6c466..60f0eb17ec 100644 --- a/app/tools/paint_core.c +++ b/app/tools/paint_core.c @@ -52,11 +52,14 @@ PaintCore non_gui_paint_core; static MaskBuf * paint_core_subsample_mask (MaskBuf *, double, double); static MaskBuf * paint_core_pressurize_mask (MaskBuf *, double, double, double); static MaskBuf * paint_core_solidify_mask (MaskBuf *); -static MaskBuf * paint_core_get_brush_mask (PaintCore *, int); +static MaskBuf * paint_core_get_brush_mask (PaintCore *, BrushApplicationMode); static void paint_core_paste (PaintCore *, MaskBuf *, - GimpDrawable *, int, int, int, int); + GimpDrawable *, int, int, + LayerModeEffects, + PaintApplicationMode); static void paint_core_replace (PaintCore *, MaskBuf *, - GimpDrawable *, int, int, int); + GimpDrawable *, int, int, + PaintApplicationMode); static void brush_to_canvas_tiles (PaintCore *, MaskBuf *, int); static void canvas_tiles_to_canvas_buf (PaintCore *); static void brush_to_canvas_buf (PaintCore *, MaskBuf *, int); @@ -941,13 +944,13 @@ paint_core_get_orig_image (PaintCore *paint_core, } void -paint_core_paste_canvas (PaintCore *paint_core, - GimpDrawable *drawable, - int brush_opacity, - int image_opacity, - int paint_mode, - int brush_hardness, - int mode) +paint_core_paste_canvas (PaintCore *paint_core, + GimpDrawable *drawable, + int brush_opacity, + int image_opacity, + LayerModeEffects paint_mode, + BrushApplicationMode brush_hardness, + PaintApplicationMode mode) { MaskBuf *brush_mask; @@ -963,12 +966,12 @@ paint_core_paste_canvas (PaintCore *paint_core, rather than using it to composite (i.e. transparent over opaque becomes transparent rather than opauqe. */ void -paint_core_replace_canvas (PaintCore *paint_core, - GimpDrawable *drawable, - int brush_opacity, - int image_opacity, - int brush_hardness, - int mode) +paint_core_replace_canvas (PaintCore *paint_core, + GimpDrawable *drawable, + int brush_opacity, + int image_opacity, + BrushApplicationMode brush_hardness, + PaintApplicationMode mode) { MaskBuf *brush_mask; @@ -1203,8 +1206,8 @@ paint_core_solidify_mask (MaskBuf *brush_mask) } static MaskBuf * -paint_core_get_brush_mask (PaintCore *paint_core, - int brush_hardness) +paint_core_get_brush_mask (PaintCore *paint_core, + BrushApplicationMode brush_hardness) { MaskBuf * bm; @@ -1228,13 +1231,13 @@ paint_core_get_brush_mask (PaintCore *paint_core, } static void -paint_core_paste (PaintCore *paint_core, - MaskBuf *brush_mask, - GimpDrawable *drawable, - int brush_opacity, - int image_opacity, - int paint_mode, - int mode) +paint_core_paste (PaintCore *paint_core, + MaskBuf *brush_mask, + GimpDrawable *drawable, + int brush_opacity, + int image_opacity, + LayerModeEffects paint_mode, + PaintApplicationMode mode) { GImage *gimage; PixelRegion srcPR; @@ -1306,12 +1309,12 @@ paint_core_paste (PaintCore *paint_core, mode. */ static void -paint_core_replace (PaintCore *paint_core, - MaskBuf *brush_mask, - GimpDrawable *drawable, - int brush_opacity, - int image_opacity, - int mode) +paint_core_replace (PaintCore *paint_core, + MaskBuf *brush_mask, + GimpDrawable *drawable, + int brush_opacity, + int image_opacity, + PaintApplicationMode mode) { GImage *gimage; PixelRegion srcPR, maskPR; diff --git a/app/tools/paint_core.h b/app/tools/paint_core.h index 8b8e650f2b..5ec84006e4 100644 --- a/app/tools/paint_core.h +++ b/app/tools/paint_core.h @@ -18,6 +18,7 @@ #ifndef __PAINT_CORE_H__ #define __PAINT_CORE_H__ +#include "apptypes.h" #include "draw_core.h" #include "temp_buf.h" #include "gimpbrush.h" @@ -30,21 +31,6 @@ #define RESUME_PAINT 3 #define FINISH_PAINT 4 -/* brush application types */ -typedef enum -{ - HARD, /* pencil */ - SOFT, /* paintbrush */ - PRESSURE /* paintbrush with variable pressure */ -} BrushApplicationMode; - -/* paint application modes */ -typedef enum -{ - CONSTANT, /*< nick=CONTINUOUS >*/ /* pencil, paintbrush, airbrush, clone */ - INCREMENTAL /* convolve, smudge */ -} PaintApplicationMode; - /* gradient paint modes */ typedef enum { ONCE_FORWARD, /* paint through once, then stop */ @@ -127,9 +113,19 @@ void paint_core_finish (PaintCore *, GimpDrawable *, int); void paint_core_cleanup (void); /* paint tool painting functions */ -TempBuf * paint_core_get_paint_area (PaintCore *, GimpDrawable *); -TempBuf * paint_core_get_orig_image (PaintCore *, GimpDrawable *, int, int, int, int); -void paint_core_paste_canvas (PaintCore *, GimpDrawable *, int, int, int, int, int); -void paint_core_replace_canvas (PaintCore *, GimpDrawable *, int, int, int, int); +TempBuf * paint_core_get_paint_area (PaintCore *, + GimpDrawable *); +TempBuf * paint_core_get_orig_image (PaintCore *, + GimpDrawable *, + int, int, int, int); +void paint_core_paste_canvas (PaintCore *, + GimpDrawable *, int, int, + LayerModeEffects, + BrushApplicationMode, + PaintApplicationMode); +void paint_core_replace_canvas (PaintCore *, + GimpDrawable *, int, int, + BrushApplicationMode, + PaintApplicationMode); #endif /* __PAINT_CORE_H__ */ diff --git a/app/tools/paintbrush.c b/app/tools/paintbrush.c index 6a792514f1..ff9583ad83 100644 --- a/app/tools/paintbrush.c +++ b/app/tools/paintbrush.c @@ -394,6 +394,7 @@ paintbrush_motion (PaintCore *paint_core, unsigned char col[MAX_CHANNELS]; double r,g,b,a; int mode; + PaintApplicationMode paint_appl_mode = incremental ? INCREMENTAL : CONSTANT; position = 0.0; if (! (gimage = drawable_gimage (drawable))) @@ -443,7 +444,7 @@ paintbrush_motion (PaintCore *paint_core, col[2] = (gint)b; /* always use incremental mode with gradients */ /* make the gui cool later */ - incremental = INCREMENTAL; + paint_appl_mode = INCREMENTAL; } /* just leave this because I know as soon as i delete it i'll find a bug */ /* printf("temp_blend: %u grad_len: %f distance: %f \n",temp_blend, gradient_length, distance); */ @@ -453,10 +454,10 @@ paintbrush_motion (PaintCore *paint_core, /* we check to see if this is a pixmap, if so composite the pixmap image into the are instead of the color */ - if(GIMP_IS_BRUSH_PIXMAP(paint_core->brush) && !gradient_length) + if (GIMP_IS_BRUSH_PIXMAP (paint_core->brush) && !gradient_length) { color_area_with_pixmap(gimage, drawable, area, paint_core->brush); - incremental = INCREMENTAL; + paint_appl_mode = INCREMENTAL; } else { @@ -470,7 +471,7 @@ paintbrush_motion (PaintCore *paint_core, (int) (gimp_context_get_opacity (NULL) * 255), gimp_context_get_paint_mode (NULL), PRESSURE, - incremental ? INCREMENTAL : CONSTANT); + paint_appl_mode); } } diff --git a/app/tools/pencil.c b/app/tools/pencil.c index 2433ce1d54..294faf6f30 100644 --- a/app/tools/pencil.c +++ b/app/tools/pencil.c @@ -85,7 +85,7 @@ pencil_paint_func (PaintCore *paint_core, void pencil_options_reset (void) { - paint_options_reset (pencil_options); + paint_options_reset (&pencil_options->paint_options); } Tool * @@ -119,13 +119,13 @@ tools_free_pencil (Tool *tool) static void pencil_motion (PaintCore *paint_core, GimpDrawable *drawable, - gboolean increment) + gboolean increment) { GImage *gimage; TempBuf * area; unsigned char col[MAX_CHANNELS]; gint opacity; - + PaintApplicationMode paint_appl_mode = increment ? INCREMENTAL : CONSTANT; if (! (gimage = drawable_gimage (drawable))) return; @@ -140,11 +140,11 @@ pencil_motion (PaintCore *paint_core, col[area->bytes - 1] = OPAQUE_OPACITY; - if(GIMP_IS_BRUSH_PIXMAP(paint_core->brush)) + if (GIMP_IS_BRUSH_PIXMAP (paint_core->brush)) { /* if its a pixmap, do pixmap stuff */ - color_area_with_pixmap(gimage, drawable, area, paint_core->brush); - increment = INCREMENTAL; + color_area_with_pixmap (gimage, drawable, area, paint_core->brush); + paint_appl_mode = INCREMENTAL; } else { @@ -167,7 +167,7 @@ pencil_motion (PaintCore *paint_core, paint_core_paste_canvas (paint_core, drawable, opacity, (int) (gimp_context_get_opacity (NULL) * 255), gimp_context_get_paint_mode (NULL), - HARD, increment); + HARD, paint_appl_mode); } static void * diff --git a/app/widgets/gimpdeviceinfo.c b/app/widgets/gimpdeviceinfo.c index 3817cd8ab7..712dd24144 100644 --- a/app/widgets/gimpdeviceinfo.c +++ b/app/widgets/gimpdeviceinfo.c @@ -1205,7 +1205,7 @@ device_update_brush (GimpBrushP brush, { offset_x = CELL_SIZE - brush_scale_indicator_width - 1; gtk_preview_draw_row (GTK_PREVIEW (deviceD->brushes[preview_id]), - brush_scale_indicator_bits[i], + brush_scale_indicator_bits[i][0], offset_x, offset_y + i, brush_scale_indicator_width); } diff --git a/app/widgets/gimpdevices.c b/app/widgets/gimpdevices.c index 3817cd8ab7..712dd24144 100644 --- a/app/widgets/gimpdevices.c +++ b/app/widgets/gimpdevices.c @@ -1205,7 +1205,7 @@ device_update_brush (GimpBrushP brush, { offset_x = CELL_SIZE - brush_scale_indicator_width - 1; gtk_preview_draw_row (GTK_PREVIEW (deviceD->brushes[preview_id]), - brush_scale_indicator_bits[i], + brush_scale_indicator_bits[i][0], offset_x, offset_y + i, brush_scale_indicator_width); } diff --git a/app/widgets/gimptoolbox-indicator-area.c b/app/widgets/gimptoolbox-indicator-area.c index b2c3d78460..ac1502cce7 100644 --- a/app/widgets/gimptoolbox-indicator-area.c +++ b/app/widgets/gimptoolbox-indicator-area.c @@ -191,7 +191,7 @@ brush_area_update () { offset_x = CELL_SIZE - brush_scale_indicator_width - 1; gtk_preview_draw_row (GTK_PREVIEW (brush_preview), - brush_scale_indicator_bits[i], + brush_scale_indicator_bits[i][0], offset_x, offset_y + i, brush_scale_indicator_width); }