gimpimage-merge.h 11.2 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
/* 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.
 */
18 19 20
#ifndef __GIMPIMAGE_H__
#define __GIMPIMAGE_H__

21
#include "apptypes.h"
22
#include "procedural_db.h"
23 24 25 26 27
#include "gimpimageF.h"
#include "boundary.h"
#include "drawable.h"
#include "channel.h"
#include "layer.h"
28
#include <libgimp/parasiteF.h>
29
#include <libgimp/gimpunit.h>
30
#include "plug_in.h"
31 32
#include "temp_buf.h"
#include "tile_manager.h"
33
#include "pathsP.h"
34 35


36 37
#define GIMP_TYPE_IMAGE    gimp_image_get_type()
#define GIMP_IMAGE(obj)    GTK_CHECK_CAST (obj, GIMP_TYPE_IMAGE, GimpImage)
38
#define GIMP_IS_IMAGE(obj) GTK_CHECK_TYPE (obj, GIMP_TYPE_IMAGE)
39 40 41 42 43 44 45 46 47 48 49 50 51 52
     
#define TYPE_HAS_ALPHA(t)  ((t)==RGBA_GIMAGE || (t)==GRAYA_GIMAGE || (t)==INDEXEDA_GIMAGE)

#define GRAY_PIX         0
#define ALPHA_G_PIX      1
#define RED_PIX          0
#define GREEN_PIX        1
#define BLUE_PIX         2
#define ALPHA_PIX        3
#define INDEXED_PIX      0
#define ALPHA_I_PIX      1

#define COLORMAP_SIZE    768

53 54
typedef enum /*< skip >*/
{ 
55 56 57
  ORIENTATION_UNKNOWN,
  ORIENTATION_HORIZONTAL,
  ORIENTATION_VERTICAL
Manish Singh's avatar
Manish Singh committed
58 59
} InternalOrientationType;

60 61
typedef enum
{
Manish Singh's avatar
Manish Singh committed
62 63 64
  HORIZONTAL,
  VERTICAL,
  UNKNOWN
65
} OrientationType;
66 67 68

typedef enum
{
69 70 71 72 73 74
  RED_CHANNEL,
  GREEN_CHANNEL,
  BLUE_CHANNEL,
  GRAY_CHANNEL,
  INDEXED_CHANNEL,
  AUXILLARY_CHANNEL
75 76 77 78
} ChannelType;

typedef enum
{
79 80 81 82
  EXPAND_AS_NECESSARY,
  CLIP_TO_IMAGE,
  CLIP_TO_BOTTOM_LAYER,
  FLATTEN_IMAGE
83 84 85
} MergeType;


86
/* Ugly! Move this someplace else! Prolly to gdisplay.. */
87 88 89 90 91 92

struct _Guide
{
  int ref_count;
  int position;
  int orientation;
93
  guint32 guide_ID;
94 95 96
};


97 98 99 100 101 102 103
typedef struct _GimpImageRepaintArg
{
  Layer *layer;
  guint  x;
  guint  y;
  guint  width;
  guint  height;
104 105 106
} GimpImageRepaintArg;
	
	
107
GtkType gimp_image_get_type (void);
108 109 110 111


/* function declarations */

112
GimpImage *     gimp_image_new                    (gint, gint,
113
						   GimpImageBaseType);
114
void            gimp_image_set_filename           (GimpImage *, gchar *);
115
void            gimp_image_set_resolution         (GimpImage *,
116
						   gdouble, gdouble);
117
void            gimp_image_get_resolution         (GimpImage *,
118
						   gdouble *, gdouble *);
119 120
void            gimp_image_set_unit               (GimpImage *, GUnit);
GUnit           gimp_image_get_unit               (GimpImage *);
121 122 123
void            gimp_image_set_save_proc	  (GimpImage *,
						   PlugInProcDef *);
PlugInProcDef * gimp_image_get_save_proc	  (GimpImage *);
124 125
gint		gimp_image_get_width		  (const GimpImage *);
gint		gimp_image_get_height		  (const GimpImage *);
126 127 128 129 130 131 132
void            gimp_image_resize                 (GimpImage *,
						   gint, gint, gint, gint);
void            gimp_image_scale                  (GimpImage *, gint, gint);
GimpImage *     gimp_image_get_named              (gchar *);
GimpImage *     gimp_image_get_ID                 (gint);
TileManager *   gimp_image_shadow                 (GimpImage *,
						   gint, gint, gint);
