1999-08-22 11:45:31 +00:00
|
|
|
/* 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.
|
|
|
|
*/
|
2000-12-13 18:53:35 +00:00
|
|
|
|
1998-06-28 10:39:58 +00:00
|
|
|
#ifndef __GIMPIMAGE_H__
|
|
|
|
#define __GIMPIMAGE_H__
|
|
|
|
|
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.)
1999-08-18 23:41:39 +00:00
|
|
|
#include "apptypes.h"
|
1998-08-31 17:31:19 +00:00
|
|
|
#include "procedural_db.h"
|
1998-06-28 10:39:58 +00:00
|
|
|
#include "boundary.h"
|
|
|
|
#include "drawable.h"
|
|
|
|
#include "channel.h"
|
|
|
|
#include "layer.h"
|
1998-10-27 09:26:38 +00:00
|
|
|
#include "plug_in.h"
|
1998-06-28 10:39:58 +00:00
|
|
|
#include "temp_buf.h"
|
|
|
|
#include "tile_manager.h"
|
2000-02-16 13:52:33 +00:00
|
|
|
#include "path.h"
|
1998-06-28 10:39:58 +00:00
|
|
|
|
2000-05-27 01:30:21 +00:00
|
|
|
#include "libgimp/gimpparasite.h"
|
|
|
|
#include "libgimp/gimpunit.h"
|
|
|
|
|
1998-06-28 10:39:58 +00:00
|
|
|
|
1999-08-22 11:45:31 +00:00
|
|
|
#define GIMP_TYPE_IMAGE gimp_image_get_type()
|
|
|
|
#define GIMP_IMAGE(obj) GTK_CHECK_CAST (obj, GIMP_TYPE_IMAGE, GimpImage)
|
1999-01-07 19:53:05 +00:00
|
|
|
#define GIMP_IS_IMAGE(obj) GTK_CHECK_TYPE (obj, GIMP_TYPE_IMAGE)
|
1998-06-28 10:39:58 +00:00
|
|
|
|
2000-12-13 18:53:35 +00:00
|
|
|
#define GIMP_IMAGE_TYPE_HAS_ALPHA(t) ((t)==RGBA_GIMAGE || (t)==GRAYA_GIMAGE || (t)==INDEXEDA_GIMAGE)
|
1998-06-28 10:39:58 +00:00
|
|
|
|
|
|
|
#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
|
|
|
|
|
1999-09-23 23:42:38 +00:00
|
|
|
typedef enum /*< skip >*/
|
|
|
|
{
|
1999-07-28 23:00:08 +00:00
|
|
|
ORIENTATION_UNKNOWN,
|
|
|
|
ORIENTATION_HORIZONTAL,
|
|
|
|
ORIENTATION_VERTICAL
|
1999-07-30 05:26:36 +00:00
|
|
|
} InternalOrientationType;
|
|
|
|
|
1999-09-23 23:42:38 +00:00
|
|
|
typedef enum
|
|
|
|
{
|
1999-07-30 05:26:36 +00:00
|
|
|
HORIZONTAL,
|
|
|
|
VERTICAL,
|
|
|
|
UNKNOWN
|
1999-07-28 23:00:08 +00:00
|
|
|
} OrientationType;
|
1998-06-28 10:39:58 +00:00
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
1999-04-27 04:57:59 +00:00
|
|
|
RED_CHANNEL,
|
|
|
|
GREEN_CHANNEL,
|
|
|
|
BLUE_CHANNEL,
|
|
|
|
GRAY_CHANNEL,
|
|
|
|
INDEXED_CHANNEL,
|
|
|
|
AUXILLARY_CHANNEL
|
1998-06-28 10:39:58 +00:00
|
|
|
} ChannelType;
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
1999-04-27 04:57:59 +00:00
|
|
|
EXPAND_AS_NECESSARY,
|
|
|
|
CLIP_TO_IMAGE,
|
|
|
|
CLIP_TO_BOTTOM_LAYER,
|
|
|
|
FLATTEN_IMAGE
|
1998-06-28 10:39:58 +00:00
|
|
|
} MergeType;
|
|
|
|
|
|
|
|
|
1998-06-29 00:24:44 +00:00
|
|
|
/* Ugly! Move this someplace else! Prolly to gdisplay.. */
|
1998-06-28 10:39:58 +00:00
|
|
|
|
|
|
|
struct _Guide
|
|
|
|
{
|
2000-12-28 16:19:55 +00:00
|
|
|
gint ref_count;
|
|
|
|
gint position;
|
|
|
|
InternalOrientationType orientation;
|
|
|
|
guint32 guide_ID;
|
1998-06-28 10:39:58 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
1999-08-22 11:45:31 +00:00
|
|
|
typedef struct _GimpImageRepaintArg
|
|
|
|
{
|
|
|
|
Layer *layer;
|
|
|
|
guint x;
|
|
|
|
guint y;
|
|
|
|
guint width;
|
|
|
|
guint height;
|
1998-06-28 10:39:58 +00:00
|
|
|
} GimpImageRepaintArg;
|
|
|
|
|
|
|
|
|
|
|
|
/* function declarations */
|
|
|
|
|
2000-12-28 16:19:55 +00:00
|
|
|
GtkType gimp_image_get_type (void);
|
|
|
|
|
|
|
|
GimpImage * gimp_image_new (gint width,
|
|
|
|
gint height,
|
|
|
|
GimpImageBaseType base_type);
|
|
|
|
void gimp_image_set_filename (GimpImage *gimage,
|
|
|
|
gchar *filename);
|
|
|
|
void gimp_image_set_resolution (GimpImage *gimage,
|
|
|
|
gdouble xres,
|
|
|
|
gdouble yres);
|
|
|
|
void gimp_image_get_resolution (const GimpImage *gimage,
|
|
|
|
gdouble *xresolution,
|
|
|
|
gdouble *yresolution);
|
|
|
|
void gimp_image_set_unit (GimpImage *gimage,
|
|
|
|
GimpUnit unit);
|
|
|
|
GimpUnit gimp_image_get_unit (const GimpImage *gimage);
|
|
|
|
void gimp_image_set_save_proc (GimpImage *gimage,
|
|
|
|
PlugInProcDef *proc);
|
|
|
|
PlugInProcDef * gimp_image_get_save_proc (const GimpImage *gimage);
|
|
|
|
gint gimp_image_get_width (const GimpImage *gimage);
|
|
|
|
gint gimp_image_get_height (const GimpImage *gimage);
|
|
|
|
void gimp_image_resize (GimpImage *gimage,
|
|
|
|
gint new_width,
|
|
|
|
gint new_height,
|
|
|
|
gint offset_x,
|
|
|
|
gint offset_y);
|
|
|
|
void gimp_image_scale (GimpImage *gimage,
|
|
|
|
gint new_width,
|
|
|
|
gint new_height);
|
|
|
|
TileManager * gimp_image_shadow (GimpImage *gimage,
|
|
|
|
gint width,
|
|
|
|
gint height,
|
|
|
|
gint bpp);
|
|
|
|
void gimp_image_free_shadow (GimpImage *gimage);
|
|
|
|
void gimp_image_apply_image (GimpImage *gimage,
|
|
|
|
GimpDrawable *drawable,
|
|
|
|
PixelRegion *src2PR,
|
|
|
|
gint undo,
|
|
|
|
gint opacity,
|
|
|
|
LayerModeEffects mode,
|
|
|
|
TileManager *src1_tiles,
|
|
|
|
gint x,
|
|
|
|
gint y);
|
|
|
|
void gimp_image_replace_image (GimpImage *gimage,
|
|
|
|
GimpDrawable *drawable,
|
|
|
|
PixelRegion *src2PR,
|
|
|
|
gint undo,
|
|
|
|
gint opacity,
|
|
|
|
PixelRegion *maskPR,
|
|
|
|
gint x,
|
|
|
|
gint y);
|
|
|
|
void gimp_image_get_foreground (const GimpImage *gimage,
|
|
|
|
const GimpDrawable *drawable,
|
|
|
|
guchar *fg);
|
|
|
|
void gimp_image_get_background (const GimpImage *gimage,
|
|
|
|
const GimpDrawable *drawable,
|
|
|
|
guchar *bg);
|
|
|
|
guchar * gimp_image_get_color_at (GimpImage *gimage,
|
|
|
|
gint x,
|
|
|
|
gint y);
|
|
|
|
void gimp_image_get_color (const GimpImage *gimage,
|
|
|
|
GimpImageType d_type,
|
|
|
|
guchar *rgb,
|
|
|
|
guchar *src);
|
|
|
|
void gimp_image_transform_color (const GimpImage *gimage,
|
|
|
|
const GimpDrawable *drawable,
|
|
|
|
guchar *src,
|
|
|
|
guchar *dest,
|
|
|
|
GimpImageBaseType type);
|
|
|
|
Guide * gimp_image_add_hguide (GimpImage *gimage);
|
|
|
|
Guide * gimp_image_add_vguide (GimpImage *gimage);
|
|
|
|
void gimp_image_add_guide (GimpImage *gimage,
|
|
|
|
Guide *guide);
|
|
|
|
void gimp_image_remove_guide (GimpImage *gimage,
|
|
|
|
Guide *guide);
|
|
|
|
void gimp_image_delete_guide (GimpImage *gimage,
|
|
|
|
Guide *guide);
|
|
|
|
|
|
|
|
GimpParasite * gimp_image_parasite_find (const GimpImage *gimage,
|
|
|
|
const gchar *name);
|
|
|
|
gchar ** gimp_image_parasite_list (const GimpImage *gimage,
|
|
|
|
gint *count);
|
|
|
|
void gimp_image_parasite_attach (GimpImage *gimage,
|
|
|
|
GimpParasite *parasite);
|
|
|
|
void gimp_image_parasite_detach (GimpImage *gimage,
|
|
|
|
const gchar *parasite);
|
|
|
|
|
|
|
|
Tattoo gimp_image_get_new_tattoo (GimpImage *gimage);
|
|
|
|
gboolean gimp_image_set_tattoo_state (GimpImage *gimage,
|
|
|
|
Tattoo val);
|
|
|
|
Tattoo gimp_image_get_tattoo_state (GimpImage *gimage);
|
|
|
|
|
|
|
|
void gimp_image_set_paths (GimpImage *gimage,
|
|
|
|
PathList *paths);
|
|
|
|
PathList * gimp_image_get_paths (const GimpImage *gimage);
|
1999-03-05 23:50:24 +00:00
|
|
|
|
1999-01-07 19:53:05 +00:00
|
|
|
/* 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. */
|
|
|
|
|
2000-12-28 16:19:55 +00:00
|
|
|
void gimp_image_colormap_changed (const GimpImage *image,
|
|
|
|
gint col);
|
1999-01-07 19:53:05 +00:00
|
|
|
|
1998-06-28 10:39:58 +00:00
|
|
|
|
|
|
|
/* layer/channel functions */
|
|
|
|
|
2000-12-28 16:19:55 +00:00
|
|
|
gint gimp_image_get_layer_index (const GimpImage *gimage,
|
|
|
|
const Layer *layer_arg);
|
|
|
|
Layer * gimp_image_get_layer_by_index (const GimpImage *gimage,
|
|
|
|
gint layer_index);
|
|
|
|
gint gimp_image_get_channel_index (const GimpImage *gimage,
|
|
|
|
const Channel *channel_arg);
|
|
|
|
Layer * gimp_image_get_active_layer (const GimpImage *gimage);
|
|
|
|
Channel * gimp_image_get_active_channel (const GimpImage *gimage);
|
|
|
|
Layer * gimp_image_get_layer_by_tattoo (const GimpImage *gimage,
|
|
|
|
Tattoo tatoo);
|
|
|
|
Channel * gimp_image_get_channel_by_tattoo (const GimpImage *gimage,
|
|
|
|
Tattoo tatoo);
|
|
|
|
Channel * gimp_image_get_channel_by_name (const GimpImage *gimage,
|
|
|
|
const gchar *name);
|
|
|
|
Channel * gimp_image_get_mask (const GimpImage *gimage);
|
|
|
|
gboolean gimp_image_get_component_active (const GimpImage *gimage,
|
|
|
|
ChannelType type);
|
|
|
|
gboolean gimp_image_get_component_visible (const GimpImage *gimage,
|
|
|
|
ChannelType type);
|
|
|
|
gboolean gimp_image_layer_boundary (const GimpImage *gimage,
|
|
|
|
BoundSeg **segs,
|
|
|
|
gint *n_segs);
|
|
|
|
Layer * gimp_image_set_active_layer (GimpImage *gimage,
|
|
|
|
Layer *layer);
|
|
|
|
Channel * gimp_image_set_active_channel (GimpImage *gimage,
|
|
|
|
Channel *channel);
|
|
|
|
Channel * gimp_image_unset_active_channel (GimpImage *gimage);
|
|
|
|
void gimp_image_set_component_active (GimpImage *gimage,
|
|
|
|
ChannelType type,
|
|
|
|
gboolean active);
|
|
|
|
void gimp_image_set_component_visible (GimpImage *gimage,
|
|
|
|
ChannelType type,
|
|
|
|
gboolean visible);
|
|
|
|
Layer * gimp_image_pick_correlate_layer (const GimpImage *gimage,
|
|
|
|
gint x,
|
|
|
|
gint y);
|
|
|
|
Layer * gimp_image_raise_layer (GimpImage *gimage,
|
|
|
|
Layer *layer_arg);
|
|
|
|
Layer * gimp_image_lower_layer (GimpImage *gimage,
|
|
|
|
Layer *layer_arg);
|
|
|
|
Layer * gimp_image_raise_layer_to_top (GimpImage *gimage,
|
|
|
|
Layer *layer_arg);
|
|
|
|
Layer * gimp_image_lower_layer_to_bottom (GimpImage *gimage,
|
|
|
|
Layer *layer_arg);
|
|
|
|
Layer * gimp_image_position_layer (GimpImage *gimage,
|
|
|
|
Layer *layer_arg,
|
|
|
|
gint new_index,
|
|
|
|
gboolean push_undo);
|
|
|
|
Layer * gimp_image_merge_visible_layers (GimpImage *gimage,
|
|
|
|
MergeType merge_type);
|
|
|
|
Layer * gimp_image_merge_down (GimpImage *gimage,
|
|
|
|
Layer *current_layer,
|
|
|
|
MergeType merge_type);
|
|
|
|
Layer * gimp_image_flatten (GimpImage *gimage);
|
|
|
|
Layer * gimp_image_merge_layers (GimpImage *gimage,
|
|
|
|
GSList *merge_list,
|
|
|
|
MergeType merge_type);
|
|
|
|
Layer * gimp_image_add_layer (GimpImage *gimage,
|
|
|
|
Layer *float_layer,
|
|
|
|
gint position);
|
|
|
|
Layer * gimp_image_remove_layer (GimpImage *gimage,
|
|
|
|
Layer *layer);
|
|
|
|
LayerMask * gimp_image_add_layer_mask (GimpImage *gimage,
|
|
|
|
Layer *layer,
|
|
|
|
LayerMask *mask);
|
|
|
|
Channel * gimp_image_remove_layer_mask (GimpImage *gimage,
|
|
|
|
Layer *layer,
|
|
|
|
MaskApplyMode mode);
|
|
|
|
Channel * gimp_image_raise_channel (GimpImage *gimage,
|
|
|
|
Channel *channel_arg);
|
|
|
|
Channel * gimp_image_lower_channel (GimpImage *gimage,
|
|
|
|
Channel *channel_arg);
|
|
|
|
Channel * gimp_image_position_channel (GimpImage *gimage,
|
|
|
|
Channel *channel_arg,
|
|
|
|
gint position);
|
|
|
|
Channel * gimp_image_add_channel (GimpImage *gimage,
|
|
|
|
Channel *channel,
|
|
|
|
gint position);
|
|
|
|
Channel * gimp_image_remove_channel (GimpImage *gimage,
|
|
|
|
Channel *channel);
|
|
|
|
void gimp_image_construct (GimpImage *gimage,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint w,
|
|
|
|
gint h);
|
|
|
|
|
|
|
|
|
|
|
|
void gimp_image_invalidate_without_render (GimpImage *gimage,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint w,
|
|
|
|
gint h,
|
|
|
|
gint x1,
|
|
|
|
gint y1,
|
|
|
|
gint x2,
|
|
|
|
gint y2);
|
|
|
|
void gimp_image_invalidate (GimpImage *gimage,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint w,
|
|
|
|
gint h,
|
|
|
|
gint x1,
|
|
|
|
gint y1,
|
|
|
|
gint x2,
|
|
|
|
gint y2);
|
|
|
|
void gimp_image_validate (TileManager *tm,
|
|
|
|
Tile *tile);
|
1998-06-28 10:39:58 +00:00
|
|
|
|
|
|
|
/* Access functions */
|
|
|
|
|
2000-12-28 16:19:55 +00:00
|
|
|
gboolean gimp_image_is_empty (const GimpImage *gimage);
|
|
|
|
GimpDrawable * gimp_image_active_drawable (const GimpImage *gimage);
|
|
|
|
|
|
|
|
GimpImageBaseType gimp_image_base_type (const GimpImage *gimage);
|
|
|
|
GimpImageType gimp_image_base_type_with_alpha (const GimpImage *gimage);
|
|
|
|
|
|
|
|
const gchar * gimp_image_filename (const GimpImage *gimage);
|
|
|
|
gboolean gimp_image_undo_is_enabled (const GimpImage *gimage);
|
|
|
|
gboolean gimp_image_undo_enable (GimpImage *gimage);
|
|
|
|
gboolean gimp_image_undo_disable (GimpImage *gimage);
|
|
|
|
gboolean gimp_image_undo_freeze (GimpImage *gimage);
|
|
|
|
gboolean gimp_image_undo_thaw (GimpImage *gimage);
|
|
|
|
void gimp_image_undo_event (GimpImage *gimage,
|
|
|
|
gint event);
|
|
|
|
gint gimp_image_dirty (GimpImage *gimage);
|
|
|
|
gint gimp_image_clean (GimpImage *gimage);
|
|
|
|
void gimp_image_clean_all (GimpImage *gimage);
|
|
|
|
Layer * gimp_image_floating_sel (const GimpImage *gimage);
|
|
|
|
guchar * gimp_image_cmap (const GimpImage *gimage);
|
1998-06-28 10:39:58 +00:00
|
|
|
|
|
|
|
/* projection access functions */
|
|
|
|
|
2000-12-28 16:19:55 +00:00
|
|
|
TileManager * gimp_image_projection (GimpImage *gimage);
|
|
|
|
GimpImageType gimp_image_projection_type (const GimpImage *gimage);
|
|
|
|
gint gimp_image_projection_bytes (const GimpImage *gimage);
|
|
|
|
gint gimp_image_projection_opacity (const GimpImage *gimage);
|
|
|
|
void gimp_image_projection_realloc (GimpImage *gimage);
|
1998-06-28 10:39:58 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* composite access functions */
|
|
|
|
|
2000-12-28 16:19:55 +00:00
|
|
|
TileManager * gimp_image_composite (GimpImage *gimage);
|
|
|
|
GimpImageType gimp_image_composite_type (const GimpImage *gimage);
|
|
|
|
gint gimp_image_composite_bytes (const GimpImage *gimage);
|
|
|
|
TempBuf * gimp_image_composite_preview (GimpImage *gimage,
|
|
|
|
ChannelType type,
|
|
|
|
gint width,
|
|
|
|
gint height);
|
2000-12-13 18:53:35 +00:00
|
|
|
|
2000-12-28 16:19:55 +00:00
|
|
|
gint gimp_image_preview_valid (const GimpImage *gimage,
|
|
|
|
ChannelType type);
|
|
|
|
void gimp_image_invalidate_preview (GimpImage *gimage);
|
1998-06-28 10:39:58 +00:00
|
|
|
|
2000-12-28 16:19:55 +00:00
|
|
|
void gimp_image_invalidate_previews (void);
|
2000-12-13 18:53:35 +00:00
|
|
|
|
2000-12-28 16:19:55 +00:00
|
|
|
TempBuf * gimp_image_construct_composite_preview (GimpImage *gimage,
|
|
|
|
gint width,
|
|
|
|
gint height);
|
1998-06-28 10:39:58 +00:00
|
|
|
|
1999-08-22 11:45:31 +00:00
|
|
|
#endif /* __GIMPIMAGE_H__ */
|