Started doing a GtkObjectifying framework, and started cleaning images

from all sorts of ugly dependencies.
This commit is contained in:
Lauri Alanko 1998-06-28 10:39:58 +00:00
parent 81d0e43059
commit 3897b71b72
31 changed files with 25708 additions and 3116 deletions

View File

@ -1,3 +1,22 @@
Sun Jun 28 13:30:20 EEST 1998 Lauri Alanko <nether@gimp.org>
* app/gimage.c
* app/gimage.h
* app/gimpimage.c
* app/gimpimage.h
* app/gimpimageF.h
* app/gimpimageP.h
* app/gimpobject.c
* app/gimpobject.h
* app/gimpobjectF.h
* app/gimpobjectP.h
* app/gimpsignal.c
* app/gimpsignal.h
* docs/OO.txt
Started doing a GtkObjectifying framework, and started cleaning
images from all sorts of ugly dependencies.
Sun Jun 28 08:32:20 1998 Tim Janik <timj@gtk.org>
* app/layer.c (gimp_layer_mask_get_type):

View File

@ -139,8 +139,14 @@ gimp_SOURCES = \
gimage_mask.h \
gimage_mask_cmds.c \
gimage_mask_cmds.h \
gimpimage.c \
gimpimage.h \
gimpobject.c \
gimpobject.h \
gimprc.c \
gimprc.h \
gimpsignal.c \
gimpsignal.h \
global_edit.c \
global_edit.h \
gradient.c \

2920
app/core/gimpimage-guides.c Normal file

File diff suppressed because it is too large Load Diff

214
app/core/gimpimage-guides.h Normal file
View File

@ -0,0 +1,214 @@
#ifndef __GIMPIMAGE_H__
#define __GIMPIMAGE_H__
#include "gimpimageF.h"
#include "boundary.h"
#include "drawable.h"
#include "channel.h"
#include "layer.h"
#include "temp_buf.h"
#include "tile_manager.h"
#define GIMP_IMAGE(obj) GTK_CHECK_CAST (obj, gimp_image_get_type (), GimpImage)
#define GIMP_IS_GIMAGE(obj) GTK_CHECK_TYPE (obj, gimp_image_get_type())
/* the image types */
typedef enum
{
RGB_GIMAGE,
RGBA_GIMAGE,
GRAY_GIMAGE,
GRAYA_GIMAGE,
INDEXED_GIMAGE,
INDEXEDA_GIMAGE
} GimpImageType;
#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
typedef enum
{
RGB,
GRAY,
INDEXED
} GimpImageBaseType;
/* the image fill types */
#define BACKGROUND_FILL 0
#define WHITE_FILL 1
#define TRANSPARENT_FILL 2
#define NO_FILL 3
#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;
/* Ugly! Move this someplace else! */
typedef struct _Guide Guide;
struct _Guide
{
int ref_count;
int position;
int orientation;
};
typedef struct _GimpImageRepaintArg{
Layer* layer;
guint x;
guint y;
guint width;
guint height;
} GimpImageRepaintArg;
GtkType gimp_image_get_type(void);
/* function declarations */
GimpImage * gimp_image_new (int, int, int);
void gimp_image_set_filename (GimpImage *, char *);
void gimp_image_resize (GimpImage *, int, int, int, int);
void gimp_image_scale (GimpImage *, int, int);
GimpImage * gimp_image_get_named (char *);
GimpImage * gimp_image_get_ID (int);
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,
TileManager *, int, int);
void gimp_image_replace_image (GimpImage *, GimpDrawable *, PixelRegion *, int, int,
PixelRegion *, int, int);
void gimp_image_get_foreground (GimpImage *, GimpDrawable *, unsigned char *);
void gimp_image_get_background (GimpImage *, GimpDrawable *, unsigned char *);
void gimp_image_get_color (GimpImage *, int, unsigned char *,
unsigned char *);
void gimp_image_transform_color (GimpImage *, GimpDrawable *, unsigned char *,
unsigned char *, int);
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 *);
/* layer/channel functions */
int gimp_image_get_layer_index (GimpImage *, Layer *);
int gimp_image_get_channel_index (GimpImage *, Channel *);
Layer * gimp_image_get_active_layer (GimpImage *);
Channel * gimp_image_get_active_channel (GimpImage *);
Channel * gimp_image_get_mask (GimpImage *);
int gimp_image_get_component_active (GimpImage *, ChannelType);
int gimp_image_get_component_visible (GimpImage *, ChannelType);
int gimp_image_layer_boundary (GimpImage *, BoundSeg **, int *);
Layer * gimp_image_set_active_layer (GimpImage *, Layer *);
Channel * gimp_image_set_active_channel (GimpImage *, Channel *);
Channel * gimp_image_unset_active_channel (GimpImage *);
void gimp_image_set_component_active (GimpImage *, ChannelType, int);
void gimp_image_set_component_visible (GimpImage *, ChannelType, int);
Layer * gimp_image_pick_correlate_layer (GimpImage *, int, int);
void gimp_image_set_layer_mask_apply (GimpImage *, int);
void gimp_image_set_layer_mask_edit (GimpImage *, Layer *, int);
void gimp_image_set_layer_mask_show (GimpImage *, int);
Layer * gimp_image_raise_layer (GimpImage *, Layer *);
Layer * gimp_image_lower_layer (GimpImage *, Layer *);
Layer * gimp_image_merge_visible_layers (GimpImage *, MergeType);
Layer * gimp_image_flatten (GimpImage *);
Layer * gimp_image_merge_layers (GimpImage *, GSList *, MergeType);
Layer * gimp_image_add_layer (GimpImage *, Layer *, int);
Layer * gimp_image_remove_layer (GimpImage *, Layer *);
LayerMask * gimp_image_add_layer_mask (GimpImage *, Layer *, LayerMask *);
Channel * gimp_image_remove_layer_mask (GimpImage *, Layer *, int);
Channel * gimp_image_raise_channel (GimpImage *, Channel *);
Channel * gimp_image_lower_channel (GimpImage *, Channel *);
Channel * gimp_image_add_channel (GimpImage *, Channel *, int);
Channel * gimp_image_remove_channel (GimpImage *, Channel *);
void gimp_image_construct (GimpImage *, int, int, int, int);
void gimp_image_invalidate (GimpImage *, int, int, int, int, int, int, int, int);
void gimp_image_validate (TileManager *, Tile *, int);
void gimp_image_inflate (GimpImage *);
void gimp_image_deflate (GimpImage *);
/* Access functions */
int gimp_image_is_flat (GimpImage *);
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 *);
char * gimp_image_filename (GimpImage *);
int gimp_image_enable_undo (GimpImage *);
int gimp_image_disable_undo (GimpImage *);
int gimp_image_dirty (GimpImage *);
int gimp_image_clean (GimpImage *);
void gimp_image_clean_all (GimpImage *);
Layer * gimp_image_floating_sel (GimpImage *);
unsigned char * gimp_image_cmap (GimpImage *);
/* projection access functions */
TileManager * gimp_image_projection (GimpImage *);
int gimp_image_projection_type (GimpImage *);
int gimp_image_projection_bytes (GimpImage *);
int gimp_image_projection_opacity (GimpImage *);
void gimp_image_projection_realloc (GimpImage *);
/* composite access functions */
TileManager * gimp_image_composite (GimpImage *);
int 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);
void gimp_image_invalidate_preview (GimpImage *);
void gimp_image_invalidate_previews (void);
/* from drawable.c */
/* Ugly! */
GimpImage * drawable_gimage (GimpDrawable*);
#endif

2920
app/core/gimpimage-merge.c Normal file

File diff suppressed because it is too large Load Diff

214
app/core/gimpimage-merge.h Normal file
View File

