1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264
|
/* 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 __GIMAGE_H__
#define __GIMAGE_H__
#include "boundary.h"
#include "drawable.h"
#include "channel.h"
#include "layer.h"
#include "paint_funcs.h"
#include "temp_buf.h"
#include "tile_manager.h"
/* the image types */
#define RGB_GIMAGE 0
#define RGBA_GIMAGE 1
#define GRAY_GIMAGE 2
#define GRAYA_GIMAGE 3
#define INDEXED_GIMAGE 4
#define INDEXEDA_GIMAGE 5
#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 RGB 0
#define GRAY 1
#define INDEXED 2
#define MAX_CHANNELS 4
/* the image fill types */
#define BACKGROUND_FILL 0
#define WHITE_FILL 1
#define TRANSPARENT_FILL 2
#define NO_FILL 3
#define FOREGROUND_FILL 4
#define COLORMAP_SIZE 768
#define HORIZONTAL_GUIDE 1
#define VERTICAL_GUIDE 2
typedef enum
{
Red,
Green,
Blue,
Gray,
Indexed,
Auxillary
} ChannelType;
typedef enum
{
ExpandAsNecessary,
ClipToImage,
ClipToBottomLayer,
FlattenImage
} MergeType;
/* structure declarations */
typedef struct _Guide Guide;
typedef struct _GImage GImage;
struct _Guide
{
int ref_count;
int position;
int orientation;
};
struct _GImage
{
char *filename; /* original filename */
int has_filename; /* has a valid filename */
int width, height; /* width and height attributes */
int base_type; /* base gimage type */
unsigned char * cmap; /* colormap--for indexed */
int num_cols; /* number of cols--for indexed */
int dirty; /* dirty flag -- # of ops */
int undo_on; /* Is undo enabled? */
int instance_count; /* number of instances */
int ref_count; /* number of references */
TileManager *shadow; /* shadow buffer tiles */
int ID; /* Unique gimage identifier */
/* Projection attributes */
int flat; /* Is the gimage flat? */
int construct_flag; /* flag for construction */
int proj_type; /* type of the projection image */
int proj_bytes; /* bpp in projection image */
int proj_level; /* projection level */
TileManager *projection; /* The projection--layers & */
/* channels */
GList *guides; /* guides */
/* Layer/Channel attributes */
GSList *layers; /* the list of layers */
GSList *channels; /* the list of masks */
GSList *layer_stack; /* the layers in MRU order */
Layer * active_layer; /* ID of active layer */
Channel * active_channel; /* ID of active channel */
Layer * floating_sel; /* ID of fs layer */
Channel * selection_mask; /* selection mask channel */
int visible [MAX_CHANNELS]; /* visible channels */
int active [MAX_CHANNELS]; /* active channels */
int by_color_select; /* TRUE if there's an active */
/* "by color" selection dialog */
/* Undo apparatus */
GSList *undo_stack; /* stack for undo operations */
GSList *redo_stack; /* stack for redo operations */
int undo_bytes; /* bytes in undo stack */
int undo_levels; /* levels in undo stack */
int pushing_undo_group; /* undo group status flag */
/* Composite preview */
TempBuf *comp_preview; /* the composite preview */
int comp_preview_valid[3]; /* preview valid-1/channel */
};
/* function declarations */
GImage * gimage_new (int, int, int);
void gimage_set_filename (GImage *, char *);
void gimage_resize (GImage *, int, int, int, int);
void gimage_scale (GImage *, int, int);
GImage * gimage_get_named (char *);
GImage * gimage_get_ID (int);
TileManager * gimage_shadow (GImage *, int, int, int);
void gimage_free_shadow (GImage *);
void gimage_delete (GImage *);
void gimage_apply_image (GImage *, GimpDrawable *, PixelRegion *, int, int, int,
TileManager *, int, int);
void gimage_replace_image (GImage *, GimpDrawable *, PixelRegion *, int, int,
PixelRegion *, int, int);
void gimage_get_foreground (GImage *, GimpDrawable *, unsigned char *);
void gimage_get_background (GImage *, GimpDrawable *, unsigned char *);
void gimage_get_color (GImage *, int, unsigned char *,
unsigned char *);
void gimage_transform_color (GImage *, GimpDrawable *, unsigned char *,
unsigned char *, int);
Guide* gimage_add_hguide (GImage *);
Guide* gimage_add_vguide (GImage *);
void gimage_add_guide (GImage *, Guide *);
void gimage_remove_guide (GImage *, Guide *);
void gimage_delete_guide (GImage *, Guide *);
/* layer/channel functions */
int gimage_get_layer_index (GImage *, Layer *);
int gimage_get_channel_index (GImage *, Channel *);
Layer * gimage_get_active_layer (GImage *);
Channel * gimage_get_active_channel (GImage *);
Channel * gimage_get_mask (GImage *);
int gimage_get_component_active (GImage *, ChannelType);
int gimage_get_component_visible (GImage *, ChannelType);
int gimage_layer_boundary (GImage *, BoundSeg **, int *);
Layer * gimage_set_active_layer (GImage *, Layer *);
Channel * gimage_set_active_channel (GImage *, Channel *);
Channel * gimage_unset_active_channel (GImage *);
void gimage_set_component_active (GImage *, ChannelType, int);
void gimage_set_component_visible (GImage *, ChannelType, int);
Layer * gimage_pick_correlate_layer (GImage *, int, int);
void gimage_set_layer_mask_apply (GImage *, int);
void gimage_set_layer_mask_edit (GImage *, Layer *, int);
void gimage_set_layer_mask_show (GImage *, int);
Layer * gimage_raise_layer (GImage *, Layer *);
Layer * gimage_lower_layer (GImage *, Layer *);
Layer * gimage_merge_visible_layers (GImage *, MergeType);
Layer * gimage_flatten (GImage *);
Layer * gimage_merge_layers (GImage *, GSList *, MergeType);
Layer * gimage_add_layer (GImage *, Layer *, int);
Layer * gimage_remove_layer (GImage *, Layer *);
LayerMask * gimage_add_layer_mask (GImage *, Layer *, LayerMask *);
Channel * gimage_remove_layer_mask (GImage *, Layer *, int);
Channel * gimage_raise_channel (GImage *, Channel *);
Channel * gimage_lower_channel (GImage *, Channel *);
Channel * gimage_add_channel (GImage *, Channel *, int);
Channel * gimage_remove_channel (GImage *, Channel *);
void gimage_construct (GImage *, int, int, int, int);
void gimage_invalidate (GImage *, int, int, int, int, int, int, int, int);
void gimage_validate (TileManager *, Tile *, int);
void gimage_inflate (GImage *);
void gimage_deflate (GImage *);
/* Access functions */
int gimage_is_flat (GImage *);
int gimage_is_empty (GImage *);
GimpDrawable * gimage_active_drawable (GImage *);
int gimage_base_type (GImage *);
int gimage_base_type_with_alpha (GImage *);
char * gimage_filename (GImage *);
int gimage_enable_undo (GImage *);
int gimage_disable_undo (GImage *);
int gimage_dirty (GImage *);
int gimage_clean (GImage *);
void gimage_clean_all (GImage *);
Layer * gimage_floating_sel (GImage *);
unsigned char * gimage_cmap (GImage *);
/* projection access functions */
TileManager * gimage_projection (GImage *);
int gimage_projection_type (GImage *);
int gimage_projection_bytes (GImage *);
int gimage_projection_opacity (GImage *);
void gimage_projection_realloc (GImage *);
/* composite access functions */
TileManager * gimage_composite (GImage *);
int gimage_composite_type (GImage *);
int gimage_composite_bytes (GImage *);
TempBuf * gimage_composite_preview (GImage *, ChannelType, int, int);
int gimage_preview_valid (GImage *, ChannelType);
void gimage_invalidate_preview (GImage *);
void gimage_invalidate_previews (void);
/* from drawable.c */
GImage * drawable_gimage (GimpDrawable*);
#endif /* __GIMAGE_H__ */
|