133
void            gimp_image_free_shadow            (GimpImage *);
134
void            gimp_image_apply_image            (GimpImage *, GimpDrawable *,
135 136
						   PixelRegion *, gint,
						   gint,
137
						   LayerModeEffects,
138
						   TileManager *, gint, gint);
139
void            gimp_image_replace_image          (GimpImage *, GimpDrawable *,
140 141
						   PixelRegion *, gint, gint,
						   PixelRegion *, gint, gint);
142
void            gimp_image_get_foreground         (GimpImage *, GimpDrawable *,
143
						   guchar *);
144
void            gimp_image_get_background         (GimpImage *, GimpDrawable *,
145 146
						   guchar *);
guchar *        gimp_image_get_color_at           (GimpImage *, gint, gint);
147
						   
148 149
void            gimp_image_get_color              (GimpImage *,
						   GimpImageType,
150 151
						   guchar *,
						   guchar *);
152 153
void            gimp_image_transform_color        (GimpImage *,
						   GimpDrawable *,
154 155
						   guchar *,
						   guchar *,
156
						   GimpImageBaseType);
157 158 159 160 161 162
Guide*          gimp_image_add_hguide             (GimpImage *);
Guide*          gimp_image_add_vguide             (GimpImage *);
void            gimp_image_add_guide              (GimpImage *, Guide *);
void            gimp_image_remove_guide           (GimpImage *, Guide *);
void            gimp_image_delete_guide           (GimpImage *, Guide *);

Marc Lehmann's avatar
Marc Lehmann committed
163
Parasite *      gimp_image_parasite_find          (const GimpImage *,
164 165
						   const gchar *name);
gchar **        gimp_image_parasite_list          (GimpImage *image,
Marc Lehmann's avatar
Marc Lehmann committed
166
                                                   gint *count);
Marc Lehmann's avatar
Marc Lehmann committed
167 168
void            gimp_image_parasite_attach        (GimpImage *, Parasite *);
void            gimp_image_parasite_detach        (GimpImage *, const gchar *);
169

170
Tattoo          gimp_image_get_new_tattoo         (GimpImage *);
171

172
void            gimp_image_set_paths              (GimpImage *, PathsList *);
173 174
PathsList *     gimp_image_get_paths              (GimpImage *);

175 176 177 178 179 180 181 182 183
/* Temporary hack till colormap manipulation is encapsulated in functions.
   Call this whenever you modify an image's colormap. The ncol argument
   specifies which color has changed, or negative if there's a bigger change.
   Currently, use this also when the image's base type is changed to/from
   indexed.  */

void		gimp_image_colormap_changed	  (GimpImage * image,
						   gint ncol);

184 185 186

/*  layer/channel functions  */

187 188
gint            gimp_image_get_layer_index        (GimpImage *, Layer *);
gint            gimp_image_get_channel_index      (GimpImage *, Channel *);
189 190
Layer *         gimp_image_get_active_layer       (GimpImage *);
Channel *       gimp_image_get_active_channel     (GimpImage *);
191 192
Layer *         gimp_image_get_layer_by_tattoo    (GimpImage *, Tattoo);
Channel *       gimp_image_get_channel_by_tattoo  (GimpImage *, Tattoo);
193
Channel *       gimp_image_get_channel_by_name    (GimpImage *, gchar *);
194
Channel *       gimp_image_get_mask               (GimpImage *);
195 196 197 198
gint            gimp_image_get_component_active   (GimpImage *, ChannelType);
gint            gimp_image_get_component_visible  (GimpImage *, ChannelType);
gboolean        gimp_image_layer_boundary         (GimpImage *, BoundSeg **,
						   gint *);
199 200 201
Layer *         gimp_image_set_active_layer       (GimpImage *, Layer *);
Channel *       gimp_image_set_active_channel     (GimpImage *, Channel *);
Channel *       gimp_image_unset_active_channel   (GimpImage *);
202 203 204 205 206 207 208 209
void            gimp_image_set_component_active   (GimpImage *, ChannelType,
						   gint);
void            gimp_image_set_component_visible  (GimpImage *, ChannelType,
						   gint);