@ -0,0 +1,214 @@
#ifndef __GIMPIMAGE_H__
#define __GIMPIMAGE_H__
#include "gimpimageF.h"
#include "boundary.h"
#include "drawable.h"
#include "channel.h"
#include "layer.h"
#include "temp_buf.h"
#include "tile_manager.h"
#define GIMP_IMAGE(obj) GTK_CHECK_CAST (obj, gimp_image_get_type (), GimpImage)
#define GIMP_IS_GIMAGE(obj) GTK_CHECK_TYPE (obj, gimp_image_get_type())
/* the image types */
typedef enum
{
RGB_GIMAGE,
RGBA_GIMAGE,
GRAY_GIMAGE,
GRAYA_GIMAGE,
INDEXED_GIMAGE,
INDEXEDA_GIMAGE
} GimpImageType;
#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
typedef enum
{
RGB,
GRAY,
INDEXED
} GimpImageBaseType;
/* the image fill types */
#define BACKGROUND_FILL 0
#define WHITE_FILL 1
#define TRANSPARENT_FILL 2
#define NO_FILL 3
#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;
/* Ugly! Move this someplace else! */
typedef struct _Guide Guide;
struct _Guide
{
int ref_count;
int position;
int orientation;
};
typedef struct _GimpImageRepaintArg{
Layer* layer;
guint x;
guint y;
guint width;
guint height;
} GimpImageRepaintArg;
GtkType gimp_image_get_type(void);
/* function declarations */
GimpImage * gimp_image_new (int, int, int);
void gimp_image_set_filename (GimpImage *, char *);
void gimp_image_resize (GimpImage *, int, int, int, int);
void gimp_image_scale (GimpImage *, int, int);
GimpImage * gimp_image_get_named (char *);
GimpImage * gimp_image_get_ID (int);
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,
TileManager *, int, int);
void gimp_image_replace_image (GimpImage *, GimpDrawable *, PixelRegion *, int, int,
PixelRegion *, int, int);
void gimp_image_get_foreground (GimpImage *, GimpDrawable *, unsigned char *);
void gimp_image_get_background (GimpImage *, GimpDrawable *, unsigned char *);
void gimp_image_get_color (GimpImage *, int, unsigned char *,
unsigned char *);
void gimp_image_transform_color (GimpImage *, GimpDrawable *, unsigned char *,
unsigned char *, int);
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 *);
/* layer/channel functions */
int gimp_image_get_layer_index (GimpImage *, Layer *);
int gimp_image_get_channel_index (GimpImage *, Channel *);
Layer * gimp_image_get_active_layer (GimpImage *);
Channel * gimp_image_get_active_channel (GimpImage *);
Channel * gimp_image_get_mask (GimpImage *);
int gimp_image_get_component_active (GimpImage *, ChannelType);
int gimp_image_get_component_visible (GimpImage *, ChannelType);
int gimp_image_layer_boundary (GimpImage *, BoundSeg **, int *);
Layer * gimp_image_set_active_layer (GimpImage *, Layer *);
Channel * gimp_image_set_active_channel (GimpImage *, Channel *);
Channel * gimp_image_unset_active_channel (GimpImage *);
void gimp_image_set_component_active (GimpImage *, ChannelType, int);
void gimp_image_set_component_visible (GimpImage *, ChannelType, int);
Layer * gimp_image_pick_correlate_layer (GimpImage *, int, int);
void gimp_image_set_layer_mask_apply (GimpImage *, int);
void gimp_image_set_layer_mask_edit (GimpImage *, Layer *, int);
void gimp_image_set_layer_mask_show (GimpImage *, int);
Layer * gimp_image_raise_layer (GimpImage *, Layer *);
Layer * gimp_image_lower_layer (GimpImage *, Layer *);
Layer * gimp_image_merge_visible_layers (GimpImage *, MergeType);
Layer * gimp_image_flatten (GimpImage *);
Layer * gimp_image_merge_layers (GimpImage *, GSList *, MergeType);
Layer * gimp_image_add_layer (GimpImage *, Layer *, int);
Layer * gimp_image_remove_layer (GimpImage *, Layer *);
LayerMask * gimp_image_add_layer_mask (GimpImage *, Layer *, LayerMask *);
Channel * gimp_image_remove_layer_mask (GimpImage *, Layer *, int);
Channel * gimp_image_raise_channel (GimpImage *, Channel *);
Channel * gimp_image_lower_channel (GimpImage *, Channel *);
Channel * gimp_image_add_channel (GimpImage *, Channel *, int);
Channel * gimp_image_remove_channel (GimpImage *, Channel *);
void gimp_image_construct (GimpImage *, int, int, int, int);
void gimp_image_invalidate (GimpImage *, int, int, int, int, int, int, int, int);
void gimp_image_validate (TileManager *, Tile *, int);
void gimp_image_inflate (GimpImage *);
void gimp_image_deflate (GimpImage *);
/* Access functions */
int gimp_image_is_flat (GimpImage *);
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 *);
char * gimp_image_filename (GimpImage *);
int gimp_image_enable_undo (GimpImage *);
int gimp_image_disable_undo (GimpImage *);
int gimp_image_dirty (GimpImage *);
int gimp_image_clean (GimpImage *);
void gimp_image_clean_all (GimpImage *);
Layer * gimp_image_floating_sel (GimpImage *);
unsigned char * gimp_image_cmap (GimpImage *);
/* projection access functions */
TileManager * gimp_image_projection (GimpImage *);
int gimp_image_projection_type (GimpImage *);
int gimp_image_projection_bytes (GimpImage *);
int gimp_image_projection_opacity (GimpImage *);
void gimp_image_projection_realloc (GimpImage *);
/* composite access functions */
TileManager * gimp_image_composite (GimpImage *);
int 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);
void gimp_image_invalidate_preview (GimpImage *);
void gimp_image_invalidate_previews (void);
/* from drawable.c */
/* Ugly! */
GimpImage * drawable_gimage (GimpDrawable*);
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,214 @@
#ifndef __GIMPIMAGE_H__
#define __GIMPIMAGE_H__
#include "gimpimageF.h"
#include "boundary.h"
#include "drawable.h"
#include "channel.h"
#include "layer.h"
#include "temp_buf.h"
#include "tile_manager.h"
#define GIMP_IMAGE(obj) GTK_CHECK_CAST (obj, gimp_image_get_type (), GimpImage)
#define GIMP_IS_GIMAGE(obj) GTK_CHECK_TYPE (obj, gimp_image_get_type())
/* the image types */
typedef enum
{
RGB_GIMAGE,
RGBA_GIMAGE,
GRAY_GIMAGE,
GRAYA_GIMAGE,
INDEXED_GIMAGE,
INDEXEDA_GIMAGE
} GimpImageType;
#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
typedef enum
{
RGB,
GRAY,
INDEXED
} GimpImageBaseType;
/* the image fill types */
#define BACKGROUND_FILL 0
#define WHITE_FILL 1
#define TRANSPARENT_FILL 2
#define NO_FILL 3
#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;
/* Ugly! Move this someplace else! */
typedef struct _Guide Guide;
struct _Guide
{
int ref_count;
int position;
int orientation;
};
typedef struct _GimpImageRepaintArg{
Layer* layer;
guint x;
guint y;
guint width;
guint height;
} GimpImageRepaintArg;
GtkType gimp_image_get_type(void);
/* function declarations */
GimpImage * gimp_image_new (int, int, int);
void gimp_image_set_filename (GimpImage *, char *);
void gimp_image_resize (GimpImage *, int, int, int, int);
void gimp_image_scale (GimpImage *, int, int);
GimpImage * gimp_image_get_named (char *);
GimpImage * gimp_image_get_ID (int);
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,
TileManager *, int, int);
void gimp_image_replace_image (GimpImage *, GimpDrawable *, PixelRegion *, int, int,
PixelRegion *, int, int);
void gimp_image_get_foreground (GimpImage *, GimpDrawable *, unsigned char *);
void gimp_image_get_background (GimpImage *, GimpDrawable *, unsigned char *);
void gimp_image_get_color (GimpImage *, int, unsigned char *,
unsigned char *);
void gimp_image_transform_color (GimpImage *, GimpDrawable *, unsigned char *,
unsigned char *, int);
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 *);
/* layer/channel functions */
int gimp_image_get_layer_index (GimpImage *, Layer *);
int gimp_image_get_channel_index (GimpImage *, Channel *);
Layer * gimp_image_get_active_layer (GimpImage *);
Channel * gimp_image_get_active_channel (GimpImage *);
Channel * gimp_image_get_mask (GimpImage *);
int gimp_image_get_component_active (GimpImage *, ChannelType);
int gimp_image_get_component_visible (GimpImage *, ChannelType);
int gimp_image_layer_boundary (GimpImage *, BoundSeg **, int *);
Layer * gimp_image_set_active_layer (GimpImage *, Layer *);
Channel * gimp_image_set_active_channel (GimpImage *, Channel *);
Channel * gimp_image_unset_active_channel (GimpImage *);
void gimp_image_set_component_active (GimpImage *, ChannelType, int);
void gimp_image_set_component_visible (GimpImage *, ChannelType, int);
Layer * gimp_image_pick_correlate_layer (GimpImage *, int, int);
void gimp_image_set_layer_mask_apply (GimpImage *, int);
void gimp_image_set_layer_mask_edit (GimpImage *, Layer *, int);
void gimp_image_set_layer_mask_show (GimpImage *, int);
Layer * gimp_image_raise_layer (GimpImage *, Layer *);
Layer * gimp_image_lower_layer (GimpImage *, Layer *);
Layer * gimp_image_merge_visible_layers (GimpImage *, MergeType);
Layer * gimp_image_flatten (GimpImage *);
Layer * gimp_image_merge_layers (GimpImage *, GSList *, MergeType);
Layer * gimp_image_add_layer (GimpImage *, Layer *, int);
Layer * gimp_image_remove_layer (GimpImage *, Layer *);
LayerMask * gimp_image_add_layer_mask (GimpImage *, Layer *, LayerMask *);
Channel * gimp_image_remove_layer_mask (GimpImage *, Layer *, int);
Channel * gimp_image_raise_channel (GimpImage *, Channel *);
Channel * gimp_image_lower_channel (GimpImage *, Channel *);
Channel * gimp_image_add_channel (GimpImage *, Channel *, int);
Channel * gimp_image_remove_channel (GimpImage *, Channel *);
void gimp_image_construct (GimpImage *, int, int, int, int);
void gimp_image_invalidate (GimpImage *, int, int, int, int, int, int, int, int);
void gimp_image_validate (TileManager *, Tile *, int);
void gimp_image_inflate (GimpImage *);
void gimp_image_deflate (GimpImage *);
/* Access functions */
int gimp_image_is_flat (GimpImage *);
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 *);
char * gimp_image_filename (GimpImage *);
int gimp_image_enable_undo (GimpImage *);
int gimp_image_disable_undo (GimpImage *);
int gimp_image_dirty (GimpImage *);
int gimp_image_clean (GimpImage *);
void gimp_image_clean_all (GimpImage *);
Layer * gimp_image_floating_sel (GimpImage *);
unsigned char * gimp_image_cmap (GimpImage *);
/* projection access functions */
TileManager * gimp_image_projection (GimpImage *);
int gimp_image_projection_type (GimpImage *);
int gimp_image_projection_bytes (GimpImage *);
int gimp_image_projection_opacity (GimpImage *);
void gimp_image_projection_realloc (GimpImage *);
/* composite access functions */
TileManager * gimp_image_composite (GimpImage *);
int 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);
void gimp_image_invalidate_preview (GimpImage *);
void gimp_image_invalidate_previews (void);
/* from drawable.c */
/* Ugly! */
GimpImage * drawable_gimage (GimpDrawable*);
#endif

