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.)
This commit is contained in:
Tor Lillqvist 1999-08-18 23:41:39 +00:00
parent 088a9d7131
commit f6858e21d1
133 changed files with 1250 additions and 1333 deletions

View file

@ -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;

View file

@ -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

143
app/apptypes.h Normal file
View file

@ -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__ */

View file

@ -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);
}

View file

@ -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 */

View file

@ -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];

View file

@ -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;

View file

@ -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;

View file

@ -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);

View file

@ -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);

View file

@ -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 */

View file

@ -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 */

View file

@ -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);

View file

@ -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);

View file

@ -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;
}

View file

@ -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 *);

View file

@ -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);

View file

@ -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;

View file

@ -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;

View file

@ -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);

View file

@ -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);

View file

@ -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;

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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;

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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;

View file

@ -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);
}

View file

@ -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)
{

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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

View file

@ -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);

View file

@ -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);
}

View file

@ -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)
{

View file

@ -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;

View file

@ -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;

View file

@ -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();

View file

@ -216,6 +216,5 @@ gimp_brush_pixmap_load (char *file_name)
/* Clean up */
fclose (fp);
return GIMP_BRUSH(brush);
return brush;
}

View file

@ -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 */

View file

@ -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);

View file

@ -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);

View file

@ -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;
}

View file

@ -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 *);

View file

@ -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__ */

View file

@ -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;

View file

@ -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;

View file

@ -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);

View file

@ -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);

View file

@ -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 & */

View file

@ -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;

View file

@ -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);

View file

@ -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);

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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)
{

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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;

View file

@ -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;

View file

@ -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);
}

View file

@ -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);

View file

@ -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;

View file

@ -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);

View file

@ -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

View file

@ -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);

View file

@ -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

View file

@ -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

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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__ */

View file

@ -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

View file

@ -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);

View file

@ -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 *

View file

@ -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;

View file

@ -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__ */

View file

@ -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;

View file

@ -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__ */

View file

@ -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);
}
}

View file

@ -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 *

View file

@ -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.

View file

@ -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;

View file

@ -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;

View file

@ -21,9 +21,10 @@
#include <sys/types.h>
#include <gtk/gtk.h>
#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.

View file

@ -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;

View file

@ -21,9 +21,10 @@
#include <sys/types.h>
#include <gtk/gtk.h>
#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.

View file

@ -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;

View file

@ -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;

Some files were not shown because too many files have changed in this diff Show more