Layer *         gimp_image_pick_correlate_layer   (GimpImage *, gint, gint);
void            gimp_image_set_layer_mask_apply   (GimpImage *, gint);
void            gimp_image_set_layer_mask_edit    (GimpImage *, Layer *, gint);
void            gimp_image_set_layer_mask_show    (GimpImage *, gint);
210 211
Layer *         gimp_image_raise_layer            (GimpImage *, Layer *);
Layer *         gimp_image_lower_layer            (GimpImage *, Layer *);
212 213
Layer *         gimp_image_raise_layer_to_top     (GimpImage *, Layer *);
Layer *         gimp_image_lower_layer_to_bottom  (GimpImage *, Layer *);
214 215
Layer *         gimp_image_position_layer         (GimpImage *, Layer *,
						   gint, gboolean);
216
Layer *         gimp_image_merge_visible_layers   (GimpImage *, MergeType);
217 218
Layer *         gimp_image_merge_down             (GimpImage *, Layer *,
						   MergeType);
219
Layer *         gimp_image_flatten                (GimpImage *);
220 221 222
Layer *         gimp_image_merge_layers           (GimpImage *, GSList *,
						   MergeType);
Layer *         gimp_image_add_layer              (GimpImage *, Layer *, gint);
223
Layer *         gimp_image_remove_layer           (GimpImage *, Layer *);
224 225 226 227
LayerMask *     gimp_image_add_layer_mask         (GimpImage *, Layer *,
						   LayerMask *);
Channel *       gimp_image_remove_layer_mask      (GimpImage *, Layer *,
						   MaskApplyMode);
228 229
Channel *       gimp_image_raise_channel          (GimpImage *, Channel *);
Channel *       gimp_image_lower_channel          (GimpImage *, Channel *);
230
Channel *       gimp_image_position_channel       (GimpImage *, Channel *, gint);
231
Channel *       gimp_image_add_channel            (GimpImage *, Channel *, gint);
232
Channel *       gimp_image_remove_channel         (GimpImage *, Channel *);
233 234 235 236 237 238 239 240 241
void            gimp_image_construct              (GimpImage *,
						   gint, gint, gint, gint,
						   gboolean);
void            gimp_image_invalidate_without_render (GimpImage *, gint, gint,
						      gint, gint, gint,
						      gint, gint, gint);
void            gimp_image_invalidate             (GimpImage *, gint, gint,
						   gint, gint, gint,
						   gint, gint, gint);
242
void            gimp_image_validate               (TileManager *, Tile *);
243 244 245

/*  Access functions  */

246 247 248 249 250
gboolean           gimp_image_is_empty             (GimpImage *);
GimpDrawable *     gimp_image_active_drawable      (GimpImage *);
GimpImageBaseType  gimp_image_base_type            (GimpImage *);
GimpImageType	   gimp_image_base_type_with_alpha (GimpImage *);
gchar *            gimp_image_filename             (GimpImage *);
Marc Lehmann's avatar
Marc Lehmann committed
251 252 253 254
gboolean           gimp_image_undo_enable          (GimpImage *);
gboolean           gimp_image_undo_disable         (GimpImage *);
gboolean           gimp_image_undo_freeze          (GimpImage *);
gboolean           gimp_image_undo_thaw            (GimpImage *);
255
void		   gimp_image_undo_event	   (GimpImage *, int);
256 257 258 259 260
gint               gimp_image_dirty                (GimpImage *);
gint               gimp_image_clean                (GimpImage *);
void               gimp_image_clean_all            (GimpImage *);
Layer *            gimp_image_floating_sel         (GimpImage *);
guchar *           gimp_image_cmap                 (GimpImage *);
261 262 263 264

/*  projection access functions  */

TileManager *   gimp_image_projection             (GimpImage *);
265
GimpImageType	gimp_image_projection_type        (GimpImage *);
266 267
gint            gimp_image_projection_bytes       (GimpImage *);
gint            gimp_image_projection_opacity     (GimpImage *);
268 269 270 271 272 273
void            gimp_image_projection_realloc     (GimpImage *);


/*  composite access functions  */

TileManager *   gimp_image_composite              (GimpImage *);
274
GimpImageType	gimp_image_composite_type         (GimpImage *);
275 276 277 278
gint            gimp_image_composite_bytes        (GimpImage *);
TempBuf *       gimp_image_composite_preview      (GimpImage *, ChannelType,
						   gint, gint);
gint            gimp_image_preview_valid          (GimpImage *, ChannelType);
279 280 281
void            gimp_image_invalidate_preview     (GimpImage *);

void            gimp_image_invalidate_previews    (void);
282 283
TempBuf *       gimp_image_construct_composite_preview (GimpImage *,
							gint , gint);
284

285
#endif /* __GIMPIMAGE_H__ */