2920
app/core/gimpimage-resize.c Normal file

File diff suppressed because it is too large Load Diff

214
app/core/gimpimage-resize.h Normal file
View File

@ -0,0 +1,214 @@
#ifndef __GIMPIMAGE_H__
#define __GIMPIMAGE_H__
#include "gimpimageF.h"
#include "boundary.h"
#include "drawable.h"
#include "channel.h"
#include "layer.h"
#include "temp_buf.h"
#include "tile_manager.h"
#define GIMP_IMAGE(obj) GTK_CHECK_CAST (obj, gimp_image_get_type (), GimpImage)
#define GIMP_IS_GIMAGE(obj) GTK_CHECK_TYPE (obj, gimp_image_get_type())
/* the image types */
typedef enum
{
RGB_GIMAGE,
RGBA_GIMAGE,
GRAY_GIMAGE,
GRAYA_GIMAGE,
INDEXED_GIMAGE,
INDEXEDA_GIMAGE
} GimpImageType;
#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
typedef enum
{
RGB,
GRAY,
INDEXED
} GimpImageBaseType;
/* the image fill types */
#define BACKGROUND_FILL 0
#define WHITE_FILL 1
#define TRANSPARENT_FILL 2
#define NO_FILL 3
#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;
/* Ugly! Move this someplace else! */
typedef struct _Guide Guide;
struct _Guide
{
int ref_count;
int position;
int orientation;
};
typedef struct _GimpImageRepaintArg{
Layer* layer;
guint x;
guint y;
guint width;
guint height;
} GimpImageRepaintArg;
GtkType gimp_image_get_type(void);
/* function declarations */
GimpImage * gimp_image_new (int, int, int);
void gimp_image_set_filename (GimpImage *, char *);
void gimp_image_resize (GimpImage *, int, int, int, int);
void gimp_image_scale (GimpImage *, int, int);
GimpImage * gimp_image_get_named (char *);
GimpImage * gimp_image_get_ID (int);
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,
TileManager *, int, int);
void gimp_image_replace_image (GimpImage *, GimpDrawable *, PixelRegion *, int, int,
PixelRegion *, int, int);
void gimp_image_get_foreground (GimpImage *, GimpDrawable *, unsigned char *);
void gimp_image_get_background (GimpImage *, GimpDrawable *, unsigned char *);
void gimp_image_get_color (GimpImage *, int, unsigned char *,
unsigned char *);
void gimp_image_transform_color (GimpImage *, GimpDrawable *, unsigned char *,
unsigned char *, int);
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 *);
/* layer/channel functions */
int gimp_image_get_layer_index (GimpImage *, Layer *);
int gimp_image_get_channel_index (GimpImage *, Channel *);
Layer * gimp_image_get_active_layer (GimpImage *);
Channel * gimp_image_get_active_channel (GimpImage *);
Channel * gimp_image_get_mask (GimpImage *);
int gimp_image_get_component_active (GimpImage *, ChannelType);
int gimp_image_get_component_visible (GimpImage *, ChannelType);
int gimp_image_layer_boundary (GimpImage *, BoundSeg **, int *);
Layer * gimp_image_set_active_layer (GimpImage *, Layer *);
Channel * gimp_image_set_active_channel (GimpImage *, Channel *);
Channel * gimp_image_unset_active_channel (GimpImage *);
void gimp_image_set_component_active (GimpImage *, ChannelType, int);
void gimp_image_set_component_visible (GimpImage *, ChannelType, int);
Layer * gimp_image_pick_correlate_layer (GimpImage *, int, int);
void gimp_image_set_layer_mask_apply (GimpImage *, int);
void gimp_image_set_layer_mask_edit (GimpImage *, Layer *, int);
void gimp_image_set_layer_mask_show (GimpImage *, int);
Layer * gimp_image_raise_layer (GimpImage *, Layer *);
Layer * gimp_image_lower_layer (GimpImage *, Layer *);
Layer * gimp_image_merge_visible_layers (GimpImage *, MergeType);
Layer * gimp_image_flatten (GimpImage *);
Layer * gimp_image_merge_layers (GimpImage *, GSList *, MergeType);
Layer * gimp_image_add_layer (GimpImage *, Layer *, int);
Layer * gimp_image_remove_layer (GimpImage *, Layer *);
LayerMask * gimp_image_add_layer_mask (GimpImage *, Layer *, LayerMask *);
Channel * gimp_image_remove_layer_mask (GimpImage *, Layer *, int);
Channel * gimp_image_raise_channel (GimpImage *, Channel *);
Channel * gimp_image_lower_channel (GimpImage *, Channel *);
Channel * gimp_image_add_channel (GimpImage *, Channel *, int);
Channel * gimp_image_remove_channel (GimpImage *, Channel *);
void gimp_image_construct (GimpImage *, int, int, int, int);
void gimp_image_invalidate (GimpImage *, int, int, int, int, int, int, int, int);
void gimp_image_validate (TileManager *, Tile *, int);
void gimp_image_inflate (GimpImage *);
void gimp_image_deflate (GimpImage *);
/* Access functions */
int gimp_image_is_flat (GimpImage *);
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 *);
char * gimp_image_filename (GimpImage *);
int gimp_image_enable_undo (GimpImage *);
int gimp_image_disable_undo (GimpImage *);
int gimp_image_dirty (GimpImage *);
int gimp_image_clean (GimpImage *);
void gimp_image_clean_all (GimpImage *);
Layer * gimp_image_floating_sel (GimpImage *);
unsigned char * gimp_image_cmap (GimpImage *);
/* projection access functions */
TileManager * gimp_image_projection (GimpImage *);
int gimp_image_projection_type (GimpImage *);
int gimp_image_projection_bytes (GimpImage *);
int gimp_image_projection_opacity (GimpImage *);
void gimp_image_projection_realloc (GimpImage *);
/* composite access functions */
TileManager * gimp_image_composite (GimpImage *);
int 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);
void gimp_image_invalidate_preview (GimpImage *);
void gimp_image_invalidate_previews (void);
/* from drawable.c */
/* Ugly! */
GimpImage * drawable_gimage (GimpDrawable*);
#endif

2920
app/core/gimpimage-scale.c Normal file

File diff suppressed because it is too large Load Diff

214
app/core/gimpimage-scale.h Normal file
View File

@ -0,0 +1,214 @@
#ifndef __GIMPIMAGE_H__
#define __GIMPIMAGE_H__
#include "gimpimageF.h"
#include "boundary.h"
#include "drawable.h"
#include "channel.h"
#include "layer.h"
#include "temp_buf.h"
#include "tile_manager.h"
#define GIMP_IMAGE(obj) GTK_CHECK_CAST (obj, gimp_image_get_type (), GimpImage)
#define GIMP_IS_GIMAGE(obj) GTK_CHECK_TYPE (obj, gimp_image_get_type())
/* the image types */
typedef enum
{
RGB_GIMAGE,
RGBA_GIMAGE,
GRAY_GIMAGE,
GRAYA_GIMAGE,
INDEXED_GIMAGE,
INDEXEDA_GIMAGE
} GimpImageType;
#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
typedef enum
{
RGB,
GRAY,
INDEXED
} GimpImageBaseType;
/* the image fill types */
#define BACKGROUND_FILL 0
#define WHITE_FILL 1
#define TRANSPARENT_FILL 2
#define NO_FILL 3
#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;
/* Ugly! Move this someplace else! */
typedef struct _Guide Guide;
struct _Guide
{
int ref_count;
int position;
int orientation;
};
typedef struct _GimpImageRepaintArg{
Layer* layer;
guint x;
guint y;
guint width;
guint height;
} GimpImageRepaintArg;
GtkType gimp_image_get_type(void);
/* function declarations */
GimpImage * gimp_image_new (int, int, int);
void gimp_image_set_filename (GimpImage *, char *);
void gimp_image_resize (GimpImage *, int, int, int, int);
void gimp_image_scale (GimpImage *, int, int);
GimpImage * gimp_image_get_named (char *);
GimpImage * gimp_image_get_ID (int);
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,
TileManager *, int, int);
void gimp_image_replace_image (GimpImage *, GimpDrawable *, PixelRegion *, int, int,
PixelRegion *, int, int);
void gimp_image_get_foreground (GimpImage *, GimpDrawable *, unsigned char *);
void gimp_image_get_background (GimpImage *, GimpDrawable *, unsigned char *);
void gimp_image_get_color (GimpImage *, int, unsigned char *,
unsigned char *);
void gimp_image_transform_color (GimpImage *, GimpDrawable *, unsigned char *,
unsigned char *, int);
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 *);
/* layer/channel functions */
int gimp_image_get_layer_index (GimpImage *, Layer *);
int gimp_image_get_channel_index (GimpImage *, Channel *);
Layer * gimp_image_get_active_layer (GimpImage *);
Channel * gimp_image_get_active_channel (GimpImage *);
Channel * gimp_image_get_mask (GimpImage *);
int gimp_image_get_component_active (GimpImage *, ChannelType);
int gimp_image_get_component_visible (GimpImage *, ChannelType);
int gimp_image_layer_boundary (GimpImage *, BoundSeg **, int *);
Layer * gimp_image_set_active_layer (GimpImage *, Layer *);
Channel * gimp_image_set_active_channel (GimpImage *, Channel *);
Channel * gimp_image_unset_active_channel (GimpImage *);
void gimp_image_set_component_active (GimpImage *, ChannelType, int);
void gimp_image_set_component_visible (GimpImage *, ChannelType, int);
Layer * gimp_image_pick_correlate_layer (GimpImage *, int, int);
void gimp_image_set_layer_mask_apply (GimpImage *, int);
void gimp_image_set_layer_mask_edit (GimpImage *, Layer *, int);
void gimp_image_set_layer_mask_show (GimpImage *, int);
Layer * gimp_image_raise_layer (GimpImage *, Layer *);
Layer * gimp_image_lower_layer (GimpImage *, Layer *);
Layer * gimp_image_merge_visible_layers (GimpImage *, MergeType);
Layer * gimp_image_flatten (GimpImage *);
Layer * gimp_image_merge_layers (GimpImage *, GSList *, MergeType);
Layer * gimp_image_add_layer (GimpImage *, Layer *, int);
Layer * gimp_image_remove_layer (GimpImage *, Layer *);
LayerMask * gimp_image_add_layer_mask (GimpImage *, Layer *, LayerMask *);
Channel * gimp_image_remove_layer_mask (GimpImage *, Layer *, int);
Channel * gimp_image_raise_channel (GimpImage *, Channel *);
Channel * gimp_image_lower_channel (GimpImage *, Channel *);
Channel * gimp_image_add_channel (GimpImage *, Channel *, int);
Channel * gimp_image_remove_channel (GimpImage *, Channel *);
void gimp_image_construct (GimpImage *, int, int, int, int);
void gimp_image_invalidate (GimpImage *, int, int, int, int, int, int, int, int);
void gimp_image_validate (TileManager *, Tile *, int);
void gimp_image_inflate (GimpImage *);
void gimp_image_deflate (GimpImage *);
/* Access functions */
int gimp_image_is_flat (GimpImage *);
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 *);
char * gimp_image_filename (GimpImage *);
int gimp_image_enable_undo (GimpImage *);
int gimp_image_disable_undo (GimpImage *);
int gimp_image_dirty (GimpImage *);
int gimp_image_clean (GimpImage *);
void gimp_image_clean_all (GimpImage *);
Layer * gimp_image_floating_sel (GimpImage *);
unsigned char * gimp_image_cmap (GimpImage *);
/* projection access functions */
TileManager * gimp_image_projection (GimpImage *);
int gimp_image_projection_type (GimpImage *);
int gimp_image_projection_bytes (GimpImage *);
int gimp_image_projection_opacity (GimpImage *);
void gimp_image_projection_realloc (GimpImage *);
/* composite access functions */
TileManager * gimp_image_composite (GimpImage *);
int 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);
void gimp_image_invalidate_preview (GimpImage *);
void gimp_image_invalidate_previews (void);
/* from drawable.c */
/* Ugly! */
GimpImage * drawable_gimage (GimpDrawable*);
#endif

2920
app/core/gimpimage.c Normal file

File diff suppressed because it is too large Load Diff

214
app/core/gimpimage.h Normal file
View File

@ -0,0 +1,214 @@
#ifndef __GIMPIMAGE_H__
#define __GIMPIMAGE_H__
#include "gimpimageF.h"
#include "boundary.h"
#include "drawable.h"
#include "channel.h"
#include "layer.h"
#include "temp_buf.h"
#include "tile_manager.h"
#define GIMP_IMAGE(obj) GTK_CHECK_CAST (obj, gimp_image_get_type (), GimpImage)
#define GIMP_IS_GIMAGE(obj) GTK_CHECK_TYPE (obj, gimp_image_get_type())
/* the image types */
typedef enum
{
RGB_GIMAGE,
RGBA_GIMAGE,
GRAY_GIMAGE,
GRAYA_GIMAGE,
INDEXED_GIMAGE,
INDEXEDA_GIMAGE
} GimpImageType;
#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
typedef enum
{
RGB,
GRAY,
INDEXED
} GimpImageBaseType;
/* the image fill types */
#define BACKGROUND_FILL 0
#define WHITE_FILL 1
#define TRANSPARENT_FILL 2
#define NO_FILL 3
#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;
/* Ugly! Move this someplace else! */
typedef struct _Guide Guide;
struct _Guide
{
int ref_count;
int position;
int orientation;
};
typedef struct _GimpImageRepaintArg{
Layer* layer;
guint x;
guint y;
guint width;
guint height;
} GimpImageRepaintArg;
GtkType gimp_image_get_type(void);
/* function declarations */
GimpImage * gimp_image_new (int, int, int);
void gimp_image_set_filename (GimpImage *, char *);
void gimp_image_resize (GimpImage *, int, int, int, int);
void gimp_image_scale (GimpImage *, int, int);
GimpImage * gimp_image_get_named (char *);
GimpImage * gimp_image_get_ID (int);
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,
TileManager *, int, int);
void gimp_image_replace_image (GimpImage *, GimpDrawable *, PixelRegion *, int, int,
PixelRegion *, int, int);
void gimp_image_get_foreground (GimpImage *, GimpDrawable *, unsigned char *);
void gimp_image_get_background (GimpImage *, GimpDrawable *, unsigned char *);
void gimp_image_get_color (GimpImage *, int, unsigned char *,
unsigned char *);
void gimp_image_transform_color (GimpImage *, GimpDrawable *, unsigned char *,
unsigned char *, int);
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 *);
/* layer/channel functions */
int gimp_image_get_layer_index (GimpImage *, Layer *);
int gimp_image_get_channel_index (GimpImage *, Channel *);
Layer * gimp_image_get_active_layer (GimpImage *);
Channel * gimp_image_get_active_channel (GimpImage *);
Channel * gimp_image_get_mask (GimpImage *);
int gimp_image_get_component_active (GimpImage *, ChannelType);
int gimp_image_get_component_visible (GimpImage *, ChannelType);
int gimp_image_layer_boundary (GimpImage *, BoundSeg **, int *);
Layer * gimp_image_set_active_layer (GimpImage *, Layer *);
Channel * gimp_image_set_active_channel (GimpImage *, Channel *);
Channel * gimp_image_unset_active_channel (GimpImage *);
void gimp_image_set_component_active (GimpImage *, ChannelType, int);
void gimp_image_set_component_visible (GimpImage *, ChannelType, int);
Layer * gimp_image_pick_correlate_layer (GimpImage *, int, int);
void gimp_image_set_layer_mask_apply (GimpImage *, int);
void gimp_image_set_layer_mask_edit (GimpImage *, Layer *, int);
void gimp_image_set_layer_mask_show (GimpImage *, int);
Layer * gimp_image_raise_layer (GimpImage *, Layer *);
Layer * gimp_image_lower_layer (GimpImage *, Layer *);
Layer * gimp_image_merge_visible_layers (GimpImage *, MergeType);
Layer * gimp_image_flatten (GimpImage *);
Layer * gimp_image_merge_layers (GimpImage *, GSList *, MergeType);
Layer * gimp_image_add_layer (GimpImage *, Layer *, int);
Layer * gimp_image_remove_layer (GimpImage *, Layer *);
LayerMask * gimp_image_add_layer_mask (GimpImage *, Layer *, LayerMask *);
Channel * gimp_image_remove_layer_mask (GimpImage *, Layer *, int);
Channel * gimp_image_raise_channel (GimpImage *, Channel *);
Channel * gimp_image_lower_channel (GimpImage *, Channel *);
Channel * gimp_image_add_channel (GimpImage *, Channel *, int);
Channel * gimp_image_remove_channel (GimpImage *, Channel *);
void gimp_image_construct (GimpImage *, int, int, int, int);
void gimp_image_invalidate (GimpImage *, int, int, int, int, int, int, int, int);
void gimp_image_validate (TileManager *, Tile *, int);
void gimp_image_inflate (GimpImage *);
void gimp_image_deflate (GimpImage *);
/* Access functions */
int gimp_image_is_flat (GimpImage *);
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 *);
char * gimp_image_filename (GimpImage *);
int gimp_image_enable_undo (GimpImage *);
int gimp_image_disable_undo (GimpImage *);
int gimp_image_dirty (GimpImage *);
int gimp_image_clean (GimpImage *);
void gimp_image_clean_all (GimpImage *);
Layer * gimp_image_floating_sel (GimpImage *);
unsigned char * gimp_image_cmap (GimpImage *);
/* projection access functions */
TileManager * gimp_image_projection (GimpImage *);
int gimp_image_projection_type (GimpImage *);
int gimp_image_projection_bytes (GimpImage *);
int gimp_image_projection_opacity (GimpImage *);
void gimp_image_projection_realloc (GimpImage *);
/* composite access functions */
TileManager * gimp_image_composite (GimpImage *);
int 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);
void gimp_image_invalidate_preview (GimpImage *);
void gimp_image_invalidate_previews (void);
/* from drawable.c */
/* Ugly! */
GimpImage * drawable_gimage (GimpDrawable*);
#endif

31
app/core/gimpobject.c Normal file
View File

@ -0,0 +1,31 @@
#include <gtk/gtkobject.h>
#include "gimpobjectP.h"
#include "gimpobject.h"
static void
gimp_object_init (GimpObject *gobject)
{
}
static void
gimp_object_class_init (GimpObjectClass *gobjectclass)
{
}
GtkType gimp_object_get_type (void)
{
static GtkType type;
if(!type){
GtkTypeInfo info={
"GimpObject",
sizeof(GimpObject),
sizeof(GimpObjectClass),
gimp_object_class_init,
gimp_object_init,
NULL,
NULL};
type=gtk_type_unique(gtk_object_get_type(), &info);
}
return type;
}

20
app/core/gimpobject.h Normal file
View File

@ -0,0 +1,20 @@
#ifndef __GIMP_OBJECT_H__
#define __GIMP_OBJECT_H__
#include "gimpobjectF.h"
#define GIMP_OBJECT(obj) \
GTK_CHECK_CAST (obj, gimp_object_get_type (), GimpObject)
#define GIMP_OBJECT_CLASS(klass) \
GTK_CHECK_CLASS_CAST (klass, gimp_object_get_type(), GimpObjectClass)
#define GIMP_IS_OBJECT(obj) \
GTK_CHECK_TYPE (obj, gimp_object_get_type())
guint gimp_object_get_type(void);
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,214 @@
#ifndef __GIMPIMAGE_H__
#define __GIMPIMAGE_H__
#include "gimpimageF.h"
#include "boundary.h"
#include "drawable.h"
#include "channel.h"
#include "layer.h"
#include "temp_buf.h"
#include "tile_manager.h"
#define GIMP_IMAGE(obj) GTK_CHECK_CAST (obj, gimp_image_get_type (), GimpImage)
#define GIMP_IS_GIMAGE(obj) GTK_CHECK_TYPE (obj, gimp_image_get_type())
/* the image types */
typedef enum
{
RGB_GIMAGE,
RGBA_GIMAGE,
GRAY_GIMAGE,
GRAYA_GIMAGE,
INDEXED_GIMAGE,
INDEXEDA_GIMAGE
} GimpImageType;
#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
typedef enum
{
RGB,
GRAY,
INDEXED
} GimpImageBaseType;
/* the image fill types */
#define BACKGROUND_FILL 0
#define WHITE_FILL 1
#define TRANSPARENT_FILL 2
#define NO_FILL 3
#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;
/* Ugly! Move this someplace else! */
typedef struct _Guide Guide;
struct _Guide
{
int ref_count;
int position;
int orientation;
};
typedef struct _GimpImageRepaintArg{
Layer* layer;
guint x;
guint y;
guint width;
guint height;
} GimpImageRepaintArg;
GtkType gimp_image_get_type(void);
/* function declarations */
GimpImage * gimp_image_new (int, int, int);
void gimp_image_set_filename (GimpImage *, char *);
void gimp_image_resize (GimpImage *, int, int, int, int);
void gimp_image_scale (GimpImage *, int, int);
GimpImage * gimp_image_get_named (char *);
GimpImage * gimp_image_get_ID (int);
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,
TileManager *, int, int);
void gimp_image_replace_image (GimpImage *, GimpDrawable *, PixelRegion *, int, int,
PixelRegion *, int, int);
void gimp_image_get_foreground (GimpImage *, GimpDrawable *, unsigned char *);
void gimp_image_get_background (GimpImage *, GimpDrawable *, unsigned char *);
void gimp_image_get_color (GimpImage *, int, unsigned char *,
unsigned char *);
void gimp_image_transform_color (GimpImage *, GimpDrawable *, unsigned char *,
unsigned char *, int);
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 *);
/* layer/channel functions */
int gimp_image_get_layer_index (GimpImage *, Layer *);
int gimp_image_get_channel_index (GimpImage *, Channel *);
Layer * gimp_image_get_active_layer (GimpImage *);
Channel * gimp_image_get_active_channel (GimpImage *);
Channel * gimp_image_get_mask (GimpImage *);
int gimp_image_get_component_active (GimpImage *, ChannelType);
int gimp_image_get_component_visible (GimpImage *, ChannelType);
int gimp_image_layer_boundary (GimpImage *, BoundSeg **, int *);
Layer * gimp_image_set_active_layer (GimpImage *, Layer *);
Channel * gimp_image_set_active_channel (GimpImage *, Channel *);
Channel * gimp_image_unset_active_channel (GimpImage *);
void gimp_image_set_component_active (GimpImage *, ChannelType, int);
void gimp_image_set_component_visible (GimpImage *, ChannelType, int);
Layer * gimp_image_pick_correlate_layer (GimpImage *, int, int);
void gimp_image_set_layer_mask_apply (GimpImage *, int);
void gimp_image_set_layer_mask_edit (GimpImage *, Layer *, int);
void gimp_image_set_layer_mask_show (GimpImage *, int);
Layer * gimp_image_raise_layer (GimpImage *, Layer *);
Layer * gimp_image_lower_layer (GimpImage *, Layer *);
Layer * gimp_image_merge_visible_layers (GimpImage *, MergeType);
Layer * gimp_image_flatten (GimpImage *);
Layer * gimp_image_merge_layers (GimpImage *, GSList *, MergeType);
Layer * gimp_image_add_layer (GimpImage *, Layer *, int);
Layer * gimp_image_remove_layer (GimpImage *, Layer *);
LayerMask * gimp_image_add_layer_mask (GimpImage *, Layer *, LayerMask *);
Channel * gimp_image_remove_layer_mask (GimpImage *, Layer *, int);
Channel * gimp_image_raise_channel (GimpImage *, Channel *);
Channel * gimp_image_lower_channel (GimpImage *, Channel *);
Channel * gimp_image_add_channel (GimpImage *, Channel *, int);
Channel * gimp_image_remove_channel (GimpImage *, Channel *);
void gimp_image_construct (GimpImage *, int, int, int, int);
void gimp_image_invalidate (GimpImage *, int, int, int, int, int, int, int, int);
void gimp_image_validate (TileManager *, Tile *, int);
void gimp_image_inflate (GimpImage *);
void gimp_image_deflate (GimpImage *);
/* Access functions */
int gimp_image_is_flat (GimpImage *);
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 *);
char * gimp_image_filename (GimpImage *);
int gimp_image_enable_undo (GimpImage *);
int gimp_image_disable_undo (GimpImage *);
int gimp_image_dirty (GimpImage *);
int gimp_image_clean (GimpImage *);
void gimp_image_clean_all (GimpImage *);
Layer * gimp_image_floating_sel (GimpImage *);
unsigned char * gimp_image_cmap (GimpImage *);
/* projection access functions */
TileManager * gimp_image_projection (GimpImage *);
int gimp_image_projection_type (GimpImage *);
int gimp_image_projection_bytes (GimpImage *);
int gimp_image_projection_opacity (GimpImage *);
void gimp_image_projection_realloc (GimpImage *);
/* composite access functions */
TileManager * gimp_image_composite (GimpImage *);
int 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);
void gimp_image_invalidate_preview (GimpImage *);
void gimp_image_invalidate_previews (void);
/* from drawable.c */
/* Ugly! */
GimpImage * drawable_gimage (GimpDrawable*);
#endif

File diff suppressed because it is too large Load Diff

View File

@ -18,246 +18,106 @@
#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"
#include "gimpimage.h"
/* icky.. this is temporary */
#include "gimpimageP.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
typedef GimpImage GImage;
#define TYPE_HAS_ALPHA(t) ((t)==RGBA_GIMAGE || (t)==GRAYA_GIMAGE || (t)==INDEXEDA_GIMAGE)
GImage*
gimage_new(int width, int height, GimpImageBaseType base_type);
#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
GImage*
gimage_get_ID (gint ID);
#define RGB 0
#define GRAY 1
#define INDEXED 2
void
gimage_delete (GImage *gimage);
#define MAX_CHANNELS 4
void
gimage_invalidate_previews (void);
/* the image fill types */
#define BACKGROUND_FILL 0
#define WHITE_FILL 1
#define TRANSPARENT_FILL 2
#define NO_FILL 3
void
gimage_set_layer_mask_apply (GImage *gimage, int layer_id);
#define COLORMAP_SIZE 768
void
gimage_set_layer_mask_edit (GImage *gimage, Layer * layer, int edit);
#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 */
};
void
gimage_set_layer_mask_show (GImage *gimage, int layer_id);
/* 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*);
#define gimage_set_filename gimp_image_set_filename
#define gimage_resize gimp_image_resize
#define gimage_scale gimp_image_scale
#define gimage_get_named gimp_image_get_named
#define gimage_shadow gimp_image_shadow
#define gimage_free_shadow gimp_image_free_shadow
#define gimage_apply_image gimp_image_apply_image
#define gimage_replace_image gimp_image_replace_image
#define gimage_get_foreground gimp_image_get_foreground
#define gimage_get_background gimp_image_get_background
#define gimage_get_color gimp_image_get_color
#define gimage_transform_color gimp_image_transform_color
#define gimage_add_hguide gimp_image_add_hguide
#define gimage_add_vguide gimp_image_add_vguide
#define gimage_add_guide gimp_image_add_guide
#define gimage_remove_guide gimp_image_remove_guide
#define gimage_delete_guide gimp_image_delete_guide
#define gimage_get_layer_index gimp_image_get_layer_index
#define gimage_get_channel_index gimp_image_get_channel_index
#define gimage_get_active_layer gimp_image_get_active_layer
#define gimage_get_active_channel gimp_image_get_active_channel
#define gimage_get_mask gimp_image_get_mask
#define gimage_get_component_active gimp_image_get_component_active
#define gimage_get_component_visible gimp_image_get_component_visible
#define gimage_layer_boundary gimp_image_layer_boundary
#define gimage_set_active_layer gimp_image_set_active_layer
#define gimage_set_active_channel gimp_image_set_active_channel
#define gimage_unset_active_channel gimp_image_unset_active_channel
#define gimage_set_component_active gimp_image_set_component_active
#define gimage_set_component_visible gimp_image_set_component_visible
#define gimage_pick_correlate_layer gimp_image_pick_correlate_layer
#define gimage_raise_layer gimp_image_raise_layer
#define gimage_lower_layer gimp_image_lower_layer
#define gimage_merge_visible_layers gimp_image_merge_visible_layers
#define gimage_flatten gimp_image_flatten
#define gimage_merge_layers gimp_image_merge_layers
#define gimage_add_layer gimp_image_add_layer
#define gimage_remove_layer gimp_image_remove_layer
#define gimage_add_layer_mask gimp_image_add_layer_mask
#define gimage_remove_layer_mask gimp_image_remove_layer_mask
#define gimage_raise_channel gimp_image_raise_channel
#define gimage_lower_channel gimp_image_lower_channel
#define gimage_add_channel gimp_image_add_channel
#define gimage_remove_channel gimp_image_remove_channel
#define gimage_construct gimp_image_construct
#define gimage_invalidate gimp_image_invalidate
#define gimage_validate gimp_image_validate
#define gimage_inflate gimp_image_inflate
#define gimage_deflate gimp_image_deflate
#define gimage_is_flat gimp_image_is_flat
#define gimage_is_empty gimp_image_is_empty
#define gimage_active_drawable gimp_image_active_drawable
#define gimage_base_type gimp_image_base_type
#define gimage_base_type_with_alpha gimp_image_base_type_with_alpha
#define gimage_filename gimp_image_filename
#define gimage_enable_undo gimp_image_enable_undo
#define gimage_disable_undo gimp_image_disable_undo
#define gimage_dirty gimp_image_dirty
#define gimage_clean gimp_image_clean
#define gimage_clean_all gimp_image_clean_all
#define gimage_floating_sel gimp_image_floating_sel
#define gimage_cmap gimp_image_cmap
#define gimage_projection gimp_image_projection
#define gimage_projection_type gimp_image_projection_type
#define gimage_projection_bytes gimp_image_projection_bytes
#define gimage_projection_opacity gimp_image_projection_opacity
#define gimage_projection_realloc gimp_image_projection_realloc
#define gimage_composite gimp_image_composite
#define gimage_composite_type gimp_image_composite_type
#define gimage_composite_bytes gimp_image_composite_bytes
#define gimage_composite_preview gimp_image_composite_preview
#define gimage_preview_valid gimp_image_preview_valid
#define gimage_invalidate_preview gimp_image_invalidate_preview
#endif /* __GIMAGE_H__ */

2920
app/gimpimage.c Normal file

File diff suppressed because it is too large Load Diff

214
app/gimpimage.h Normal file
View File

@ -0,0 +1,214 @@
#ifndef __GIMPIMAGE_H__
#define __GIMPIMAGE_H__
#include "gimpimageF.h"
#include "boundary.h"
#include "drawable.h"
#include "channel.h"
#include "layer.h"
#include "temp_buf.h"
#include "tile_manager.h"
#define GIMP_IMAGE(obj) GTK_CHECK_CAST (obj, gimp_image_get_type (), GimpImage)
#define GIMP_IS_GIMAGE(obj) GTK_CHECK_TYPE (obj, gimp_image_get_type())
/* the image types */
typedef enum
{
RGB_GIMAGE,
RGBA_GIMAGE,
GRAY_GIMAGE,
GRAYA_GIMAGE,
INDEXED_GIMAGE,
INDEXEDA_GIMAGE
} GimpImageType;
#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
typedef enum
{
RGB,
GRAY,
INDEXED
} GimpImageBaseType;
/* the image fill types */
#define BACKGROUND_FILL 0
#define WHITE_FILL 1
#define TRANSPARENT_FILL 2
#define NO_FILL 3
#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;
/* Ugly! Move this someplace else! */
typedef struct _Guide Guide;
struct _Guide
{
int ref_count;
int position;
int orientation;
};
typedef struct _GimpImageRepaintArg{
Layer* layer;
guint x;
guint y;
guint width;
guint height;
} GimpImageRepaintArg;
GtkType gimp_image_get_type(void);
/* function declarations */
GimpImage * gimp_image_new (int, int, int);
void gimp_image_set_filename (GimpImage *, char *);
void gimp_image_resize (GimpImage *, int, int, int, int);
void gimp_image_scale (GimpImage *, int, int);
GimpImage * gimp_image_get_named (char *);
GimpImage * gimp_image_get_ID (int);
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,
TileManager *, int, int);
void gimp_image_replace_image (GimpImage *, GimpDrawable *, PixelRegion *, int, int,
PixelRegion *, int, int);
void gimp_image_get_foreground (GimpImage *, GimpDrawable *, unsigned char *);
void gimp_image_get_background (GimpImage *, GimpDrawable *, unsigned char *);
void gimp_image_get_color (GimpImage *, int, unsigned char *,
unsigned char *);
void gimp_image_transform_color (GimpImage *, GimpDrawable *, unsigned char *,
unsigned char *, int);
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 *);
/* layer/channel functions */
int gimp_image_get_layer_index (GimpImage *, Layer *);
int gimp_image_get_channel_index (GimpImage *, Channel *);
Layer * gimp_image_get_active_layer (GimpImage *);
Channel * gimp_image_get_active_channel (GimpImage *);
Channel * gimp_image_get_mask (GimpImage *);
int gimp_image_get_component_active (GimpImage *, ChannelType);
int gimp_image_get_component_visible (GimpImage *, ChannelType);
int gimp_image_layer_boundary (GimpImage *, BoundSeg **, int *);
Layer * gimp_image_set_active_layer (GimpImage *, Layer *);
Channel * gimp_image_set_active_channel (GimpImage *, Channel *);
Channel * gimp_image_unset_active_channel (GimpImage *);
void gimp_image_set_component_active (GimpImage *, ChannelType, int);
void gimp_image_set_component_visible (GimpImage *, ChannelType, int);
Layer * gimp_image_pick_correlate_layer (GimpImage *, int, int);
void gimp_image_set_layer_mask_apply (GimpImage *, int);
void gimp_image_set_layer_mask_edit (GimpImage *, Layer *, int);
void gimp_image_set_layer_mask_show (GimpImage *, int);
Layer * gimp_image_raise_layer (GimpImage *, Layer *);
Layer * gimp_image_lower_layer (GimpImage *, Layer *);
Layer * gimp_image_merge_visible_layers (GimpImage *, MergeType);
Layer * gimp_image_flatten (GimpImage *);
Layer * gimp_image_merge_layers (GimpImage *, GSList *, MergeType);
Layer * gimp_image_add_layer (GimpImage *, Layer *, int);
Layer * gimp_image_remove_layer (GimpImage *, Layer *);
LayerMask * gimp_image_add_layer_mask (GimpImage *, Layer *, LayerMask *);
Channel * gimp_image_remove_layer_mask (GimpImage *, Layer *, int);
Channel * gimp_image_raise_channel (GimpImage *, Channel *);
Channel * gimp_image_lower_channel (GimpImage *, Channel *);
Channel * gimp_image_add_channel (GimpImage *, Channel *, int);
Channel * gimp_image_remove_channel (GimpImage *, Channel *);
void gimp_image_construct (GimpImage *, int, int, int, int);
void gimp_image_invalidate (GimpImage *, int, int, int, int, int, int, int, int);
void gimp_image_validate (TileManager *, Tile *, int);
void gimp_image_inflate (GimpImage *);
void gimp_image_deflate (GimpImage *);
/* Access functions */
int gimp_image_is_flat (GimpImage *);
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 *);
char * gimp_image_filename (GimpImage *);
int gimp_image_enable_undo (GimpImage *);
int gimp_image_disable_undo (GimpImage *);
int gimp_image_dirty (GimpImage *);
int gimp_image_clean (GimpImage *);
void gimp_image_clean_all (GimpImage *);
Layer * gimp_image_floating_sel (GimpImage *);
unsigned char * gimp_image_cmap (GimpImage *);
/* projection access functions */
TileManager * gimp_image_projection (GimpImage *);
int gimp_image_projection_type (GimpImage *);
int gimp_image_projection_bytes (GimpImage *);
int gimp_image_projection_opacity (GimpImage *);
void gimp_image_projection_realloc (GimpImage *);
/* composite access functions */
TileManager * gimp_image_composite (GimpImage *);
int 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);
void gimp_image_invalidate_preview (GimpImage *);
void gimp_image_invalidate_previews (void);
/* from drawable.c */
/* Ugly! */
GimpImage * drawable_gimage (GimpDrawable*);
#endif

6
app/gimpimageF.h Normal file
View File

@ -0,0 +1,6 @@
#ifndef __GIMPIMAGEF_H__
#define __GIMPIMAGEF_H__
typedef struct _GimpImage GimpImage;
#endif

88
app/gimpimageP.h Normal file
View File

@ -0,0 +1,88 @@
#ifndef __GIMPIMAGEP_H__
#define __GIMPIMAGEP_H__
#include "gimpobjectP.h"
#include "gimpimageF.h"
#include "tile_manager.h"
#include "temp_buf.h"
#include "channel.h"
#include "layer.h"
#define MAX_CHANNELS 4
struct _GimpImage
{
GimpObject gobject;
char *filename; /* original filename */
int has_filename; /* has a valid filename */
int width, height; /* width and height attributes */
int base_type; /* base gimp_image 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 gimp_image identifier */
/* Projection attributes */
int flat; /* Is the gimp_image 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 */
};
struct _GimpImageClass
{
GimpObjectClass parent_class;
void (*dirty) (GtkObject*);
void (*repaint) (GtkObject*);
void (*rename) (GtkObject*);
};
typedef struct _GimpImageClass GimpImageClass;
#define GIMP_IMAGE_CLASS(klass) \
GTK_CHECK_CLASS_CAST (klass, gimp_image_get_type(), GimpImageClass)
#endif

31
app/gimpobject.c Normal file
View File

@ -0,0 +1,31 @@
#include <gtk/gtkobject.h>
#include "gimpobjectP.h"
#include "gimpobject.h"
static void
gimp_object_init (GimpObject *gobject)
{
}
static void
gimp_object_class_init (GimpObjectClass *gobjectclass)
{
}
GtkType gimp_object_get_type (void)
{
static GtkType type;
if(!type){
GtkTypeInfo info={
"GimpObject",
sizeof(GimpObject),
sizeof(GimpObjectClass),
gimp_object_class_init,
gimp_object_init,
NULL,
NULL};
type=gtk_type_unique(gtk_object_get_type(), &info);
}
return type;
}

20
app/gimpobject.h Normal file
View File

@ -0,0 +1,20 @@
#ifndef __GIMP_OBJECT_H__
#define __GIMP_OBJECT_H__
#include "gimpobjectF.h"
#define GIMP_OBJECT(obj) \
GTK_CHECK_CAST (obj, gimp_object_get_type (), GimpObject)
#define GIMP_OBJECT_CLASS(klass) \
GTK_CHECK_CLASS_CAST (klass, gimp_object_get_type(), GimpObjectClass)
#define GIMP_IS_OBJECT(obj) \
GTK_CHECK_TYPE (obj, gimp_object_get_type())
guint gimp_object_get_type(void);
#endif

6
app/gimpobjectF.h Normal file
View File

@ -0,0 +1,6 @@
#ifndef __GIMP_OBJECT_F_H__
#define __GIMP_OBJECT_F_H__
typedef struct _GimpObject GimpObject;
#endif

18
app/gimpobjectP.h Normal file
View File

@ -0,0 +1,18 @@
#ifndef __GIMP_OBJECT_P_H__
#define __GIMP_OBJECT_P_H__
#include <gtk/gtkobject.h>
#include "gimpobjectF.h"
struct _GimpObject
{
GtkObject object;
};
typedef struct
{
GtkObjectClass parent_class;
}GimpObjectClass;
guint gimp_object_get_type(void);
#endif

114
app/gimpsignal.c Normal file
View File

@ -0,0 +1,114 @@
#include "gimpsignal.h"
struct _GimpSignalType{
GtkSignalMarshaller marshaller;
GtkType return_type;
guint nparams;
const GtkType* param_types;
};
typedef const GtkType TypeArr[];
GimpSignalID gimp_signal_new(const gchar* name,
GtkSignalRunType signal_flags,
GtkType object_type,
guint function_offset,
GimpSignalType* sig_type){
return gtk_signal_newv(name,
signal_flags,
object_type,
function_offset,
sig_type->marshaller,
sig_type->return_type,
sig_type->nparams,
/* Bah. We try to be const correct, but
gtk isn't.. */
(GtkType*)sig_type->param_types);
}
static GimpSignalType sigtype_void={
gtk_signal_default_marshaller,
GTK_TYPE_NONE,
0,
NULL
};
GimpSignalType* const gimp_sigtype_void=&sigtype_void;
static void
gimp_marshaller_pointer (GtkObject* object,
GtkSignalFunc func,
gpointer func_data,
GtkArg* args)
{
(*(GimpHandlerPointer)func) (object,
GTK_VALUE_POINTER (args[0]),
func_data);
}
static TypeArr pointer_types={
GTK_TYPE_POINTER
};
static GimpSignalType sigtype_pointer={
gimp_marshaller_pointer,
GTK_TYPE_NONE,
1,
pointer_types
};
GimpSignalType* const gimp_sigtype_pointer=&sigtype_pointer;
static void
gimp_marshaller_int (GtkObject* object,
GtkSignalFunc func,
gpointer func_data,
GtkArg* args)
{
(*(GimpHandlerInt)func) (object,
GTK_VALUE_INT (args[0]),
func_data);
}
static TypeArr int_types={
GTK_TYPE_INT
};
static GimpSignalType sigtype_int={
gimp_marshaller_int,
GTK_TYPE_NONE,
1,
int_types
};
GimpSignalType* const gimp_sigtype_int=&sigtype_int;
static void
gimp_marshaller_int_int_int_int (GtkObject* object,
GtkSignalFunc func,
gpointer func_data,
GtkArg* args)
{
(*(GimpHandlerIntIntIntInt)func) (object,
GTK_VALUE_INT (args[0]),
GTK_VALUE_INT (args[1]),
GTK_VALUE_INT (args[2]),
GTK_VALUE_INT (args[3]),
func_data);
}
static TypeArr int_int_int_int_types={
GTK_TYPE_INT,
GTK_TYPE_INT,
GTK_TYPE_INT,
GTK_TYPE_INT
};
static GimpSignalType sigtype_int_int_int_int={
gimp_marshaller_int_int_int_int,
GTK_TYPE_NONE,
4,
int_int_int_int_types
};
GimpSignalType* const gimp_sigtype_int_int_int_int=&sigtype_int_int_int_int;

35
app/gimpsignal.h Normal file
View File

@ -0,0 +1,35 @@
#ifndef __GIMPSIGNAL_H__
#define __GIMPSIGNAL_H__
#include <gtk/gtksignal.h>
/* This is the gtk "signal id" */
typedef guint GimpSignalID;
typedef const struct _GimpSignalType GimpSignalType;
/* The arguments are encoded in the names.. */
GimpSignalType* const gimp_sigtype_void;
typedef void (*GimpHandlerVoid)(GtkObject*, gpointer);
GimpSignalType* const gimp_sigtype_pointer;
typedef void (*GimpHandlerPointer)(GtkObject*, gpointer, gpointer);
GimpSignalType* const gimp_sigtype_int;
typedef void (*GimpHandlerInt)(GtkObject*, gint, gpointer);
GimpSignalType* const gimp_sigtype_int_int_int_int;
typedef void (*GimpHandlerIntIntIntInt) (GtkObject*, gint, gint, gint, gint,
gpointer);
GimpSignalID gimp_signal_new(const gchar* name,
GtkSignalRunType signal_flags,
GtkType object_type,
guint function_offset,
GimpSignalType* sig_type);
#endif

48
docs/OO.txt Normal file
View File

@ -0,0 +1,48 @@
On making Gimp OO
This document outlines the ideas of the conversion to using the GTK
object system in gimp core.
The basic problem with gimp's internals is that it is _old_. Some of
the stuff dates from the 0.54 era, before layers, before GTK. This has
caused the current source to be what some people call a "mess". You
don't want to hear what the other people call it.
Some of the main problems are that there are far, far too many headers
included everywhere. That is, encapsulation doesn't work. This causes
nasty dependencies, and doesn't exactly do good for compile times,
either. In addition, there are too much integer ids on objects. These
should only be used for pdb, and even there there'd probably be better
ways of passing them. The gtk object system will better facilitate
data hiding and encapsulation.
Then there are the tools. The tools have a primitive object hierarchy,
but it is a mess when compared to gtk's system. Restructuring the
tools will make the world a better place, and new tools easier to
implement.
GTK's object system has many other features that will make gimp
programming easier, the chief one being signals. When gimp's images
and displays have signals that you can connect callbacks to, different
components of the program will be better able to keep up with the
state of things.
Also, having all types in the gimp core use a standard object system
will make it easier to export these types as CORBA objects when the
time comes for that.
Some guidelines:
Everything should be as modular and independent as possible. Core
image manipulation classes should have no hard-coded relations with an
"UI". There should be no global variables in the classes.
All gimp classes should derive from GimpObject. This is just in case
we need some common debugging functionality or something.
For a future locking system, and just for code clarity, things should
be made const correct. That is, if a function doesn't modify an
object, it should take a pointer to a const object.