app/channel.[ch] app/drawable.h app/gimpdrawable.[ch] app/gimpdrawableP.h

2000-12-28  Michael Natterer  <mitch@gimp.org>

	* app/channel.[ch]
	* app/drawable.h
	* app/gimpdrawable.[ch]
	* app/gimpdrawableP.h
	* app/gimpimage.[ch]
	* app/gimpimageP.h
	* app/layer.[ch]
	* app/layer_pvt.h: started a major cleanup of all image/drawable
	files. Added tons of "const GimpImage *" declarations and properly
	formated the headers.

	* app/bezier_select.c
	* app/channels_dialog.c
	* app/crop.c
	* app/fileops.[ch]
	* app/fuzzy_select.c
	* app/gdisplay.c
	* app/layers_dialog.c
	* app/move.c
	* app/paint_funcs.[ch]
	* app/qmask.c
	* app/undo.c: changed accordingly plus the usual portion of coding
	style paranoia. This is not finished but Sven promised to buy me
	a beer if I commit now ;)
This commit is contained in:
Michael Natterer 2000-12-28 16:19:55 +00:00 committed by Michael Natterer
parent 93399c15ac
commit 0d440e1040
73 changed files with 6575 additions and 5238 deletions

View File

@ -1,3 +1,30 @@
2000-12-28 Michael Natterer <mitch@gimp.org>
* app/channel.[ch]
* app/drawable.h
* app/gimpdrawable.[ch]
* app/gimpdrawableP.h
* app/gimpimage.[ch]
* app/gimpimageP.h
* app/layer.[ch]
* app/layer_pvt.h: started a major cleanup of all image/drawable
files. Added tons of "const GimpImage *" declarations and properly
formated the headers.
* app/bezier_select.c
* app/channels_dialog.c
* app/crop.c
* app/fileops.[ch]
* app/fuzzy_select.c
* app/gdisplay.c
* app/layers_dialog.c
* app/move.c
* app/paint_funcs.[ch]
* app/qmask.c
* app/undo.c: changed accordingly plus the usual portion of coding
style paranoia. This is not finished but Sven promised to buy me
a beer if I commit now ;)
2000-12-28 Sven Neumann <sven@gimp.org>
* app/boundaryF.h

View File

@ -228,7 +228,7 @@ qmask_activate (GtkWidget *widget,
gmask = channel_copy (gimage_get_mask (gimg));
gimp_image_add_channel (gimg, gmask, 0);
channel_set_color (gmask, color);
channel_set_name (gmask, "Qmask");
drawable_set_name (GIMP_DRAWABLE (gmask), "Qmask");
channel_set_opacity (gmask, opacity);
gimage_mask_none (gimg); /* Clear the selection */
}

View File

@ -228,7 +228,7 @@ qmask_activate (GtkWidget *widget,
gmask = channel_copy (gimage_get_mask (gimg));
gimp_image_add_channel (gimg, gmask, 0);
channel_set_color (gmask, color);
channel_set_name (gmask, "Qmask");
drawable_set_name (GIMP_DRAWABLE (gmask), "Qmask");
channel_set_opacity (gmask, opacity);
gimage_mask_none (gimg); /* Clear the selection */
}

View File

@ -467,7 +467,7 @@ bezier_select_reset (BezierSelect *bezier_sel)
}
if (bezier_sel->mask)
channel_delete (bezier_sel->mask);
gtk_object_unref (GTK_OBJECT (bezier_sel->mask));
bezier_sel->state = BEZIER_START; /* we are starting the curve */
bezier_sel->draw = BEZIER_DRAW_ALL; /* draw everything by default */
@ -2481,9 +2481,12 @@ bezier_convert (BezierSelect *bezier_sel,
}
/* create a new mask */
bezier_sel->mask = channel_ref (channel_new_mask (gdisp->gimage,
gdisp->gimage->width,
gdisp->gimage->height));
bezier_sel->mask = channel_new_mask (gdisp->gimage,
gdisp->gimage->width,
gdisp->gimage->height);
gtk_object_ref (GTK_OBJECT (bezier_sel->mask));
gtk_object_sink (GTK_OBJECT (bezier_sel->mask));
/* allocate room for the scanlines */
bezier_sel->scanlines = g_malloc (sizeof (GSList *) * height);

View File

@ -49,14 +49,15 @@
#include "libgimp/gimpintl.h"
enum {
enum
{
REMOVED,
LAST_SIGNAL
};
static void gimp_channel_class_init (GimpChannelClass *klass);
static void gimp_channel_init (GimpChannel *channel);
static void gimp_channel_destroy (GtkObject *object);
static void gimp_channel_class_init (GimpChannelClass *klass);
static void gimp_channel_init (GimpChannel *channel);
static void gimp_channel_destroy (GtkObject *object);
static TempBuf * channel_preview_private (Channel *channel,
gint width,
@ -67,7 +68,7 @@ static guint channel_signals[LAST_SIGNAL] = { 0 };
static GimpDrawableClass *parent_class = NULL;
GtkType
gimp_channel_get_type ()
gimp_channel_get_type (void)
{
static GtkType channel_type = 0;
@ -85,7 +86,7 @@ gimp_channel_get_type ()
(GtkClassInitFunc) NULL,
};
channel_type = gtk_type_unique (gimp_drawable_get_type (), &channel_info);
channel_type = gtk_type_unique (GIMP_TYPE_DRAWABLE, &channel_info);
}
return channel_type;
@ -127,12 +128,12 @@ channel_validate (TileManager *tm,
}
Channel *
channel_new (GimpImage *gimage,
gint width,
gint height,
gchar *name,
gint opacity,
guchar *col)
channel_new (GimpImage *gimage,
gint width,
gint height,
const gchar *name,
gint opacity,
const guchar *col)
{
Channel * channel;
gint i;
@ -166,33 +167,18 @@ channel_new (GimpImage *gimage,
}
Channel *
channel_ref (Channel *channel)
channel_copy (const Channel *channel)
{
gtk_object_ref (GTK_OBJECT (channel));
gtk_object_sink (GTK_OBJECT (channel));
return channel;
}
void
channel_unref (Channel *channel)
{
gtk_object_unref (GTK_OBJECT (channel));
}
Channel *
channel_copy (Channel *channel)
{
gchar *channel_name;
Channel *new_channel;
PixelRegion srcPR, destPR;
gchar *ext;
gint number;
gchar *name;
gint len;
gchar *channel_name;
Channel *new_channel;
PixelRegion srcPR, destPR;
gchar *ext;
gint number;
const gchar *name;
gint len;
/* formulate the new channel name */
name = channel_get_name (channel);
name = drawable_get_name (GIMP_DRAWABLE (channel));
ext = strrchr (name, '#');
len = strlen (_("copy"));
if ((strlen (name) >= len &&
@ -223,8 +209,8 @@ channel_copy (Channel *channel)
copy_region (&srcPR, &destPR);
/* copy the parasites */
GIMP_DRAWABLE (new_channel)->parasites
= parasite_list_copy (GIMP_DRAWABLE (channel)->parasites);
GIMP_DRAWABLE (new_channel)->parasites =
parasite_list_copy (GIMP_DRAWABLE (channel)->parasites);
/* free up the channel_name memory */
g_free (channel_name);
@ -233,39 +219,39 @@ channel_copy (Channel *channel)
}
void
channel_set_name (Channel *channel,
gchar *name)
channel_set_name (Channel *channel,
const gchar *name)
{
gimp_drawable_set_name (GIMP_DRAWABLE (channel), name);
}
gchar *
channel_get_name (Channel *channel)
const gchar *
channel_get_name (const Channel *channel)
{
return gimp_drawable_get_name (GIMP_DRAWABLE (channel));
}
void
channel_set_color (Channel *channel,
guchar *color)
channel_set_color (Channel *channel,
const guchar *color)
{
gint i;
if (color)
{
{
for (i = 0; i < 3; i++)
channel->col[i] = color[i];
}
}
guchar *
channel_get_color (Channel *channel)
const guchar *
channel_get_color (const Channel *channel)
{
return (GIMP_CHANNEL (channel)->col);
return GIMP_CHANNEL (channel)->col;
}
int
channel_get_opacity (Channel *channel)
gint
channel_get_opacity (const Channel *channel)
{
return channel->opacity;
}
@ -284,6 +270,7 @@ channel_get_ID (gint ID)
GimpDrawable *drawable;
drawable = drawable_get_ID (ID);
if (drawable && GIMP_IS_CHANNEL (drawable))
return GIMP_CHANNEL (drawable);
else
@ -313,8 +300,7 @@ gimp_channel_destroy (GtkObject *object)
g_free (channel->segs_out);
if (GTK_OBJECT_CLASS (parent_class)->destroy)
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
/* The removed signal is sent out when the channel is no longer
@ -323,8 +309,7 @@ gimp_channel_destroy (GtkObject *object)
* to the removed signal to update bits of UI that are tied to a
* particular layer. */
void
channel_removed (Channel *channel,
gpointer data)
channel_removed (Channel *channel)
{
g_return_if_fail (channel != NULL);
g_return_if_fail (GIMP_IS_CHANNEL (channel));
@ -332,13 +317,12 @@ channel_removed (Channel *channel,
gtk_signal_emit (GTK_OBJECT (channel), channel_signals[REMOVED]);
}
void
channel_scale (Channel *channel,
gint new_width,
gint new_height)
{
PixelRegion srcPR, destPR;
PixelRegion srcPR, destPR;
TileManager *new_tiles;
if (new_width == 0 || new_height == 0)
@ -388,12 +372,12 @@ channel_resize (Channel *channel,
gint offx,
gint offy)
{
PixelRegion srcPR, destPR;
PixelRegion srcPR, destPR;
TileManager *new_tiles;
guchar bg = 0;
gint clear;
gint w, h;
gint x1, y1, x2, y2;
guchar bg = 0;
gint clear;
gint w, h;
gint x1, y1, x2, y2;
if (!new_width || !new_height)
return;
@ -507,8 +491,8 @@ channel_preview (Channel *channel,
{
/* Ok prime the cache with a large preview if the cache is invalid */
if (! GIMP_DRAWABLE (channel)->preview_valid &&
width <= PREVIEW_CACHE_PRIME_WIDTH &&
height <= PREVIEW_CACHE_PRIME_HEIGHT &&
width <= PREVIEW_CACHE_PRIME_WIDTH &&
height <= PREVIEW_CACHE_PRIME_HEIGHT &&
GIMP_DRAWABLE (channel)->gimage &&
GIMP_DRAWABLE (channel)->gimage->width > PREVIEW_CACHE_PRIME_WIDTH &&
GIMP_DRAWABLE (channel)->gimage->height > PREVIEW_CACHE_PRIME_HEIGHT)
@ -523,7 +507,7 @@ channel_preview (Channel *channel,
return tb;
}
/* Second call - should NOT visit the tile cache...*/
/* Second call - should NOT visit the tile cache... */
return channel_preview_private (channel, width, height);
}
@ -546,7 +530,9 @@ channel_preview_private (Channel *channel,
(ret_buf =
gimp_preview_cache_get (& (GIMP_DRAWABLE (channel)->preview_cache),
width, height)))
return ret_buf;
{
return ret_buf;
}
/* The hard way */
else
{
@ -585,10 +571,10 @@ channel_preview_private (Channel *channel,
}
void
channel_invalidate_previews (GimpImage* gimage)
channel_invalidate_previews (GimpImage *gimage)
{
GSList * tmp;
Channel * channel;
GSList *tmp;
Channel *channel;
g_return_if_fail (gimage != NULL);
@ -605,12 +591,12 @@ channel_invalidate_previews (GimpImage* gimage)
Tattoo
channel_get_tattoo (const Channel *channel)
{
return (gimp_drawable_get_tattoo (GIMP_DRAWABLE (channel)));
return gimp_drawable_get_tattoo (GIMP_DRAWABLE (channel));
}
void
channel_set_tattoo (const Channel *channel,
Tattoo value)
channel_set_tattoo (Channel *channel,
Tattoo value)
{
gimp_drawable_set_tattoo (GIMP_DRAWABLE (channel), value);
}
@ -624,7 +610,7 @@ channel_new_mask (GimpImage *gimage,
gint width,
gint height)
{
guchar black[3] = {0, 0, 0};
guchar black[3] = { 0, 0, 0 };
Channel *new_channel;
/* Create the new channel */
@ -649,7 +635,7 @@ channel_boundary (Channel *mask,
gint x2,
gint y2)
{
gint x3, y3, x4, y4;
gint x3, y3, x4, y4;
PixelRegion bPR;
if (! mask->boundary_known)
@ -714,7 +700,7 @@ channel_value (Channel *mask,
gint y)
{
Tile *tile;
gint val;
gint val;
/* Some checks to cut back on unnecessary work */
if (mask->bounds_known)
@ -745,13 +731,13 @@ channel_bounds (Channel *mask,
gint *x2,
gint *y2)
{
PixelRegion maskPR;
guchar *data, *data1;
gint x, y;
gint ex, ey;
gint tx1, tx2, ty1, ty2;
gint minx, maxx;
gpointer pr;
PixelRegion maskPR;
guchar *data, *data1;
gint x, y;
gint ex, ey;
gint tx1, tx2, ty1, ty2;
gint minx, maxx;
gpointer pr;
/* if the mask's bounds have already been reliably calculated... */
if (mask->bounds_known)
@ -855,10 +841,10 @@ channel_bounds (Channel *mask,
gboolean
channel_is_empty (Channel *mask)
{
PixelRegion maskPR;
guchar * data;
gint x, y;
gpointer pr;
PixelRegion maskPR;
guchar *data;
gint x, y;
gpointer pr;
if (mask->bounds_known)
return mask->empty;
@ -910,11 +896,11 @@ channel_add_segment (Channel *mask,
gint width,
gint value)
{
PixelRegion maskPR;
guchar *data;
gint val;
gint x2;
gpointer pr;
PixelRegion maskPR;
guchar *data;
gint val;
gint x2;
gpointer pr;
/* check horizontal extents... */
x2 = x + width;
@ -953,11 +939,11 @@ channel_sub_segment (Channel *mask,
gint width,
gint value)
{
PixelRegion maskPR;
guchar *data;
gint val;
gint x2;
gpointer pr;
PixelRegion maskPR;
guchar *data;
gint val;
gint x2;
gpointer pr;
/* check horizontal extents... */
x2 = x + width;
@ -996,9 +982,9 @@ channel_combine_rect (Channel *mask,
gint w,
gint h)
{
gint x2, y2;
gint x2, y2;
PixelRegion maskPR;
guchar color;
guchar color;
y2 = y + h;
x2 = x + w;
@ -1057,9 +1043,9 @@ channel_combine_ellipse (Channel *mask,
gint h,
gboolean antialias)
{
gint i, j;
gint x0, x1, x2;
gint val, last;
gint i, j;
gint x0, x1, x2;
gint val, last;
gfloat a_sqr, b_sqr, aob_sqr;
gfloat w_sqr, h_sqr;
gfloat y_sqr;
@ -1208,7 +1194,7 @@ channel_combine_sub_region_add (void *unused,
PixelRegion *destPR)
{
guchar *src, *dest;
gint x, y, val;
gint x, y, val;
src = srcPR->data;
dest = destPR->data;
@ -1234,7 +1220,7 @@ channel_combine_sub_region_sub (void *unused,
PixelRegion *destPR)
{
guchar *src, *dest;
gint x, y;
gint x, y;
src = srcPR->data;
dest = destPR->data;
@ -1259,7 +1245,7 @@ channel_combine_sub_region_intersect (void *unused,
PixelRegion *destPR)
{
guchar *src, *dest;
gint x, y;
gint x, y;
src = srcPR->data;
dest = destPR->data;
@ -1283,8 +1269,8 @@ channel_combine_mask (Channel *mask,
gint off_y)
{
PixelRegion srcPR, destPR;
gint x1, y1, x2, y2;
gint w, h;
gint x1, y1, x2, y2;
gint w, h;
x1 = CLAMP (off_x, 0, GIMP_DRAWABLE (mask)->width);
y1 = CLAMP (off_y, 0, GIMP_DRAWABLE (mask)->height);
@ -1493,7 +1479,7 @@ channel_border (Channel *mask,
gint radius_y)
{
PixelRegion bPR;
gint x1, y1, x2, y2;
gint x1, y1, x2, y2;
if (radius_x < 0 || radius_y < 0)
return;
@ -1537,7 +1523,7 @@ channel_grow (Channel *mask,
gint radius_y)
{
PixelRegion bPR;
gint x1, y1, x2, y2;
gint x1, y1, x2, y2;
if (radius_x == 0 && radius_y == 0)
return;
@ -1592,7 +1578,7 @@ channel_shrink (Channel *mask,
gboolean edge_lock)
{
PixelRegion bPR;
gint x1, y1, x2, y2;
gint x1, y1, x2, y2;
if (radius_x == 0 && radius_y == 0)
return;
@ -1636,11 +1622,11 @@ channel_translate (Channel *mask,
gint off_x,
gint off_y)
{
gint width, height;
Channel *tmp_mask;
PixelRegion srcPR, destPR;
guchar empty = 0;
gint x1, y1, x2, y2;
gint width, height;
Channel *tmp_mask;
PixelRegion srcPR, destPR;
guchar empty = 0;
gint x1, y1, x2, y2;
tmp_mask = NULL;
@ -1713,8 +1699,8 @@ channel_layer_alpha (Channel *mask,
Layer *layer)
{
PixelRegion srcPR, destPR;
guchar empty = 0;
gint x1, y1, x2, y2;
guchar empty = 0;
gint x1, y1, x2, y2;
/* push the current mask onto the undo stack */
channel_push_undo (mask);
@ -1772,4 +1758,3 @@ channel_invalidate_bounds (Channel *channel)
{
channel->bounds_known = FALSE;
}

View File

@ -65,145 +65,142 @@ typedef struct _MaskUndo MaskUndo;
struct _MaskUndo
{
TileManager *tiles; /* the actual mask */
gint x, y; /* offsets */
TileManager *tiles; /* the actual mask */
gint x, y; /* offsets */
};
/* function declarations */
Channel * channel_new (GimpImage *gimage,
gint width,
gint height,
gchar *name,
gint opacity,
guchar *col);
Channel * channel_copy (Channel *channel);
Channel * channel_ref (Channel *channel);
void channel_unref (Channel *channel);
Channel * channel_new (GimpImage *gimage,
gint width,
gint height,
const gchar *name,
gint opacity,
const guchar *col);
Channel * channel_copy (const Channel *channel);
gchar * channel_get_name (Channel *channel);
void channel_set_name (Channel *channel,
gchar *name);
const gchar * channel_get_name (const Channel *channel);
void channel_set_name (Channel *channel,
const gchar *name);
gint channel_get_opacity (Channel *channel);
void channel_set_opacity (Channel *channel,
gint opacity);
gint channel_get_opacity (const Channel *channel);
void channel_set_opacity (Channel *channel,
gint opacity);
guchar * channel_get_color (Channel *channel);
void channel_set_color (Channel *channel,
guchar *color);
const guchar * channel_get_color (const Channel *channel);
void channel_set_color (Channel *channel,
const guchar *color);
Channel * channel_get_ID (gint ID);
void channel_delete (Channel *channel);
void channel_removed (Channel *channel,
gpointer data);
void channel_scale (Channel *channel,
gint new_width,
gint new_height);
void channel_resize (Channel *channel,
gint new_width,
gint new_height,
gint offx,
gint offy);
void channel_update (Channel *channel);
Channel * channel_get_ID (gint ID);
void channel_delete (Channel *channel);
void channel_removed (Channel *channel);
void channel_scale (Channel *channel,
gint new_width,
gint new_height);
void channel_resize (Channel *channel,
gint new_width,
gint new_height,
gint offx,
gint offy);
void channel_update (Channel *channel);
/* access functions */
gboolean channel_toggle_visibility (Channel *channel);
TempBuf * channel_preview (Channel *channel,
gint width,
gint height);
gboolean channel_toggle_visibility (Channel *channel);
TempBuf * channel_preview (Channel *channel,
gint width,
gint height);
void channel_invalidate_previews (GimpImage *gimage);
void channel_invalidate_previews (GimpImage *gimage);
Tattoo channel_get_tattoo (const Channel *channel);
void channel_set_tattoo (const Channel *channel,
void channel_set_tattoo (Channel *channel,
Tattoo value);
/* selection mask functions */
Channel * channel_new_mask (GimpImage *gimage,
gint width,
gint height);
gboolean channel_boundary (Channel *mask,
BoundSeg **segs_in,
BoundSeg **segs_out,
gint *num_segs_in,
gint *num_segs_out,
gint x1,
gint y1,
gint x2,
gint y2);
gboolean channel_bounds (Channel *mask,
gint *x1,
gint *y1,
gint *x2,
gint *y2);
gint channel_value (Channel *mask,
gint x,
gint y);
gboolean channel_is_empty (Channel *mask);
void channel_add_segment (Channel *mask,
gint x,
gint y,
gint width,
gint value);
void channel_sub_segment (Channel *mask,
gint x,
gint y,
gint width,
gint value);
void channel_combine_rect (Channel *mask,
ChannelOps op,
gint x,
gint y,
gint w,
gint h);
void channel_combine_ellipse (Channel *mask,
ChannelOps op,
gint x,
gint y,
gint w,
gint h,
gboolean antialias);
void channel_combine_mask (Channel *mask,
Channel *add_on,
ChannelOps op,
gint off_x,
gint off_y);
void channel_feather (Channel *input,
Channel *output,
gdouble radius_x,
gdouble radius_y,
ChannelOps op,
gint off_x,
gint off_y);
Channel * channel_new_mask (GimpImage *gimage,
gint width,
gint height);
gboolean channel_boundary (Channel *mask,
BoundSeg **segs_in,
BoundSeg **segs_out,
gint *num_segs_in,
gint *num_segs_out,
gint x1,
gint y1,
gint x2,
gint y2);
gboolean channel_bounds (Channel *mask,
gint *x1,
gint *y1,
gint *x2,
gint *y2);
gint channel_value (Channel *mask,
gint x,
gint y);
gboolean channel_is_empty (Channel *mask);
void channel_add_segment (Channel *mask,
gint x,
gint y,
gint width,
gint value);
void channel_sub_segment (Channel *mask,
gint x,
gint y,
gint width,
gint value);
void channel_combine_rect (Channel *mask,
ChannelOps op,
gint x,
gint y,
gint w,
gint h);
void channel_combine_ellipse (Channel *mask,
ChannelOps op,
gint x,
gint y,
gint w,
gint h,
gboolean antialias);
void channel_combine_mask (Channel *mask,
Channel *add_on,
ChannelOps op,
gint off_x,
gint off_y);
void channel_feather (Channel *input,
Channel *output,
gdouble radius_x,
gdouble radius_y,
ChannelOps op,
gint off_x,
gint off_y);
void channel_push_undo (Channel *mask);
void channel_clear (Channel *mask);
void channel_invert (Channel *mask);
void channel_sharpen (Channel *mask);
void channel_all (Channel *mask);
void channel_push_undo (Channel *mask);
void channel_clear (Channel *mask);
void channel_invert (Channel *mask);
void channel_sharpen (Channel *mask);
void channel_all (Channel *mask);
void channel_border (Channel *mask,
gint radius_x,
gint radius_y);
void channel_grow (Channel *mask,
gint radius_x,
gint radius_y);
void channel_shrink (Channel *mask,
gint radius_x,
gint radius_y,
gboolean edge_lock);
void channel_border (Channel *mask,
gint radius_x,
gint radius_y);
void channel_grow (Channel *mask,
gint radius_x,
gint radius_y);
void channel_shrink (Channel *mask,
gint radius_x,
gint radius_y,
gboolean edge_lock);
void channel_translate (Channel *mask,
gint off_x,
gint off_y);
void channel_load (Channel *mask,
Channel *channel);
void channel_translate (Channel *mask,
gint off_x,
gint off_y);
void channel_load (Channel *mask,
Channel *channel);
void channel_invalidate_bounds (Channel *channel);
void channel_invalidate_bounds (Channel *channel);
#define drawable_channel GIMP_IS_CHANNEL

View File

@ -1457,7 +1457,8 @@ channel_widget_create (GimpImage *gimage,
break;
case AUXILLARY_CHANNEL:
channel_widget->label = gtk_label_new (channel_get_name (channel));
channel_widget->label =
gtk_label_new (drawable_get_name (GIMP_DRAWABLE (channel)));
break;
}
@ -2640,10 +2641,10 @@ edit_channel_query_ok_callback (GtkWidget *widget,
if (options->gimage)
{
/* Set the new channel name */
channel_set_name (channel,
gtk_entry_get_text (GTK_ENTRY (options->name_entry)));
drawable_set_name (GIMP_DRAWABLE (channel),
gtk_entry_get_text (GTK_ENTRY (options->name_entry)));
gtk_label_set_text (GTK_LABEL (options->channel_widget->label),
channel_get_name (channel));
drawable_get_name (GIMP_DRAWABLE (channel)));
if (channel->opacity != opacity)
{
@ -2736,8 +2737,9 @@ channels_dialog_edit_channel_query (ChannelWidget *channel_widget)
gtk_widget_set_usize (options->name_entry, 150, 0);
gtk_table_attach_defaults (GTK_TABLE (table), options->name_entry,
1, 2, 0, 1);
gtk_entry_set_text (GTK_ENTRY (options->name_entry),
channel_get_name (channel_widget->channel));
gtk_entry_set_text
(GTK_ENTRY (options->name_entry),
drawable_get_name (GIMP_DRAWABLE (channel_widget->channel)));
gtk_widget_show (options->name_entry);
/* The opacity scale */

View File

@ -49,14 +49,15 @@
#include "libgimp/gimpintl.h"
enum {
enum
{
REMOVED,
LAST_SIGNAL
};
static void gimp_channel_class_init (GimpChannelClass *klass);
static void gimp_channel_init (GimpChannel *channel);
static void gimp_channel_destroy (GtkObject *object);
static void gimp_channel_class_init (GimpChannelClass *klass);
static void gimp_channel_init (GimpChannel *channel);
static void gimp_channel_destroy (GtkObject *object);
static TempBuf * channel_preview_private (Channel *channel,
gint width,
@ -67,7 +68,7 @@ static guint channel_signals[LAST_SIGNAL] = { 0 };
static GimpDrawableClass *parent_class = NULL;
GtkType
gimp_channel_get_type ()
gimp_channel_get_type (void)
{
static GtkType channel_type = 0;
@ -85,7 +86,7 @@ gimp_channel_get_type ()
(GtkClassInitFunc) NULL,
};
channel_type = gtk_type_unique (gimp_drawable_get_type (), &channel_info);
channel_type = gtk_type_unique (GIMP_TYPE_DRAWABLE, &channel_info);
}
return channel_type;
@ -127,12 +128,12 @@ channel_validate (TileManager *tm,
}
Channel *
channel_new (GimpImage *gimage,
gint width,
gint height,
gchar *name,
gint opacity,
guchar *col)
channel_new (GimpImage *gimage,
gint width,
gint height,
const gchar *name,
gint opacity,
const guchar *col)
{
Channel * channel;
gint i;
@ -166,33 +167,18 @@ channel_new (GimpImage *gimage,
}
Channel *
channel_ref (Channel *channel)
channel_copy (const Channel *channel)
{
gtk_object_ref (GTK_OBJECT (channel));
gtk_object_sink (GTK_OBJECT (channel));
return channel;
}
void
channel_unref (Channel *channel)
{
gtk_object_unref (GTK_OBJECT (channel));
}
Channel *
channel_copy (Channel *channel)
{
gchar *channel_name;
Channel *new_channel;
PixelRegion srcPR, destPR;
gchar *ext;
gint number;
gchar *name;
gint len;
gchar *channel_name;
Channel *new_channel;
PixelRegion srcPR, destPR;
gchar *ext;
gint number;
const gchar *name;
gint len;
/* formulate the new channel name */
name = channel_get_name (channel);
name = drawable_get_name (GIMP_DRAWABLE (channel));
ext = strrchr (name, '#');
len = strlen (_("copy"));
if ((strlen (name) >= len &&
@ -223,8 +209,8 @@ channel_copy (Channel *channel)
copy_region (&srcPR, &destPR);
/* copy the parasites */
GIMP_DRAWABLE (new_channel)->parasites
= parasite_list_copy (GIMP_DRAWABLE (channel)->parasites);
GIMP_DRAWABLE (new_channel)->parasites =
parasite_list_copy (GIMP_DRAWABLE (channel)->parasites);
/* free up the channel_name memory */
g_free (channel_name);
@ -233,39 +219,39 @@ channel_copy (Channel *channel)
}
void
channel_set_name (Channel *channel,
gchar *name)
channel_set_name (Channel *channel,
const gchar *name)
{
gimp_drawable_set_name (GIMP_DRAWABLE (channel), name);
}
gchar *
channel_get_name (Channel *channel)
const gchar *
channel_get_name (const Channel *channel)
{
return gimp_drawable_get_name (GIMP_DRAWABLE (channel));
}
void
channel_set_color (Channel *channel,
guchar *color)
channel_set_color (Channel *channel,
const guchar *color)
{
gint i;
if (color)
{
{
for (i = 0; i < 3; i++)
channel->col[i] = color[i];
}
}
guchar *
channel_get_color (Channel *channel)
const guchar *
channel_get_color (const Channel *channel)
{
return (GIMP_CHANNEL (channel)->col);
return GIMP_CHANNEL (channel)->col;
}
int
channel_get_opacity (Channel *channel)
gint
channel_get_opacity (const Channel *channel)
{
return channel->opacity;
}
@ -284,6 +270,7 @@ channel_get_ID (gint ID)
GimpDrawable *drawable;
drawable = drawable_get_ID (ID);
if (drawable && GIMP_IS_CHANNEL (drawable))
return GIMP_CHANNEL (drawable);
else
@ -313,8 +300,7 @@ gimp_channel_destroy (GtkObject *object)
g_free (channel->segs_out);
if (GTK_OBJECT_CLASS (parent_class)->destroy)
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
/* The removed signal is sent out when the channel is no longer
@ -323,8 +309,7 @@ gimp_channel_destroy (GtkObject *object)
* to the removed signal to update bits of UI that are tied to a
* particular layer. */
void
channel_removed (Channel *channel,
gpointer data)
channel_removed (Channel *channel)
{
g_return_if_fail (channel != NULL);
g_return_if_fail (GIMP_IS_CHANNEL (channel));
@ -332,13 +317,12 @@ channel_removed (Channel *channel,
gtk_signal_emit (GTK_OBJECT (channel), channel_signals[REMOVED]);
}
void
channel_scale (Channel *channel,
gint new_width,
gint new_height)
{
PixelRegion srcPR, destPR;
PixelRegion srcPR, destPR;
TileManager *new_tiles;
if (new_width == 0 || new_height == 0)
@ -388,12 +372,12 @@ channel_resize (Channel *channel,
gint offx,
gint offy)
{
PixelRegion srcPR, destPR;
PixelRegion srcPR, destPR;
TileManager *new_tiles;
guchar bg = 0;
gint clear;
gint w, h;
gint x1, y1, x2, y2;
guchar bg = 0;
gint clear;
gint w, h;
gint x1, y1, x2, y2;
if (!new_width || !new_height)
return;
@ -507,8 +491,8 @@ channel_preview (Channel *channel,
{
/* Ok prime the cache with a large preview if the cache is invalid */
if (! GIMP_DRAWABLE (channel)->preview_valid &&
width <= PREVIEW_CACHE_PRIME_WIDTH &&
height <= PREVIEW_CACHE_PRIME_HEIGHT &&
width <= PREVIEW_CACHE_PRIME_WIDTH &&
height <= PREVIEW_CACHE_PRIME_HEIGHT &&
GIMP_DRAWABLE (channel)->gimage &&
GIMP_DRAWABLE (channel)->gimage->width > PREVIEW_CACHE_PRIME_WIDTH &&
GIMP_DRAWABLE (channel)->gimage->height > PREVIEW_CACHE_PRIME_HEIGHT)
@ -523,7 +507,7 @@ channel_preview (Channel *channel,
return tb;
}
/* Second call - should NOT visit the tile cache...*/
/* Second call - should NOT visit the tile cache... */
return channel_preview_private (channel, width, height);
}
@ -546,7 +530,9 @@ channel_preview_private (Channel *channel,
(ret_buf =
gimp_preview_cache_get (& (GIMP_DRAWABLE (channel)->preview_cache),
width, height)))
return ret_buf;
{
return ret_buf;
}
/* The hard way */
else
{
@ -585,10 +571,10 @@ channel_preview_private (Channel *channel,
}
void
channel_invalidate_previews (GimpImage* gimage)
channel_invalidate_previews (GimpImage *gimage)
{
GSList * tmp;
Channel * channel;
GSList *tmp;
Channel *channel;
g_return_if_fail (gimage != NULL);
@ -605,12 +591,12 @@ channel_invalidate_previews (GimpImage* gimage)
Tattoo
channel_get_tattoo (const Channel *channel)
{
return (gimp_drawable_get_tattoo (GIMP_DRAWABLE (channel)));
return gimp_drawable_get_tattoo (GIMP_DRAWABLE (channel));
}
void
channel_set_tattoo (const Channel *channel,
Tattoo value)
channel_set_tattoo (Channel *channel,
Tattoo value)
{
gimp_drawable_set_tattoo (GIMP_DRAWABLE (channel), value);
}
@ -624,7 +610,7 @@ channel_new_mask (GimpImage *gimage,
gint width,
gint height)
{
guchar black[3] = {0, 0, 0};
guchar black[3] = { 0, 0, 0 };
Channel *new_channel;
/* Create the new channel */
@ -649,7 +635,7 @@ channel_boundary (Channel *mask,
gint x2,
gint y2)
{
gint x3, y3, x4, y4;
gint x3, y3, x4, y4;
PixelRegion bPR;
if (! mask->boundary_known)
@ -714,7 +700,7 @@ channel_value (Channel *mask,
gint y)
{
Tile *tile;
gint val;
gint val;
/* Some checks to cut back on unnecessary work */
if (mask->bounds_known)
@ -745,13 +731,13 @@ channel_bounds (Channel *mask,
gint *x2,
gint *y2)
{
PixelRegion maskPR;
guchar *data, *data1;
gint x, y;
gint ex, ey;
gint tx1, tx2, ty1, ty2;
gint minx, maxx;
gpointer pr;
PixelRegion maskPR;
guchar *data, *data1;
gint x, y;
gint ex, ey;
gint tx1, tx2, ty1, ty2;
gint minx, maxx;
gpointer pr;
/* if the mask's bounds have already been reliably calculated... */
if (mask->bounds_known)
@ -855,10 +841,10 @@ channel_bounds (Channel *mask,
gboolean
channel_is_empty (Channel *mask)
{
PixelRegion maskPR;
guchar * data;
gint x, y;
gpointer pr;
PixelRegion maskPR;
guchar *data;
gint x, y;
gpointer pr;
if (mask->bounds_known)
return mask->empty;
@ -910,11 +896,11 @@ channel_add_segment (Channel *mask,
gint width,
gint value)
{
PixelRegion maskPR;
guchar *data;
gint val;
gint x2;
gpointer pr;
PixelRegion maskPR;
guchar *data;
gint val;
gint x2;
gpointer pr;
/* check horizontal extents... */
x2 = x + width;
@ -953,11 +939,11 @@ channel_sub_segment (Channel *mask,
gint width,
gint value)
{
PixelRegion maskPR;
guchar *data;
gint val;
gint x2;
gpointer pr;
PixelRegion maskPR;
guchar *data;
gint val;
gint x2;
gpointer pr;
/* check horizontal extents... */
x2 = x + width;
@ -996,9 +982,9 @@ channel_combine_rect (Channel *mask,
gint w,
gint h)
{
gint x2, y2;
gint x2, y2;
PixelRegion maskPR;
guchar color;
guchar color;
y2 = y + h;
x2 = x + w;
@ -1057,9 +1043,9 @@ channel_combine_ellipse (Channel *mask,
gint h,
gboolean antialias)
{
gint i, j;
gint x0, x1, x2;
gint val, last;
gint i, j;
gint x0, x1, x2;
gint val, last;
gfloat a_sqr, b_sqr, aob_sqr;
gfloat w_sqr, h_sqr;
gfloat y_sqr;
@ -1208,7 +1194,7 @@ channel_combine_sub_region_add (void *unused,
PixelRegion *destPR)
{
guchar *src, *dest;
gint x, y, val;
gint x, y, val;
src = srcPR->data;
dest = destPR->data;
@ -1234,7 +1220,7 @@ channel_combine_sub_region_sub (void *unused,
PixelRegion *destPR)
{
guchar *src, *dest;
gint x, y;
gint x, y;
src = srcPR->data;
dest = destPR->data;
@ -1259,7 +1245,7 @@ channel_combine_sub_region_intersect (void *unused,
PixelRegion *destPR)
{
guchar *src, *dest;
gint x, y;
gint x, y;
src = srcPR->data;
dest = destPR->data;
@ -1283,8 +1269,8 @@ channel_combine_mask (Channel *mask,
gint off_y)
{
PixelRegion srcPR, destPR;
gint x1, y1, x2, y2;
gint w, h;
gint x1, y1, x2, y2;
gint w, h;
x1 = CLAMP (off_x, 0, GIMP_DRAWABLE (mask)->width);
y1 = CLAMP (off_y, 0, GIMP_DRAWABLE (mask)->height);
@ -1493,7 +1479,7 @@ channel_border (Channel *mask,
gint radius_y)
{
PixelRegion bPR;
gint x1, y1, x2, y2;
gint x1, y1, x2, y2;
if (radius_x < 0 || radius_y < 0)
return;
@ -1537,7 +1523,7 @@ channel_grow (Channel *mask,
gint radius_y)
{
PixelRegion bPR;
gint x1, y1, x2, y2;
gint x1, y1, x2, y2;
if (radius_x == 0 && radius_y == 0)
return;
@ -1592,7 +1578,7 @@ channel_shrink (Channel *mask,
gboolean edge_lock)
{
PixelRegion bPR;
gint x1, y1, x2, y2;
gint x1, y1, x2, y2;
if (radius_x == 0 && radius_y == 0)
return;
@ -1636,11 +1622,11 @@ channel_translate (Channel *mask,
gint off_x,
gint off_y)
{
gint width, height;
Channel *tmp_mask;
PixelRegion srcPR, destPR;
guchar empty = 0;
gint x1, y1, x2, y2;
gint width, height;
Channel *tmp_mask;
PixelRegion srcPR, destPR;
guchar empty = 0;
gint x1, y1, x2, y2;
tmp_mask = NULL;
@ -1713,8 +1699,8 @@ channel_layer_alpha (Channel *mask,
Layer *layer)
{
PixelRegion srcPR, destPR;
guchar empty = 0;
gint x1, y1, x2, y2;
guchar empty = 0;
gint x1, y1, x2, y2;
/* push the current mask onto the undo stack */
channel_push_undo (mask);
@ -1772,4 +1758,3 @@ channel_invalidate_bounds (Channel *channel)
{
channel->bounds_known = FALSE;
}

View File

@ -65,145 +65,142 @@ typedef struct _MaskUndo MaskUndo;
struct _MaskUndo
{
TileManager *tiles; /* the actual mask */
gint x, y; /* offsets */
TileManager *tiles; /* the actual mask */
gint x, y; /* offsets */
};
/* function declarations */
Channel * channel_new (GimpImage *gimage,
gint width,
gint height,
gchar *name,
gint opacity,
guchar *col);
Channel * channel_copy (Channel *channel);
Channel * channel_ref (Channel *channel);
void channel_unref (Channel *channel);
Channel * channel_new (GimpImage *gimage,
gint width,
gint height,
const gchar *name,
gint opacity,
const guchar *col);
Channel * channel_copy (const Channel *channel);
gchar * channel_get_name (Channel *channel);
void channel_set_name (Channel *channel,
gchar *name);
const gchar * channel_get_name (const Channel *channel);
void channel_set_name (Channel *channel,
const gchar *name);
gint channel_get_opacity (Channel *channel);
void channel_set_opacity (Channel *channel,
gint opacity);
gint channel_get_opacity (const Channel *channel);
void channel_set_opacity (Channel *channel,
gint opacity);
guchar * channel_get_color (Channel *channel);
void channel_set_color (Channel *channel,
guchar *color);
const guchar * channel_get_color (const Channel *channel);
void channel_set_color (Channel *channel,
const guchar *color);
Channel * channel_get_ID (gint ID);
void channel_delete (Channel *channel);
void channel_removed (Channel *channel,
gpointer data);
void channel_scale (Channel *channel,
gint new_width,
gint new_height);
void channel_resize (Channel *channel,
gint new_width,
gint new_height,
gint offx,
gint offy);
void channel_update (Channel *channel);
Channel * channel_get_ID (gint ID);
void channel_delete (Channel *channel);
void channel_removed (Channel *channel);
void channel_scale (Channel *channel,
gint new_width,
gint new_height);
void channel_resize (Channel *channel,
gint new_width,
gint new_height,
gint offx,
gint offy);
void channel_update (Channel *channel);
/* access functions */
gboolean channel_toggle_visibility (Channel *channel);
TempBuf * channel_preview (Channel *channel,
gint width,
gint height);
gboolean channel_toggle_visibility (Channel *channel);
TempBuf * channel_preview (Channel *channel,
gint width,
gint height);
void channel_invalidate_previews (GimpImage *gimage);
void channel_invalidate_previews (GimpImage *gimage);
Tattoo channel_get_tattoo (const Channel *channel);
void channel_set_tattoo (const Channel *channel,
void channel_set_tattoo (Channel *channel,
Tattoo value);
/* selection mask functions */
Channel * channel_new_mask (GimpImage *gimage,
gint width,
gint height);
gboolean channel_boundary (Channel *mask,
BoundSeg **segs_in,
BoundSeg **segs_out,
gint *num_segs_in,
gint *num_segs_out,
gint x1,
gint y1,
gint x2,
gint y2);
gboolean channel_bounds (Channel *mask,
gint *x1,
gint *y1,
gint *x2,
gint *y2);
gint channel_value (Channel *mask,
gint x,
gint y);
gboolean channel_is_empty (Channel *mask);
void channel_add_segment (Channel *mask,
gint x,
gint y,
gint width,
gint value);
void channel_sub_segment (Channel *mask,
gint x,
gint y,
gint width,
gint value);
void channel_combine_rect (Channel *mask,
ChannelOps op,
gint x,
gint y,
gint w,
gint h);
void channel_combine_ellipse (Channel *mask,
ChannelOps op,
gint x,
gint y,
gint w,
gint h,
gboolean antialias);
void channel_combine_mask (Channel *mask,
Channel *add_on,
ChannelOps op,
gint off_x,
gint off_y);
void channel_feather (Channel *input,
Channel *output,
gdouble radius_x,
gdouble radius_y,
ChannelOps op,
gint off_x,
gint off_y);
Channel * channel_new_mask (GimpImage *gimage,
gint width,
gint height);
gboolean channel_boundary (Channel *mask,
BoundSeg **segs_in,
BoundSeg **segs_out,
gint *num_segs_in,
gint *num_segs_out,
gint x1,
gint y1,
gint x2,
gint y2);
gboolean channel_bounds (Channel *mask,
gint *x1,
gint *y1,
gint *x2,
gint *y2);
gint channel_value (Channel *mask,
gint x,
gint y);
gboolean channel_is_empty (Channel *mask);
void channel_add_segment (Channel *mask,
gint x,
gint y,
gint width,
gint value);
void channel_sub_segment (Channel *mask,
gint x,
gint y,
gint width,
gint value);
void channel_combine_rect (Channel *mask,
ChannelOps op,
gint x,
gint y,
gint w,
gint h);
void channel_combine_ellipse (Channel *mask,
ChannelOps op,
gint x,
gint y,
gint w,
gint h,
gboolean antialias);
void channel_combine_mask (Channel *mask,
Channel *add_on,
ChannelOps op,
gint off_x,
gint off_y);
void channel_feather (Channel *input,
Channel *output,
gdouble radius_x,
gdouble radius_y,
ChannelOps op,
gint off_x,
gint off_y);
void channel_push_undo (Channel *mask);
void channel_clear (Channel *mask);
void channel_invert (Channel *mask);
void channel_sharpen (Channel *mask);
void channel_all (Channel *mask);
void channel_push_undo (Channel *mask);
void channel_clear (Channel *mask);
void channel_invert (Channel *mask);
void channel_sharpen (Channel *mask);
void channel_all (Channel *mask);
void channel_border (Channel *mask,
gint radius_x,
gint radius_y);
void channel_grow (Channel *mask,
gint radius_x,
gint radius_y);
void channel_shrink (Channel *mask,
gint radius_x,
gint radius_y,
gboolean edge_lock);
void channel_border (Channel *mask,
gint radius_x,
gint radius_y);
void channel_grow (Channel *mask,
gint radius_x,
gint radius_y);
void channel_shrink (Channel *mask,
gint radius_x,
gint radius_y,
gboolean edge_lock);
void channel_translate (Channel *mask,
gint off_x,
gint off_y);
void channel_load (Channel *mask,
Channel *channel);
void channel_translate (Channel *mask,
gint off_x,
gint off_y);
void channel_load (Channel *mask,
Channel *channel);
void channel_invalidate_bounds (Channel *channel);
void channel_invalidate_bounds (Channel *channel);
#define drawable_channel GIMP_IS_CHANNEL

View File

@ -49,14 +49,15 @@
#include "libgimp/gimpintl.h"
enum {
enum
{
REMOVED,
LAST_SIGNAL
};
static void gimp_channel_class_init (GimpChannelClass *klass);
static void gimp_channel_init (GimpChannel *channel);
static void gimp_channel_destroy (GtkObject *object);
static void gimp_channel_class_init (GimpChannelClass *klass);
static void gimp_channel_init (GimpChannel *channel);
static void gimp_channel_destroy (GtkObject *object);
static TempBuf * channel_preview_private (Channel *channel,
gint width,
@ -67,7 +68,7 @@ static guint channel_signals[LAST_SIGNAL] = { 0 };
static GimpDrawableClass *parent_class = NULL;
GtkType
gimp_channel_get_type ()
gimp_channel_get_type (void)
{
static GtkType channel_type = 0;
@ -85,7 +86,7 @@ gimp_channel_get_type ()
(GtkClassInitFunc) NULL,
};
channel_type = gtk_type_unique (gimp_drawable_get_type (), &channel_info);
channel_type = gtk_type_unique (GIMP_TYPE_DRAWABLE, &channel_info);
}
return channel_type;
@ -127,12 +128,12 @@ channel_validate (TileManager *tm,
}
Channel *
channel_new (GimpImage *gimage,
gint width,
gint height,
gchar *name,
gint opacity,
guchar *col)
channel_new (GimpImage *gimage,
gint width,
gint height,
const gchar *name,
gint opacity,
const guchar *col)
{
Channel * channel;
gint i;
@ -166,33 +167,18 @@ channel_new (GimpImage *gimage,
}
Channel *
channel_ref (Channel *channel)
channel_copy (const Channel *channel)
{
gtk_object_ref (GTK_OBJECT (channel));
gtk_object_sink (GTK_OBJECT (channel));
return channel;
}
void
channel_unref (Channel *channel)
{
gtk_object_unref (GTK_OBJECT (channel));
}
Channel *
channel_copy (Channel *channel)
{
gchar *channel_name;
Channel *new_channel;
PixelRegion srcPR, destPR;
gchar *ext;
gint number;
gchar *name;
gint len;
gchar *channel_name;
Channel *new_channel;
PixelRegion srcPR, destPR;
gchar *ext;
gint number;
const gchar *name;
gint len;
/* formulate the new channel name */
name = channel_get_name (channel);
name = drawable_get_name (GIMP_DRAWABLE (channel));
ext = strrchr (name, '#');
len = strlen (_("copy"));
if ((strlen (name) >= len &&
@ -223,8 +209,8 @@ channel_copy (Channel *channel)
copy_region (&srcPR, &destPR);
/* copy the parasites */
GIMP_DRAWABLE (new_channel)->parasites
= parasite_list_copy (GIMP_DRAWABLE (channel)->parasites);
GIMP_DRAWABLE (new_channel)->parasites =
parasite_list_copy (GIMP_DRAWABLE (channel)->parasites);
/* free up the channel_name memory */
g_free (channel_name);
@ -233,39 +219,39 @@ channel_copy (Channel *channel)
}
void
channel_set_name (Channel *channel,
gchar *name)
channel_set_name (Channel *channel,
const gchar *name)
{
gimp_drawable_set_name (GIMP_DRAWABLE (channel), name);
}
gchar *
channel_get_name (Channel *channel)
const gchar *
channel_get_name (const Channel *channel)
{
return gimp_drawable_get_name (GIMP_DRAWABLE (channel));
}
void
channel_set_color (Channel *channel,
guchar *color)
channel_set_color (Channel *channel,
const guchar *color)
{
gint i;
if (color)
{
{
for (i = 0; i < 3; i++)
channel->col[i] = color[i];
}
}
guchar *
channel_get_color (Channel *channel)
const guchar *
channel_get_color (const Channel *channel)
{
return (GIMP_CHANNEL (channel)->col);
return GIMP_CHANNEL (channel)->col;
}
int
channel_get_opacity (Channel *channel)
gint
channel_get_opacity (const Channel *channel)
{
return channel->opacity;
}
@ -284,6 +270,7 @@ channel_get_ID (gint ID)
GimpDrawable *drawable;
drawable = drawable_get_ID (ID);
if (drawable && GIMP_IS_CHANNEL (drawable))
return GIMP_CHANNEL (drawable);
else
@ -313,8 +300,7 @@ gimp_channel_destroy (GtkObject *object)
g_free (channel->segs_out);
if (GTK_OBJECT_CLASS (parent_class)->destroy)
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
/* The removed signal is sent out when the channel is no longer
@ -323,8 +309,7 @@ gimp_channel_destroy (GtkObject *object)
* to the removed signal to update bits of UI that are tied to a
* particular layer. */
void
channel_removed (Channel *channel,
gpointer data)
channel_removed (Channel *channel)
{
g_return_if_fail (channel != NULL);
g_return_if_fail (GIMP_IS_CHANNEL (channel));
@ -332,13 +317,12 @@ channel_removed (Channel *channel,
gtk_signal_emit (GTK_OBJECT (channel), channel_signals[REMOVED]);
}
void
channel_scale (Channel *channel,
gint new_width,
gint new_height)
{
PixelRegion srcPR, destPR;
PixelRegion srcPR, destPR;
TileManager *new_tiles;
if (new_width == 0 || new_height == 0)
@ -388,12 +372,12 @@ channel_resize (Channel *channel,
gint offx,
gint offy)
{
PixelRegion srcPR, destPR;
PixelRegion srcPR, destPR;
TileManager *new_tiles;
guchar bg = 0;
gint clear;
gint w, h;
gint x1, y1, x2, y2;
guchar bg = 0;
gint clear;
gint w, h;
gint x1, y1, x2, y2;
if (!new_width || !new_height)
return;
@ -507,8 +491,8 @@ channel_preview (Channel *channel,
{
/* Ok prime the cache with a large preview if the cache is invalid */
if (! GIMP_DRAWABLE (channel)->preview_valid &&
width <= PREVIEW_CACHE_PRIME_WIDTH &&
height <= PREVIEW_CACHE_PRIME_HEIGHT &&
width <= PREVIEW_CACHE_PRIME_WIDTH &&
height <= PREVIEW_CACHE_PRIME_HEIGHT &&
GIMP_DRAWABLE (channel)->gimage &&
GIMP_DRAWABLE (channel)->gimage->width > PREVIEW_CACHE_PRIME_WIDTH &&
GIMP_DRAWABLE (channel)->gimage->height > PREVIEW_CACHE_PRIME_HEIGHT)
@ -523,7 +507,7 @@ channel_preview (Channel *channel,
return tb;
}
/* Second call - should NOT visit the tile cache...*/
/* Second call - should NOT visit the tile cache... */
return channel_preview_private (channel, width, height);
}
@ -546,7 +530,9 @@ channel_preview_private (Channel *channel,
(ret_buf =
gimp_preview_cache_get (& (GIMP_DRAWABLE (channel)->preview_cache),
width, height)))
return ret_buf;
{
return ret_buf;
}
/* The hard way */
else
{
@ -585,10 +571,10 @@ channel_preview_private (Channel *channel,
}
void
channel_invalidate_previews (GimpImage* gimage)
channel_invalidate_previews (GimpImage *gimage)
{
GSList * tmp;
Channel * channel;
GSList *tmp;
Channel *channel;
g_return_if_fail (gimage != NULL);
@ -605,12 +591,12 @@ channel_invalidate_previews (GimpImage* gimage)
Tattoo
channel_get_tattoo (const Channel *channel)
{
return (gimp_drawable_get_tattoo (GIMP_DRAWABLE (channel)));
return gimp_drawable_get_tattoo (GIMP_DRAWABLE (channel));
}
void
channel_set_tattoo (const Channel *channel,
Tattoo value)
channel_set_tattoo (Channel *channel,
Tattoo value)
{
gimp_drawable_set_tattoo (GIMP_DRAWABLE (channel), value);
}
@ -624,7 +610,7 @@ channel_new_mask (GimpImage *gimage,
gint width,
gint height)
{
guchar black[3] = {0, 0, 0};
guchar black[3] = { 0, 0, 0 };
Channel *new_channel;
/* Create the new channel */
@ -649,7 +635,7 @@ channel_boundary (Channel *mask,
gint x2,
gint y2)
{
gint x3, y3, x4, y4;
gint x3, y3, x4, y4;
PixelRegion bPR;
if (! mask->boundary_known)
@ -714,7 +700,7 @@ channel_value (Channel *mask,
gint y)
{
Tile *tile;
gint val;
gint val;
/* Some checks to cut back on unnecessary work */
if (mask->bounds_known)
@ -745,13 +731,13 @@ channel_bounds (Channel *mask,
gint *x2,
gint *y2)
{
PixelRegion maskPR;
guchar *data, *data1;
gint x, y;
gint ex, ey;
gint tx1, tx2, ty1, ty2;
gint minx, maxx;
gpointer pr;
PixelRegion maskPR;
guchar *data, *data1;
gint x, y;
gint ex, ey;
gint tx1, tx2, ty1, ty2;
gint minx, maxx;
gpointer pr;
/* if the mask's bounds have already been reliably calculated... */
if (mask->bounds_known)
@ -855,10 +841,10 @@ channel_bounds (Channel *mask,
gboolean
channel_is_empty (Channel *mask)
{
PixelRegion maskPR;
guchar * data;
gint x, y;
gpointer pr;
PixelRegion maskPR;
guchar *data;
gint x, y;
gpointer pr;
if (mask->bounds_known)
return mask->empty;
@ -910,11 +896,11 @@ channel_add_segment (Channel *mask,
gint width,
gint value)
{
PixelRegion maskPR;
guchar *data;
gint val;
gint x2;
gpointer pr;
PixelRegion maskPR;
guchar *data;
gint val;
gint x2;
gpointer pr;
/* check horizontal extents... */
x2 = x + width;
@ -953,11 +939,11 @@ channel_sub_segment (Channel *mask,
gint width,
gint value)
{
PixelRegion maskPR;
guchar *data;
gint val;
gint x2;
gpointer pr;
PixelRegion maskPR;
guchar *data;
gint val;
gint x2;
gpointer pr;
/* check horizontal extents... */
x2 = x + width;
@ -996,9 +982,9 @@ channel_combine_rect (Channel *mask,
gint w,
gint h)
{
gint x2, y2;
gint x2, y2;
PixelRegion maskPR;
guchar color;
guchar color;
y2 = y + h;
x2 = x + w;
@ -1057,9 +1043,9 @@ channel_combine_ellipse (Channel *mask,
gint h,
gboolean antialias)
{
gint i, j;
gint x0, x1, x2;
gint val, last;
gint i, j;
gint x0, x1, x2;
gint val, last;
gfloat a_sqr, b_sqr, aob_sqr;
gfloat w_sqr, h_sqr;
gfloat y_sqr;
@ -1208,7 +1194,7 @@ channel_combine_sub_region_add (void *unused,
PixelRegion *destPR)
{
guchar *src, *dest;
gint x, y, val;
gint x, y, val;
src = srcPR->data;
dest = destPR->data;
@ -1234,7 +1220,7 @@ channel_combine_sub_region_sub (void *unused,
PixelRegion *destPR)
{
guchar *src, *dest;
gint x, y;
gint x, y;
src = srcPR->data;
dest = destPR->data;
@ -1259,7 +1245,7 @@ channel_combine_sub_region_intersect (void *unused,
PixelRegion *destPR)
{
guchar *src, *dest;
gint x, y;
gint x, y;
src = srcPR->data;
dest = destPR->data;
@ -1283,8 +1269,8 @@ channel_combine_mask (Channel *mask,
gint off_y)
{
PixelRegion srcPR, destPR;
gint x1, y1, x2, y2;
gint w, h;
gint x1, y1, x2, y2;
gint w, h;
x1 = CLAMP (off_x, 0, GIMP_DRAWABLE (mask)->width);
y1 = CLAMP (off_y, 0, GIMP_DRAWABLE (mask)->height);
@ -1493,7 +1479,7 @@ channel_border (Channel *mask,
gint radius_y)
{
PixelRegion bPR;
gint x1, y1, x2, y2;
gint x1, y1, x2, y2;
if (radius_x < 0 || radius_y < 0)
return;
@ -1537,7 +1523,7 @@ channel_grow (Channel *mask,
gint radius_y)
{
PixelRegion bPR;
gint x1, y1, x2, y2;
gint x1, y1, x2, y2;
if (radius_x == 0 && radius_y == 0)
return;
@ -1592,7 +1578,7 @@ channel_shrink (Channel *mask,
gboolean edge_lock)
{
PixelRegion bPR;
gint x1, y1, x2, y2;
gint x1, y1, x2, y2;
if (radius_x == 0 && radius_y == 0)
return;
@ -1636,11 +1622,11 @@ channel_translate (Channel *mask,
gint off_x,
gint off_y)
{
gint width, height;
Channel *tmp_mask;
PixelRegion srcPR, destPR;
guchar empty = 0;
gint x1, y1, x2, y2;
gint width, height;
Channel *tmp_mask;
PixelRegion srcPR, destPR;
guchar empty = 0;
gint x1, y1, x2, y2;
tmp_mask = NULL;
@ -1713,8 +1699,8 @@ channel_layer_alpha (Channel *mask,
Layer *layer)
{
PixelRegion srcPR, destPR;
guchar empty = 0;
gint x1, y1, x2, y2;
guchar empty = 0;
gint x1, y1, x2, y2;
/* push the current mask onto the undo stack */
channel_push_undo (mask);
@ -1772,4 +1758,3 @@ channel_invalidate_bounds (Channel *channel)
{
channel->bounds_known = FALSE;
}

View File

@ -65,145 +65,142 @@ typedef struct _MaskUndo MaskUndo;
struct _MaskUndo
{
TileManager *tiles; /* the actual mask */
gint x, y; /* offsets */
TileManager *tiles; /* the actual mask */
gint x, y; /* offsets */
};
/* function declarations */
Channel * channel_new (GimpImage *gimage,
gint width,
gint height,
gchar *name,
gint opacity,
guchar *col);
Channel * channel_copy (Channel *channel);
Channel * channel_ref (Channel *channel);
void channel_unref (Channel *channel);
Channel * channel_new (GimpImage *gimage,
gint width,
gint height,
const gchar *name,
gint opacity,
const guchar *col);
Channel * channel_copy (const Channel *channel);
gchar * channel_get_name (Channel *channel);
void channel_set_name (Channel *channel,
gchar *name);
const gchar * channel_get_name (const Channel *channel);
void channel_set_name (Channel *channel,
const gchar *name);
gint channel_get_opacity (Channel *channel);
void channel_set_opacity (Channel *channel,
gint opacity);
gint channel_get_opacity (const Channel *channel);
void channel_set_opacity (Channel *channel,
gint opacity);
guchar * channel_get_color (Channel *channel);
void channel_set_color (Channel *channel,
guchar *color);
const guchar * channel_get_color (const Channel *channel);
void channel_set_color (Channel *channel,
const guchar *color);
Channel * channel_get_ID (gint ID);
void channel_delete (Channel *channel);
void channel_removed (Channel *channel,
gpointer data);
void channel_scale (Channel *channel,
gint new_width,
gint new_height);
void channel_resize (Channel *channel,
gint new_width,
gint new_height,
gint offx,
gint offy);
void channel_update (Channel *channel);
Channel * channel_get_ID (gint ID);
void channel_delete (Channel *channel);
void channel_removed (Channel *channel);
void channel_scale (Channel *channel,
gint new_width,
gint new_height);
void channel_resize (Channel *channel,
gint new_width,
gint new_height,
gint offx,
gint offy);
void channel_update (Channel *channel);
/* access functions */
gboolean channel_toggle_visibility (Channel *channel);
TempBuf * channel_preview (Channel *channel,
gint width,
gint height);
gboolean channel_toggle_visibility (Channel *channel);
TempBuf * channel_preview (Channel *channel,
gint width,
gint height);
void channel_invalidate_previews (GimpImage *gimage);
void channel_invalidate_previews (GimpImage *gimage);
Tattoo channel_get_tattoo (const Channel *channel);
void channel_set_tattoo (const Channel *channel,
void channel_set_tattoo (Channel *channel,
Tattoo value);
/* selection mask functions */
Channel * channel_new_mask (GimpImage *gimage,
gint width,
gint height);
gboolean channel_boundary (Channel *mask,
BoundSeg **segs_in,
BoundSeg **segs_out,
gint *num_segs_in,
gint *num_segs_out,
gint x1,
gint y1,
gint x2,
gint y2);
gboolean channel_bounds (Channel *mask,
gint *x1,
gint *y1,
gint *x2,
gint *y2);
gint channel_value (Channel *mask,
gint x,
gint y);
gboolean channel_is_empty (Channel *mask);
void channel_add_segment (Channel *mask,
gint x,
gint y,
gint width,
gint value);
void channel_sub_segment (Channel *mask,
gint x,
gint y,
gint width,
gint value);
void channel_combine_rect (Channel *mask,
ChannelOps op,
gint x,
gint y,
gint w,
gint h);
void channel_combine_ellipse (Channel *mask,
ChannelOps op,
gint x,
gint y,
gint w,
gint h,
gboolean antialias);
void channel_combine_mask (Channel *mask,
Channel *add_on,
ChannelOps op,
gint off_x,
gint off_y);
void channel_feather (Channel *input,
Channel *output,
gdouble radius_x,
gdouble radius_y,
ChannelOps op,
gint off_x,
gint off_y);
Channel * channel_new_mask (GimpImage *gimage,
gint width,
gint height);
gboolean channel_boundary (Channel *mask,
BoundSeg **segs_in,
BoundSeg **segs_out,
gint *num_segs_in,
gint *num_segs_out,
gint x1,
gint y1,
gint x2,
gint y2);
gboolean channel_bounds (Channel *mask,
gint *x1,
gint *y1,
gint *x2,
gint *y2);
gint channel_value (Channel *mask,
gint x,
gint y);
gboolean channel_is_empty (Channel *mask);
void channel_add_segment (Channel *mask,
gint x,
gint y,
gint width,
gint value);
void channel_sub_segment (Channel *mask,
gint x,
gint y,
gint width,
gint value);
void channel_combine_rect (Channel *mask,
ChannelOps op,
gint x,
gint y,
gint w,
gint h);
void channel_combine_ellipse (Channel *mask,
ChannelOps op,
gint x,
gint y,
gint w,
gint h,
gboolean antialias);
void channel_combine_mask (Channel *mask,
Channel *add_on,
ChannelOps op,
gint off_x,
gint off_y);
void channel_feather (Channel *input,
Channel *output,
gdouble radius_x,
gdouble radius_y,
ChannelOps op,
gint off_x,
gint off_y);
void channel_push_undo (Channel *mask);
void channel_clear (Channel *mask);
void channel_invert (Channel *mask);
void channel_sharpen (Channel *mask);
void channel_all (Channel *mask);
void channel_push_undo (Channel *mask);
void channel_clear (Channel *mask);
void channel_invert (Channel *mask);
void channel_sharpen (Channel *mask);
void channel_all (Channel *mask);
void channel_border (Channel *mask,
gint radius_x,
gint radius_y);
void channel_grow (Channel *mask,
gint radius_x,
gint radius_y);
void channel_shrink (Channel *mask,
gint radius_x,
gint radius_y,
gboolean edge_lock);
void channel_border (Channel *mask,
gint radius_x,
gint radius_y);
void channel_grow (Channel *mask,
gint radius_x,
gint radius_y);
void channel_shrink (Channel *mask,
gint radius_x,
gint radius_y,
gboolean edge_lock);
void channel_translate (Channel *mask,
gint off_x,
gint off_y);
void channel_load (Channel *mask,
Channel *channel);
void channel_translate (Channel *mask,
gint off_x,
gint off_y);
void channel_load (Channel *mask,
Channel *channel);
void channel_invalidate_bounds (Channel *channel);
void channel_invalidate_bounds (Channel *channel);
#define drawable_channel GIMP_IS_CHANNEL

View File

@ -57,34 +57,49 @@ static GimpDrawableClass *parent_class = NULL;
GtkType
gimp_drawable_get_type (void)
{
static GtkType type;
GIMP_TYPE_INIT (type,
GimpDrawable,
GimpDrawableClass,
gimp_drawable_init,
gimp_drawable_class_init,
GIMP_TYPE_OBJECT);
return type;
static GtkType drawable_type = 0;
if (! drawable_type)
{
GtkTypeInfo drawable_info =
{
"GimpDrawable",
sizeof (GimpDrawable),
sizeof (GimpDrawableClass),
(GtkClassInitFunc) gimp_drawable_class_init,
(GtkObjectInitFunc) gimp_drawable_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL,
};
drawable_type = gtk_type_unique (GIMP_TYPE_OBJECT, &drawable_info);
}
return drawable_type;
}
static void
gimp_drawable_class_init (GimpDrawableClass *class)
gimp_drawable_class_init (GimpDrawableClass *klass)
{
GtkObjectClass *object_class;
GtkType type = GIMP_TYPE_DRAWABLE;
object_class = GTK_OBJECT_CLASS (class);
object_class = GTK_OBJECT_CLASS (klass);
parent_class = gtk_type_class (GIMP_TYPE_OBJECT);
gimp_drawable_signals[INVALIDATE_PREVIEW] =
gimp_signal_new ("invalidate_pr", GTK_RUN_LAST, type,
GTK_SIGNAL_OFFSET(GimpDrawableClass,
invalidate_preview),
gimp_sigtype_void);
gtk_object_class_add_signals (object_class, gimp_drawable_signals, LAST_SIGNAL);
gimp_drawable_signals[INVALIDATE_PREVIEW] =
gimp_signal_new ("invalidate_pr", GTK_RUN_LAST, type,
GTK_SIGNAL_OFFSET (GimpDrawableClass,
invalidate_preview),
gimp_sigtype_void);
gtk_object_class_add_signals (object_class, gimp_drawable_signals,
LAST_SIGNAL);
object_class->destroy = gimp_drawable_destroy;
klass->invalidate_preview = NULL;
}
@ -97,27 +112,29 @@ static GHashTable *gimp_drawable_table = NULL;
/**************************/
/* Function definitions */
GimpDrawable*
GimpDrawable *
gimp_drawable_get_ID (gint drawable_id)
{
if (gimp_drawable_table == NULL)
return NULL;
return (GimpDrawable*) g_hash_table_lookup (gimp_drawable_table,
(gpointer) drawable_id);
return (GimpDrawable *) g_hash_table_lookup (gimp_drawable_table,
(gpointer) drawable_id);
}
void
gimp_drawable_merge_shadow (GimpDrawable *drawable,
gint undo)
{
GImage *gimage;
PixelRegion shadowPR;
int x1, y1, x2, y2;
GImage *gimage;
PixelRegion shadowPR;
gint x1, y1, x2, y2;
g_return_if_fail (drawable != NULL);
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
gimage = gimp_drawable_gimage (drawable);
g_return_if_fail (gimage != NULL);
g_return_if_fail (gimage->shadow != NULL);
@ -139,39 +156,44 @@ gimp_drawable_fill (GimpDrawable *drawable,
guchar b,
guchar a)
{
GImage *gimage;
PixelRegion destPR;
guchar c[MAX_CHANNELS];
guchar i;
GImage *gimage;
PixelRegion destPR;
guchar c[MAX_CHANNELS];
guchar i;
g_return_if_fail (drawable != NULL);
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
gimage = gimp_drawable_gimage (drawable);
g_return_if_fail (gimage != NULL);
switch (gimp_drawable_type (drawable))
{
case RGB_GIMAGE: case RGBA_GIMAGE:
c[RED_PIX] = r;
c[RED_PIX] = r;
c[GREEN_PIX] = g;
c[BLUE_PIX] = b;
c[BLUE_PIX] = b;
if (gimp_drawable_type (drawable) == RGBA_GIMAGE)
c[ALPHA_PIX] = a;
break;
case GRAY_GIMAGE: case GRAYA_GIMAGE:
c[GRAY_PIX] = r;
if (gimp_drawable_type (drawable) == GRAYA_GIMAGE)
c[ALPHA_G_PIX] = a;
break;
case INDEXED_GIMAGE: case INDEXEDA_GIMAGE:
c[RED_PIX] = r;
c[RED_PIX] = r;
c[GREEN_PIX] = g;
c[BLUE_PIX] = b;
c[BLUE_PIX] = b;
gimage_transform_color (gimage, drawable, c, &i, RGB);
c[INDEXED_PIX] = i;
if (gimp_drawable_type (drawable) == INDEXEDA_GIMAGE)
c[ALPHA_I_PIX] = a;
break;
default:
g_message (_("Can't fill unknown image type."));
break;
@ -184,7 +206,6 @@ gimp_drawable_fill (GimpDrawable *drawable,
gimp_drawable_height (drawable),
TRUE);
color_region (&destPR, c);
}
gboolean
@ -197,9 +218,11 @@ gimp_drawable_mask_bounds (GimpDrawable *drawable,
GimpImage *gimage;
gint off_x, off_y;
g_return_val_if_fail (drawable != NULL, FALSE);
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
gimage = gimp_drawable_gimage (drawable);
g_return_val_if_fail (gimage != NULL, FALSE);
if (gimage_mask_bounds (gimage, x1, y1, x2, y2))
@ -225,6 +248,7 @@ gimp_drawable_invalidate_preview (GimpDrawable *drawable,
{
GimpImage *gimage;
g_return_if_fail (drawable != NULL);
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
drawable->preview_valid = FALSE;
@ -244,7 +268,7 @@ gimp_drawable_invalidate_preview (GimpDrawable *drawable,
GimpImage *
gimp_drawable_gimage (GimpDrawable *drawable)
gimp_drawable_gimage (const GimpDrawable *drawable)
{
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
@ -266,7 +290,7 @@ gimp_drawable_set_gimage (GimpDrawable *drawable,
}
gboolean
gimp_drawable_has_alpha (GimpDrawable *drawable)
gimp_drawable_has_alpha (const GimpDrawable *drawable)
{
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
@ -274,7 +298,7 @@ gimp_drawable_has_alpha (GimpDrawable *drawable)
}
GimpImageType
gimp_drawable_type (GimpDrawable *drawable)
gimp_drawable_type (const GimpDrawable *drawable)
{
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), -1);
@ -282,44 +306,49 @@ gimp_drawable_type (GimpDrawable *drawable)
}
GimpImageType
gimp_drawable_type_with_alpha (GimpDrawable *drawable)
gimp_drawable_type_with_alpha (const GimpDrawable *drawable)
{
GimpImageType type;
gboolean has_alpha;
gboolean has_alpha;
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), -1);
type = gimp_drawable_type (drawable);
has_alpha = gimp_drawable_has_alpha (drawable);
if (has_alpha)
return type;
{
return type;
}
else
switch (type)
{
case RGB_GIMAGE:
return RGBA_GIMAGE; break;
case GRAY_GIMAGE:
return GRAYA_GIMAGE; break;
case INDEXED_GIMAGE:
return INDEXEDA_GIMAGE; break;
default:
{
switch (type)
{
case RGB_GIMAGE:
return RGBA_GIMAGE; break;
case GRAY_GIMAGE:
return GRAYA_GIMAGE; break;
case INDEXED_GIMAGE:
return INDEXEDA_GIMAGE; break;
default:
g_assert_not_reached ();
break;
}
}
}
return 0;
}
gboolean
gimp_drawable_visible (GimpDrawable *drawable)
gimp_drawable_visible (const GimpDrawable *drawable)
{
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
return drawable->visible;
}
gchar *
gimp_drawable_get_name (GimpDrawable *drawable)
const gchar *
gimp_drawable_get_name (const GimpDrawable *drawable)
{
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
@ -328,7 +357,7 @@ gimp_drawable_get_name (GimpDrawable *drawable)
void
gimp_drawable_set_name (GimpDrawable *drawable,
gchar *name)
const gchar *name)
{
GSList *list, *listb, *base_list;
GimpDrawable *drawableb;
@ -471,19 +500,21 @@ list_func (gchar *key,
}
gchar **
gimp_drawable_parasite_list (GimpDrawable *drawable,
gint *count)
gimp_drawable_parasite_list (const GimpDrawable *drawable,
gint *count)
{
gchar **list;
gchar **cur;
g_return_val_if_fail (drawable != NULL, NULL);
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
g_return_val_if_fail (count != NULL, NULL);
*count = parasite_list_length (drawable->parasites);
cur = list = g_new (gchar *, *count);
parasite_list_foreach (drawable->parasites, (GHFunc) list_func, &cur);
return list;
}
@ -503,12 +534,15 @@ gimp_drawable_parasite_attach (GimpDrawable *drawable,
undo_push_drawable_parasite (drawable->gimage, drawable, parasite);
}
else if (gimp_parasite_is_persistent (parasite) &&
!gimp_parasite_compare (parasite,
gimp_drawable_parasite_find
(drawable, gimp_parasite_name (parasite))))
undo_push_cantundo (drawable->gimage, _("parasite attach to drawable"));
! gimp_parasite_compare (parasite,
gimp_drawable_parasite_find
(drawable, gimp_parasite_name (parasite))))
{
undo_push_cantundo (drawable->gimage, _("parasite attach to drawable"));
}
parasite_list_add (drawable->parasites, parasite);
if (gimp_parasite_has_flag (parasite, GIMP_PARASITE_ATTACH_PARENT))
{
parasite_shift_parent (parasite);
@ -520,6 +554,7 @@ gimp_drawable_parasite_attach (GimpDrawable *drawable,
parasite_shift_parent (parasite);
gimp_parasite_attach (parasite);
}
if (gimp_parasite_is_undoable (parasite))
{
undo_push_group_end (drawable->gimage);
@ -534,7 +569,7 @@ gimp_drawable_parasite_detach (GimpDrawable *drawable,
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
if (!(p = parasite_list_find (drawable->parasites, parasite)))
if (! (p = parasite_list_find (drawable->parasites, parasite)))
return;
if (gimp_parasite_is_undoable (p))
@ -564,7 +599,7 @@ gimp_drawable_set_tattoo (GimpDrawable *drawable,
}
gboolean
gimp_drawable_is_rgb (GimpDrawable *drawable)
gimp_drawable_is_rgb (const GimpDrawable *drawable)
{
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
@ -576,7 +611,7 @@ gimp_drawable_is_rgb (GimpDrawable *drawable)
}
gboolean
gimp_drawable_is_gray (GimpDrawable *drawable)
gimp_drawable_is_gray (const GimpDrawable *drawable)
{
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
@ -588,7 +623,7 @@ gimp_drawable_is_gray (GimpDrawable *drawable)
}
gboolean
gimp_drawable_is_indexed (GimpDrawable *drawable)
gimp_drawable_is_indexed (const GimpDrawable *drawable)
{
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
@ -600,7 +635,7 @@ gimp_drawable_is_indexed (GimpDrawable *drawable)
}
TileManager *
gimp_drawable_data (GimpDrawable *drawable)
gimp_drawable_data (const GimpDrawable *drawable)
{
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
@ -657,7 +692,7 @@ gimp_drawable_offsets (GimpDrawable *drawable,
}
guchar *
gimp_drawable_cmap (GimpDrawable *drawable)
gimp_drawable_cmap (const GimpDrawable *drawable)
{
GimpImage *gimage;
@ -741,7 +776,7 @@ gimp_drawable_configure (GimpDrawable *drawable,
gint width,
gint height,
GimpImageType type,
gchar *name)
const gchar *name)
{
gint bpp;
gboolean alpha;
@ -781,7 +816,8 @@ gimp_drawable_configure (GimpDrawable *drawable,
if (drawable->tiles)
tile_manager_destroy (drawable->tiles);
drawable->tiles = tile_manager_new (width, height, bpp);
drawable->tiles = tile_manager_new (width, height, bpp);
drawable->visible = TRUE;
if (gimage)

View File

@ -31,59 +31,67 @@
#define GIMP_DRAWABLE(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_DRAWABLE, GimpDrawable))
#define GIMP_IS_DRAWABLE(obj) (GTK_CHECK_TYPE ((obj), GIMP_TYPE_DRAWABLE))
GtkType gimp_drawable_get_type (void);
/* drawable access functions */
void gimp_drawable_merge_shadow (GimpDrawable *, gint);
void gimp_drawable_fill (GimpDrawable *drawable,
guchar r, guchar g,
guchar b, guchar a);
GtkType gimp_drawable_get_type (void);
gboolean gimp_drawable_mask_bounds (GimpDrawable *,
gint *, gint *,
gint *, gint *);
void gimp_drawable_merge_shadow (GimpDrawable *drawable,
gint undo);
void gimp_drawable_fill (GimpDrawable *drawable,
guchar r,
guchar g,
guchar b,
guchar a);
void gimp_drawable_invalidate_preview (GimpDrawable *drawable,
gboolean emit_signal);
gint gimp_drawable_dirty (GimpDrawable *);
gint gimp_drawable_clean (GimpDrawable *);
gboolean gimp_drawable_has_alpha (GimpDrawable *);
GimpImageType gimp_drawable_type (GimpDrawable *);
GimpImageType gimp_drawable_type_with_alpha (GimpDrawable *);
gboolean gimp_drawable_is_rgb (GimpDrawable *);
gboolean gimp_drawable_is_gray (GimpDrawable *);
gboolean gimp_drawable_is_indexed (GimpDrawable *);
TileManager * gimp_drawable_data (GimpDrawable *);
TileManager * gimp_drawable_shadow (GimpDrawable *);
gint gimp_drawable_bytes (GimpDrawable *);
gint gimp_drawable_width (GimpDrawable *);
gint gimp_drawable_height (GimpDrawable *);
gboolean gimp_drawable_visible (GimpDrawable *);
void gimp_drawable_offsets (GimpDrawable *,
gint *, gint *);
gboolean gimp_drawable_mask_bounds (GimpDrawable *drawable,
gint *x1,
gint *y1,
gint *x2,
gint *y2);
guchar * gimp_drawable_cmap (GimpDrawable *);
gchar * gimp_drawable_get_name (GimpDrawable *);
void gimp_drawable_set_name (GimpDrawable *, gchar *);
void gimp_drawable_invalidate_preview (GimpDrawable *drawable,
gboolean emit_signal);
gboolean gimp_drawable_has_alpha (const GimpDrawable *drawable);
GimpImageType gimp_drawable_type (const GimpDrawable *drawable);
GimpImageType gimp_drawable_type_with_alpha (const GimpDrawable *drawable);
gboolean gimp_drawable_is_rgb (const GimpDrawable *drawable);
gboolean gimp_drawable_is_gray (const GimpDrawable *drawable);
gboolean gimp_drawable_is_indexed (const GimpDrawable *drawable);
TileManager * gimp_drawable_data (const GimpDrawable *drawable);
TileManager * gimp_drawable_shadow (GimpDrawable *);
gint gimp_drawable_bytes (GimpDrawable *);
gint gimp_drawable_width (GimpDrawable *);
gint gimp_drawable_height (GimpDrawable *);
gboolean gimp_drawable_visible (const GimpDrawable *drawable);
void gimp_drawable_offsets (GimpDrawable *,
gint *, gint *);
guchar * gimp_drawable_get_color_at (GimpDrawable *,
gint x, gint y);
guchar * gimp_drawable_cmap (const GimpDrawable *drawable);
const gchar * gimp_drawable_get_name (const GimpDrawable *drawable);
void gimp_drawable_set_name (GimpDrawable *drawable,
const gchar *name);
void gimp_drawable_parasite_attach (GimpDrawable *,
GimpParasite *);
void gimp_drawable_parasite_detach (GimpDrawable *,
const gchar *);
GimpParasite * gimp_drawable_parasite_find (const GimpDrawable *,
const gchar *);
gchar ** gimp_drawable_parasite_list (GimpDrawable *drawable,
gint *count);
Tattoo gimp_drawable_get_tattoo (const GimpDrawable *);
void gimp_drawable_set_tattoo (GimpDrawable *, Tattoo);
guchar * gimp_drawable_get_color_at (GimpDrawable *drawable,
gint x,
gint y);
GimpDrawable * gimp_drawable_get_ID (gint);
void gimp_drawable_deallocate (GimpDrawable *);
GimpImage * gimp_drawable_gimage (GimpDrawable*);
void gimp_drawable_set_gimage (GimpDrawable*, GimpImage *);
void gimp_drawable_parasite_attach (GimpDrawable *drawable,
GimpParasite *parasite);
void gimp_drawable_parasite_detach (GimpDrawable *drawable,
const gchar *parasite);
GimpParasite * gimp_drawable_parasite_find (const GimpDrawable *drawable,
const gchar *name);
gchar ** gimp_drawable_parasite_list (const GimpDrawable *drawable,
gint *count);
Tattoo gimp_drawable_get_tattoo (const GimpDrawable *drawable);
void gimp_drawable_set_tattoo (GimpDrawable *drawable,
Tattoo tattoo);
GimpDrawable * gimp_drawable_get_ID (gint);
void gimp_drawable_deallocate (GimpDrawable *);
GimpImage * gimp_drawable_gimage (const GimpDrawable *drawable);
void gimp_drawable_set_gimage (GimpDrawable *drawable,
GimpImage *gimage);
#endif /* __GIMP_DRAWABLE_H__ */

View File

@ -59,28 +59,58 @@
/* Local function declarations */
static void gimp_image_destroy (GtkObject *object);
static void gimp_image_free_projection (GimpImage *);
static void gimp_image_allocate_shadow (GimpImage *, gint, gint, gint);
static void gimp_image_allocate_projection (GimpImage *);
static void gimp_image_free_layers (GimpImage *);
static void gimp_image_free_channels (GimpImage *);
static void gimp_image_construct_layers (GimpImage *, gint, gint, gint, gint);
static void gimp_image_construct_channels (GimpImage *, gint, gint, gint, gint);
static void gimp_image_initialize_projection (GimpImage *, gint, gint, gint, gint);
static void gimp_image_get_active_channels (GimpImage *, GimpDrawable *, gint *);
static void gimp_image_destroy (GtkObject *object);
static void gimp_image_free_projection (GimpImage *gimage);
static void gimp_image_allocate_shadow (GimpImage *gimage,
gint width,
gint height,
gint bpp);
static void gimp_image_allocate_projection (GimpImage *gimage);
static void gimp_image_free_layers (GimpImage *gimage);
static void gimp_image_free_channels (GimpImage *gimage);
static void gimp_image_construct_layers (GimpImage *gimage,
gint x,
gint y,
gint w,
gint h);
static void gimp_image_construct_channels (GimpImage *gimage,
gint x,
gint y,
gint w,
gint h);
static void gimp_image_initialize_projection (GimpImage *gimage,
gint x,
gint y,
gint w,
gint h);
static void gimp_image_get_active_channels (GimpImage *gimage,
GimpDrawable *drawable,
gint *active);
/* projection functions */
static void project_intensity (GimpImage *, Layer *,
PixelRegion *, PixelRegion *,
PixelRegion *);
static void project_intensity_alpha (GimpImage *, Layer *,
PixelRegion *, PixelRegion *,
PixelRegion *);
static void project_indexed (GimpImage *, Layer *,
PixelRegion *, PixelRegion *);
static void project_channel (GimpImage *, Channel *,
PixelRegion *, PixelRegion *);
static void project_intensity (GimpImage *gimage,
Layer *layer,
PixelRegion *src,
PixelRegion *dest,
PixelRegion *mask);
static void project_intensity_alpha (GimpImage *gimage,
Layer *layer,
PixelRegion *src,
PixelRegion *dest,
PixelRegion *mask);
static void project_indexed (GimpImage *gimage,
Layer *layer,
PixelRegion *src,
PixelRegion *dest);
static void project_indexed_alpha (GimpImage *gimage,
Layer *layer,
PixelRegion *src,
PixelRegion *dest,
PixelRegion *mask);
static void project_channel (GimpImage *gimage,
Channel *layer,
PixelRegion *src,
PixelRegion *src2);
/*
* Global variables
@ -108,7 +138,8 @@ guint32 next_guide_id = 1; /* For generating guide_ID handles for PDB stuff */
* Static variables
*/
enum {
enum
{
CLEAN,
DIRTY,
REPAINT,
@ -120,8 +151,9 @@ enum {
LAST_SIGNAL
};
static guint gimp_image_signals[LAST_SIGNAL];
static GimpObjectClass *parent_class;
static guint gimp_image_signals[LAST_SIGNAL] = { 0 };
static GimpObjectClass *parent_class = NULL;
static void
@ -129,13 +161,11 @@ gimp_image_class_init (GimpImageClass *klass)
{
GtkObjectClass *object_class;
GtkType type;
object_class = GTK_OBJECT_CLASS(klass);
parent_class = gtk_type_class (gimp_object_get_type ());
type=object_class->type;
object_class->destroy = gimp_image_destroy;
object_class = GTK_OBJECT_CLASS (klass);
parent_class = gtk_type_class (gimp_object_get_type ());
type = object_class->type;
gimp_image_signals[CLEAN] =
gimp_signal_new ("clean", GTK_RUN_FIRST, type, 0,
@ -163,6 +193,17 @@ gimp_image_class_init (GimpImageClass *klass)
gimp_sigtype_int);
gtk_object_class_add_signals (object_class, gimp_image_signals, LAST_SIGNAL);
object_class->destroy = gimp_image_destroy;
klass->clean = NULL;
klass->dirty = NULL;
klass->repaint = NULL;
klass->rename = NULL;
klass->resize = NULL;
klass->restructure = NULL;
klass->colormap_changed = NULL;
klass->undo_event = NULL;
}
@ -384,9 +425,9 @@ gimp_image_set_resolution (GimpImage *gimage,
}
void
gimp_image_get_resolution (GimpImage *gimage,
gdouble *xresolution,
gdouble *yresolution)
gimp_image_get_resolution (const GimpImage *gimage,
gdouble *xresolution,
gdouble *yresolution)
{
g_return_if_fail (xresolution && yresolution);
@ -404,7 +445,7 @@ gimp_image_set_unit (GimpImage *gimage,
}
GimpUnit
gimp_image_get_unit (GimpImage *gimage)
gimp_image_get_unit (const GimpImage *gimage)
{
return gimage->unit;
}
@ -417,11 +458,23 @@ gimp_image_set_save_proc (GimpImage *gimage,
}
PlugInProcDef *
gimp_image_get_save_proc (GimpImage *gimage)
gimp_image_get_save_proc (const GimpImage *gimage)
{
return gimage->save_proc;
}
gint
gimp_image_get_width (const GimpImage *gimage)
{
return gimage->width;
}
gint
gimp_image_get_height (const GimpImage *gimage)
{
return gimage->height;
}
void
gimp_image_resize (GimpImage *gimage,
gint new_width,
@ -518,18 +571,6 @@ gimp_image_resize (GimpImage *gimage,
gimp_remove_busy_cursors (NULL);
}
gint
gimp_image_get_width (const GimpImage *gimage)
{
return gimage->width;
}
gint
gimp_image_get_height (const GimpImage *gimage)
{
return gimage->height;
}
void
gimp_image_scale (GimpImage *gimage,
gint new_width,
@ -696,7 +737,8 @@ gimp_image_destroy (GtkObject *object)
gimp_image_free_layers (gimage);
gimp_image_free_channels (gimage);
channel_delete (gimage->selection_mask);
gtk_object_unref (GTK_OBJECT (gimage->selection_mask));
if (gimage->comp_preview)
temp_buf_free (gimage->comp_preview);
@ -941,9 +983,9 @@ gimp_image_replace_image (GimpImage *gimage,
/* Get rid of these! A "foreground" is an UI concept.. */
void
gimp_image_get_foreground (GimpImage *gimage,
GimpDrawable *drawable,
guchar *fg)
gimp_image_get_foreground (const GimpImage *gimage,
const GimpDrawable *drawable,
guchar *fg)
{
guchar pfg[3];
@ -954,9 +996,9 @@ gimp_image_get_foreground (GimpImage *gimage,
}
void
gimp_image_get_background (GimpImage *gimage,
GimpDrawable *drawable,
guchar *bg)
gimp_image_get_background (const GimpImage *gimage,
const GimpDrawable *drawable,
guchar *bg)
{
guchar pbg[3];
@ -980,7 +1022,7 @@ gimp_image_get_color_at (GimpImage *gimage,
if (x < 0 || y < 0 || x >= gimage->width || y >= gimage->height)
return NULL;
dest = g_new (unsigned char, 5);
dest = g_new (guchar, 5);
tile = tile_manager_get_tile (gimp_image_composite (gimage), x, y,
TRUE, FALSE);
src = tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT);
@ -998,10 +1040,10 @@ gimp_image_get_color_at (GimpImage *gimage,
}
void
gimp_image_get_color (GimpImage *gimage,
GimpImageType d_type,
guchar *rgb,
guchar *src)
gimp_image_get_color (const GimpImage *gimage,
GimpImageType d_type,
guchar *rgb,
guchar *src)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
@ -1020,17 +1062,17 @@ gimp_image_get_color (GimpImage *gimage,
}
void
gimp_image_transform_color (GimpImage *gimage,
GimpDrawable *drawable,
guchar *src,
guchar *dest,
GimpImageBaseType type)
gimp_image_transform_color (const GimpImage *gimage,
const GimpDrawable *drawable,
guchar *src,
guchar *dest,
GimpImageBaseType type)
{
GimpImageType d_type;
g_return_if_fail (GIMP_IS_IMAGE (gimage));
d_type = (drawable != NULL) ? drawable_type (drawable) :
d_type = (drawable != NULL) ? gimp_drawable_type (drawable) :
gimp_image_base_type_with_alpha (gimage);
switch (type)
@ -1090,7 +1132,7 @@ gimp_image_transform_color (GimpImage *gimage,
}
}
Guide*
Guide *
gimp_image_add_hguide (GimpImage *gimage)
{
Guide *guide;
@ -1108,7 +1150,7 @@ gimp_image_add_hguide (GimpImage *gimage)
return guide;
}
Guide*
Guide *
gimp_image_add_vguide (GimpImage *gimage)
{
Guide *guide;
@ -1178,8 +1220,8 @@ list_func (gchar *key,
}
gchar **
gimp_image_parasite_list (GimpImage *gimage,
gint *count)
gimp_image_parasite_list (const GimpImage *gimage,
gint *count)
{
gchar **list;
gchar **cur;
@ -1242,9 +1284,11 @@ Tattoo
gimp_image_get_new_tattoo (GimpImage *image)
{
image->tattoo_state++;
if (image->tattoo_state <= 0)
g_warning ("Tattoo state has become corrupt (2.1 billion operation limit exceded)");
return (image->tattoo_state);
return image->tattoo_state;
}
Tattoo
@ -1334,18 +1378,6 @@ gimp_image_set_tattoo_state (GimpImage *gimage,
return retval;
}
void
gimp_image_colormap_changed (GimpImage *gimage,
gint col)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (col < gimage->num_cols);
gtk_signal_emit (GTK_OBJECT (gimage),
gimp_image_signals[COLORMAP_CHANGED],
col);
}
void
gimp_image_set_paths (GimpImage *gimage,
PathList *paths)
@ -1356,13 +1388,25 @@ gimp_image_set_paths (GimpImage *gimage,
}
PathList *
gimp_image_get_paths (GimpImage *gimage)
gimp_image_get_paths (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
return gimage->paths;
}
void
gimp_image_colormap_changed (const GimpImage *gimage,
gint col)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (col < gimage->num_cols);
gtk_signal_emit (GTK_OBJECT (gimage),
gimp_image_signals[COLORMAP_CHANGED],
col);
}
/************************************************************/
/* Projection functions */
/************************************************************/
@ -1478,8 +1522,10 @@ gimp_image_free_channels (GimpImage *gimage)
for (list = gimage->channels; list; list = g_slist_next (list))
{
channel = (Channel *) list->data;
channel_delete (channel);
gtk_object_unref (GTK_OBJECT (channel));
}
g_slist_free (gimage->channels);
}
@ -1748,8 +1794,7 @@ gimp_image_construct (GimpImage *gimage,
gint x,
gint y,
gint w,
gint h,
gboolean can_use_cowproject)
gint h)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
@ -1950,8 +1995,7 @@ gimp_image_invalidate (GimpImage *gimage,
if ((endx - startx) > 0 && (endy - starty) > 0)
gimp_image_construct (gimage,
startx, starty,
(endx - startx), (endy - starty),
TRUE);
(endx - startx), (endy - starty));
}
void
@ -1972,12 +2016,12 @@ gimp_image_validate (TileManager *tm,
w = tile_ewidth (tile);
h = tile_eheight (tile);
gimp_image_construct (gimage, x, y, w, h, FALSE);
gimp_image_construct (gimage, x, y, w, h);
}
gint
gimp_image_get_layer_index (GimpImage *gimage,
Layer *layer_arg)
gimp_image_get_layer_index (const GimpImage *gimage,
const Layer *layer_arg)
{
Layer *layer;
GSList *layers;
@ -1990,6 +2034,7 @@ gimp_image_get_layer_index (GimpImage *gimage,
layers = g_slist_next (layers), index++)
{
layer = (Layer *) layers->data;
if (layer == layer_arg)
return index;
}
@ -1998,23 +2043,22 @@ gimp_image_get_layer_index (GimpImage *gimage,
}
Layer *
gimp_image_get_layer_by_index (GimpImage *gimage,
gint layer_index)
gimp_image_get_layer_by_index (const GimpImage *gimage,
gint layer_index)
{
Layer *layer;
g_return_val_if_fail (gimage != NULL, NULL);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
layer =
(Layer *) g_slist_nth_data (gimage->layers, layer_index);
layer = (Layer *) g_slist_nth_data (gimage->layers, layer_index);
return layer;
}
gint
gimp_image_get_channel_index (GimpImage *gimage,
Channel *channel_ID)
gimp_image_get_channel_index (const GimpImage *gimage,
const Channel *channel_arg)
{
Channel *channel;
GSList *channels;
@ -2028,7 +2072,8 @@ gimp_image_get_channel_index (GimpImage *gimage,
channels = g_slist_next (channels), index++)
{
channel = (Channel *) channels->data;
if (channel == channel_ID)
if (channel == channel_arg)
return index;
}
@ -2036,7 +2081,7 @@ gimp_image_get_channel_index (GimpImage *gimage,
}
Layer *
gimp_image_get_active_layer (GimpImage *gimage)
gimp_image_get_active_layer (const GimpImage *gimage)
{
g_return_val_if_fail (gimage != NULL, NULL);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
@ -2045,7 +2090,7 @@ gimp_image_get_active_layer (GimpImage *gimage)
}
Channel *
gimp_image_get_active_channel (GimpImage *gimage)
gimp_image_get_active_channel (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
@ -2053,8 +2098,8 @@ gimp_image_get_active_channel (GimpImage *gimage)
}
Layer *
gimp_image_get_layer_by_tattoo (GimpImage *gimage,
Tattoo tattoo)
gimp_image_get_layer_by_tattoo (const GimpImage *gimage,
Tattoo tattoo)
{
Layer *layer;
GSList *layers;
@ -2066,6 +2111,7 @@ gimp_image_get_layer_by_tattoo (GimpImage *gimage,
layers = g_slist_next (layers))
{
layer = (Layer *) layers->data;
if (layer_get_tattoo (layer) == tattoo)
return layer;
}
@ -2074,8 +2120,8 @@ gimp_image_get_layer_by_tattoo (GimpImage *gimage,
}
Channel *
gimp_image_get_channel_by_tattoo (GimpImage *gimage,
Tattoo tattoo)
gimp_image_get_channel_by_tattoo (const GimpImage *gimage,
Tattoo tattoo)
{
Channel *channel;
GSList *channels;
@ -2087,6 +2133,7 @@ gimp_image_get_channel_by_tattoo (GimpImage *gimage,
channels = g_slist_next (channels))
{
channel = (Channel *) channels->data;
if (channel_get_tattoo (channel) == tattoo)
return channel;
}
@ -2095,8 +2142,8 @@ gimp_image_get_channel_by_tattoo (GimpImage *gimage,
}
Channel *
gimp_image_get_channel_by_name (GimpImage *gimage,
char *name)
gimp_image_get_channel_by_name (const GimpImage *gimage,
const gchar *name)
{
Channel *channel;
GSList *channels;
@ -2108,16 +2155,24 @@ gimp_image_get_channel_by_name (GimpImage *gimage,
channels = g_slist_next (channels))
{
channel = (Channel *) channels->data;
if (! strcmp(channel_get_name (channel),name) )
if (! strcmp (drawable_get_name (GIMP_DRAWABLE (channel)), name))
return channel;
}
return NULL;
}
gint
gimp_image_get_component_active (GimpImage *gimage,
ChannelType type)
Channel *
gimp_image_get_mask (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
return gimage->selection_mask;
}
gboolean
gimp_image_get_component_active (const GimpImage *gimage,
ChannelType type)
{
/* No sanity checking here... */
switch (type)
@ -2131,9 +2186,9 @@ gimp_image_get_component_active (GimpImage *gimage,
}
}
gint
gimp_image_get_component_visible (GimpImage *gimage,
ChannelType type)
gboolean
gimp_image_get_component_visible (const GimpImage *gimage,
ChannelType type)
{
/* No sanity checking here... */
switch (type)
@ -2147,35 +2202,29 @@ gimp_image_get_component_visible (GimpImage *gimage,
}
}
Channel *
gimp_image_get_mask (GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
return gimage->selection_mask;
}
gboolean
gimp_image_layer_boundary (GimpImage *gimage,
BoundSeg **segs,
int *num_segs)
gimp_image_layer_boundary (const GimpImage *gimage,
BoundSeg **segs,
gint *n_segs)
{
Layer *layer;
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
g_return_val_if_fail (segs != NULL, FALSE);
g_return_val_if_fail (n_segs != NULL, FALSE);
/* The second boundary corresponds to the active layer's
* perimeter...
*/
if ((layer = gimage->active_layer))
{
*segs = layer_boundary (layer, num_segs);
*segs = layer_boundary (layer, n_segs);
return TRUE;
}
else
{
*segs = NULL;
*num_segs = 0;
*n_segs = 0;
return FALSE;
}
}
@ -2185,6 +2234,7 @@ gimp_image_set_active_layer (GimpImage *gimage,
Layer *layer)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
g_return_val_if_fail (GIMP_IS_LAYER (layer), NULL);
/* First, find the layer in the gimage
* If it isn't valid, find the first layer that is
@ -2264,16 +2314,16 @@ gimp_image_unset_active_channel (GimpImage *gimage)
void
gimp_image_set_component_active (GimpImage *gimage,
ChannelType type,
gint value)
gboolean active)
{
/* No sanity checking here... */
switch (type)
{
case RED_CHANNEL: gimage->active[RED_PIX] = value; break;
case GREEN_CHANNEL: gimage->active[GREEN_PIX] = value; break;
case BLUE_CHANNEL: gimage->active[BLUE_PIX] = value; break;
case GRAY_CHANNEL: gimage->active[GRAY_PIX] = value; break;
case INDEXED_CHANNEL: gimage->active[INDEXED_PIX] = value; break;
case RED_CHANNEL: gimage->active[RED_PIX] = active; break;
case GREEN_CHANNEL: gimage->active[GREEN_PIX] = active; break;
case BLUE_CHANNEL: gimage->active[BLUE_PIX] = active; break;
case GRAY_CHANNEL: gimage->active[GRAY_PIX] = active; break;
case INDEXED_CHANNEL: gimage->active[INDEXED_PIX] = active; break;
case AUXILLARY_CHANNEL: break;
}
@ -2287,24 +2337,24 @@ gimp_image_set_component_active (GimpImage *gimage,
void
gimp_image_set_component_visible (GimpImage *gimage,
ChannelType type,
gint value)
gboolean visible)
{
/* No sanity checking here... */
switch (type)
{
case RED_CHANNEL: gimage->visible[RED_PIX] = value; break;
case GREEN_CHANNEL: gimage->visible[GREEN_PIX] = value; break;
case BLUE_CHANNEL: gimage->visible[BLUE_PIX] = value; break;
case GRAY_CHANNEL: gimage->visible[GRAY_PIX] = value; break;
case INDEXED_CHANNEL: gimage->visible[INDEXED_PIX] = value; break;
case RED_CHANNEL: gimage->visible[RED_PIX] = visible; break;
case GREEN_CHANNEL: gimage->visible[GREEN_PIX] = visible; break;
case BLUE_CHANNEL: gimage->visible[BLUE_PIX] = visible; break;
case GRAY_CHANNEL: gimage->visible[GRAY_PIX] = visible; break;
case INDEXED_CHANNEL: gimage->visible[INDEXED_PIX] = visible; break;
default: break;
}
}
Layer *
gimp_image_pick_correlate_layer (GimpImage *gimage,
gint x,
gint y)
gimp_image_pick_correlate_layer (const GimpImage *gimage,
gint x,
gint y)
{
Layer *layer;
GSList *list;
@ -2322,8 +2372,6 @@ gimp_image_pick_correlate_layer (GimpImage *gimage,
return NULL;
}
Layer *
gimp_image_raise_layer (GimpImage *gimage,
Layer *layer_arg)
@ -2763,7 +2811,7 @@ gimp_image_merge_layers (GimpImage *gimage,
}
merge_layer = layer_new (gimage, (x2 - x1), (y2 - y1),
type, drawable_get_name (GIMP_DRAWABLE(layer)),
type, drawable_get_name (GIMP_DRAWABLE (layer)),
OPAQUE_OPACITY, NORMAL_MODE);
if (!merge_layer)
{
@ -3009,12 +3057,18 @@ gimp_image_add_layer (GimpImage *gimage,
position = 1;
gimage->layers =
g_slist_insert (gimage->layers, layer_ref (float_layer), position);
g_slist_insert (gimage->layers, float_layer, position);
gtk_object_ref (GTK_OBJECT (float_layer));
gtk_object_sink (GTK_OBJECT (float_layer));
}
else
{
gimage->layers =
g_slist_prepend (gimage->layers, layer_ref (float_layer));
g_slist_prepend (gimage->layers, float_layer);
gtk_object_ref (GTK_OBJECT (float_layer));
gtk_object_sink (GTK_OBJECT (float_layer));
}
gimage->layer_stack = g_slist_prepend (gimage->layer_stack, float_layer);
@ -3374,7 +3428,10 @@ gimp_image_add_channel (GimpImage *gimage,
undo_push_channel (gimage, CHANNEL_ADD_UNDO, cu);
/* add the channel to the list */
gimage->channels = g_slist_prepend (gimage->channels, channel_ref (channel));
gimage->channels = g_slist_prepend (gimage->channels, channel);
gtk_object_ref (GTK_OBJECT (channel));
gtk_object_sink (GTK_OBJECT (channel));
/* notify this gimage of the currently active channel */
gimp_image_set_active_channel (gimage, channel);
@ -3419,9 +3476,9 @@ gimp_image_remove_channel (GimpImage *gimage,
0, 0,
drawable_width (GIMP_DRAWABLE(channel)),
drawable_height (GIMP_DRAWABLE(channel)));
/* Send out REMOVED signal from channel */
channel_removed (channel, gimage);
channel_removed (channel);
/* Important to push the undo here in case the push fails */
undo_push_channel (gimage, CHANNEL_REMOVE_UNDO, cu);
@ -3434,48 +3491,55 @@ gimp_image_remove_channel (GimpImage *gimage,
/************************************************************/
gboolean
gimp_image_is_empty (GimpImage *gimage)
gimp_image_is_empty (const GimpImage *gimage)
{
g_return_val_if_fail (gimage != NULL, TRUE);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), TRUE);
return (! gimage->layers);
return ! gimage->layers;
}
GimpDrawable *
gimp_image_active_drawable (GimpImage *gimage)
gimp_image_active_drawable (const GimpImage *gimage)
{
Layer *layer;
g_return_val_if_fail (gimage != NULL, NULL);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
/* If there is an active channel (a saved selection, etc.),
* we ignore the active layer
*/
if (gimage->active_channel != NULL)
return GIMP_DRAWABLE (gimage->active_channel);
{
return GIMP_DRAWABLE (gimage->active_channel);
}
else if (gimage->active_layer != NULL)
{
layer = gimage->active_layer;
if (layer->mask && layer->edit_mask)
return GIMP_DRAWABLE(layer->mask);
return GIMP_DRAWABLE (layer->mask);
else
return GIMP_DRAWABLE(layer);
return GIMP_DRAWABLE (layer);
}
else
return NULL;
return NULL;
}
GimpImageBaseType
gimp_image_base_type (GimpImage *gimage)
{
gimp_image_base_type (const GimpImage *gimage)
{
g_return_val_if_fail (gimage != NULL, -1);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), -1);
return gimage->base_type;
}
GimpImageType
gimp_image_base_type_with_alpha (GimpImage *gimage)
gimp_image_base_type_with_alpha (const GimpImage *gimage)
{
g_return_val_if_fail (gimage != NULL, -1);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), -1);
switch (gimage->base_type)
@ -3490,9 +3554,10 @@ gimp_image_base_type_with_alpha (GimpImage *gimage)
return RGB_GIMAGE;
}
gchar *
gimp_image_filename (GimpImage *gimage)
const gchar *
gimp_image_filename (const GimpImage *gimage)
{
g_return_val_if_fail (gimage != NULL, NULL);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
if (gimage->has_filename)
@ -3502,7 +3567,7 @@ gimp_image_filename (GimpImage *gimage)
}
gboolean
gimp_image_undo_is_enabled (GimpImage *gimage)
gimp_image_undo_is_enabled (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
@ -3550,7 +3615,7 @@ gimp_image_undo_enable (GimpImage *gimage)
void
gimp_image_undo_event (GimpImage *gimage,
int event)
gint event)
{
gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[UNDO_EVENT], event);
}
@ -3592,10 +3657,10 @@ gimp_image_dirty (GimpImage *gimage)
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
gimage->dirty++;
gtk_signal_emit(GTK_OBJECT(gimage), gimp_image_signals[DIRTY]);
gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[DIRTY]);
TRC (("dirty %d -> %d\n", gimage->dirty-1, gimage->dirty));
return gimage->dirty;
}
@ -3605,7 +3670,7 @@ gimp_image_clean (GimpImage *gimage)
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
gimage->dirty--;
gtk_signal_emit(GTK_OBJECT(gimage), gimp_image_signals[CLEAN]);
gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[CLEAN]);
TRC (("clean %d -> %d\n", gimage->dirty+1, gimage->dirty));
@ -3619,11 +3684,11 @@ gimp_image_clean_all (GimpImage *gimage)
gimage->dirty = 0;
gtk_signal_emit (GTK_OBJECT(gimage), gimp_image_signals[CLEAN]);
gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[CLEAN]);
}
Layer *
gimp_image_floating_sel (GimpImage *gimage)
gimp_image_floating_sel (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
@ -3634,7 +3699,7 @@ gimp_image_floating_sel (GimpImage *gimage)
}
guchar *
gimp_image_cmap (GimpImage *gimage)
gimp_image_cmap (const GimpImage *gimage)
{
return drawable_cmap (gimp_image_active_drawable (gimage));
}
@ -3651,13 +3716,15 @@ gimp_image_projection (GimpImage *gimage)
if ((gimage->projection == NULL) ||
(tile_manager_level_width (gimage->projection) != gimage->width) ||
(tile_manager_level_height (gimage->projection) != gimage->height))
gimp_image_allocate_projection (gimage);
{
gimp_image_allocate_projection (gimage);
}
return gimage->projection;
}
GimpImageType
gimp_image_projection_type (GimpImage *gimage)
gimp_image_projection_type (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), -1);
@ -3665,7 +3732,7 @@ gimp_image_projection_type (GimpImage *gimage)
}
gint
gimp_image_projection_bytes (GimpImage *gimage)
gimp_image_projection_bytes (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), -1);
@ -3673,7 +3740,7 @@ gimp_image_projection_bytes (GimpImage *gimage)
}
gint
gimp_image_projection_opacity (GimpImage *gimage)
gimp_image_projection_opacity (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), -1);
@ -3697,13 +3764,13 @@ gimp_image_composite (GimpImage *gimage)
}
GimpImageType
gimp_image_composite_type (GimpImage *gimage)
gimp_image_composite_type (const GimpImage *gimage)
{
return gimp_image_projection_type (gimage);
}
gint
gimp_image_composite_bytes (GimpImage *gimage)
gimp_image_composite_bytes (const GimpImage *gimage)
{
return gimp_image_projection_bytes (gimage);
}
@ -3913,8 +3980,8 @@ gimp_image_composite_preview (GimpImage *gimage,
}
gboolean
gimp_image_preview_valid (GimpImage *gimage,
ChannelType type)
gimp_image_preview_valid (const GimpImage *gimage,
ChannelType type)
{
switch (type)
{

View File

@ -88,10 +88,10 @@ typedef enum
struct _Guide
{
int ref_count;
int position;
int orientation;
guint32 guide_ID;
gint ref_count;
gint position;
InternalOrientationType orientation;
guint32 guide_ID;
};
@ -105,76 +105,103 @@ typedef struct _GimpImageRepaintArg
} GimpImageRepaintArg;
GtkType gimp_image_get_type (void);
/* function declarations */
GimpImage * gimp_image_new (gint, gint,
GimpImageBaseType);
void gimp_image_set_filename (GimpImage *, gchar *);
void gimp_image_set_resolution (GimpImage *,
gdouble, gdouble);
void gimp_image_get_resolution (GimpImage *,
gdouble *, gdouble *);
void gimp_image_set_unit (GimpImage *, GimpUnit);
GimpUnit gimp_image_get_unit (GimpImage *);
void gimp_image_set_save_proc (GimpImage *,
PlugInProcDef *);
PlugInProcDef * gimp_image_get_save_proc (GimpImage *);
gint gimp_image_get_width (const GimpImage *);
gint gimp_image_get_height (const GimpImage *);
void gimp_image_resize (GimpImage *,
gint, gint, gint, gint);
void gimp_image_scale (GimpImage *, gint, gint);
GimpImage * gimp_image_get_named (gchar *);
GimpImage * gimp_image_get_ID (gint);
TileManager * gimp_image_shadow (GimpImage *,
gint, gint, gint);
void gimp_image_free_shadow (GimpImage *);
void gimp_image_apply_image (GimpImage *, GimpDrawable *,
PixelRegion *, gint,
gint,
LayerModeEffects,
TileManager *, gint, gint);
void gimp_image_replace_image (GimpImage *, GimpDrawable *,
PixelRegion *, gint, gint,
PixelRegion *, gint, gint);
void gimp_image_get_foreground (GimpImage *, GimpDrawable *,
guchar *);
void gimp_image_get_background (GimpImage *, GimpDrawable *,
guchar *);
guchar * gimp_image_get_color_at (GimpImage *, gint, gint);
void gimp_image_get_color (GimpImage *,
GimpImageType,
guchar *,
guchar *);
void gimp_image_transform_color (GimpImage *,
GimpDrawable *,
guchar *,
guchar *,
GimpImageBaseType);
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 *);
GtkType gimp_image_get_type (void);
GimpParasite * gimp_image_parasite_find (const GimpImage *,
const gchar *name);
gchar ** gimp_image_parasite_list (GimpImage *gimage,
gint *count);
void gimp_image_parasite_attach (GimpImage *,
GimpParasite *);
void gimp_image_parasite_detach (GimpImage *, const gchar *);
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);
Tattoo gimp_image_get_new_tattoo (GimpImage *);
gboolean gimp_image_set_tattoo_state (GimpImage *, Tattoo);
Tattoo gimp_image_get_tattoo_state (GimpImage *);
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);
void gimp_image_set_paths (GimpImage *, PathList *);
PathList * gimp_image_get_paths (GimpImage *);
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);
/* Temporary hack till colormap manipulation is encapsulated in functions.
Call this whenever you modify an image's colormap. The ncol argument
@ -182,115 +209,169 @@ PathList * gimp_image_get_paths (GimpImage *);
Currently, use this also when the image's base type is changed to/from
indexed. */
void gimp_image_colormap_changed (GimpImage * image,
gint ncol);
void gimp_image_colormap_changed (const GimpImage *image,
gint col);
/* layer/channel functions */
gint gimp_image_get_layer_index (GimpImage *, Layer *);
Layer * gimp_image_get_layer_by_index (GimpImage *, gint);
gint gimp_image_get_channel_index (GimpImage *, Channel *);
Layer * gimp_image_get_active_layer (GimpImage *);
Channel * gimp_image_get_active_channel (GimpImage *);
Layer * gimp_image_get_layer_by_tattoo (GimpImage *, Tattoo);
Channel * gimp_image_get_channel_by_tattoo (GimpImage *, Tattoo);
Channel * gimp_image_get_channel_by_name (GimpImage *, gchar *);
Channel * gimp_image_get_mask (GimpImage *);
gint gimp_image_get_component_active (GimpImage *, ChannelType);
gint gimp_image_get_component_visible (GimpImage *, ChannelType);
gboolean gimp_image_layer_boundary (GimpImage *, BoundSeg **,
gint *);
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,
gint);
void gimp_image_set_component_visible (GimpImage *, ChannelType,
gint);
Layer * gimp_image_pick_correlate_layer (GimpImage *, gint, gint);
void gimp_image_set_layer_mask_apply (GimpImage *, gint);
void gimp_image_set_layer_mask_edit (GimpImage *, Layer *, gint);
void gimp_image_set_layer_mask_show (GimpImage *, gint);
Layer * gimp_image_raise_layer (GimpImage *, Layer *);
Layer * gimp_image_lower_layer (GimpImage *, Layer *);
Layer * gimp_image_raise_layer_to_top (GimpImage *, Layer *);
Layer * gimp_image_lower_layer_to_bottom (GimpImage *, Layer *);
Layer * gimp_image_position_layer (GimpImage *, Layer *,
gint, gboolean);
Layer * gimp_image_merge_visible_layers (GimpImage *, MergeType);
Layer * gimp_image_merge_down (GimpImage *, Layer *,
MergeType);
Layer * gimp_image_flatten (GimpImage *);
Layer * gimp_image_merge_layers (GimpImage *, GSList *,
MergeType);
Layer * gimp_image_add_layer (GimpImage *, Layer *, gint);
Layer * gimp_image_remove_layer (GimpImage *, Layer *);
LayerMask * gimp_image_add_layer_mask (GimpImage *, Layer *,
LayerMask *);
Channel * gimp_image_remove_layer_mask (GimpImage *, Layer *,
MaskApplyMode);
Channel * gimp_image_raise_channel (GimpImage *, Channel *);
Channel * gimp_image_lower_channel (GimpImage *, Channel *);
Channel * gimp_image_position_channel (GimpImage *, Channel *, gint);
Channel * gimp_image_add_channel (GimpImage *, Channel *, gint);
Channel * gimp_image_remove_channel (GimpImage *, Channel *);
void gimp_image_construct (GimpImage *,
gint, gint, gint, gint,
gboolean);
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 *, gint, gint,
gint, gint, gint,
gint, gint, gint);
void gimp_image_invalidate (GimpImage *, gint, gint,
gint, gint, gint,
gint, gint, gint);
void gimp_image_validate (TileManager *, Tile *);
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);
/* Access functions */
gboolean gimp_image_is_empty (GimpImage *);
GimpDrawable * gimp_image_active_drawable (GimpImage *);
gboolean gimp_image_is_empty (const GimpImage *gimage);
GimpDrawable * gimp_image_active_drawable (const GimpImage *gimage);
GimpImageBaseType gimp_image_base_type (GimpImage *gimage);
GimpImageType gimp_image_base_type_with_alpha (GimpImage *gimage);
GimpImageBaseType gimp_image_base_type (const GimpImage *gimage);
GimpImageType gimp_image_base_type_with_alpha (const GimpImage *gimage);
gchar * gimp_image_filename (GimpImage *);
gboolean gimp_image_undo_is_enabled (GimpImage *);
gboolean gimp_image_undo_enable (GimpImage *);
gboolean gimp_image_undo_disable (GimpImage *);
gboolean gimp_image_undo_freeze (GimpImage *);
gboolean gimp_image_undo_thaw (GimpImage *);
void gimp_image_undo_event (GimpImage *, gint);
gint gimp_image_dirty (GimpImage *);
gint gimp_image_clean (GimpImage *);
void gimp_image_clean_all (GimpImage *);
Layer * gimp_image_floating_sel (GimpImage *);
guchar * gimp_image_cmap (GimpImage *);
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);
/* projection access functions */
TileManager * gimp_image_projection (GimpImage *);
GimpImageType gimp_image_projection_type (GimpImage *);
gint gimp_image_projection_bytes (GimpImage *);
gint gimp_image_projection_opacity (GimpImage *);
void gimp_image_projection_realloc (GimpImage *);
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);
/* composite access functions */
TileManager * gimp_image_composite (GimpImage *);
GimpImageType gimp_image_composite_type (GimpImage *);
gint gimp_image_composite_bytes (GimpImage *);
TempBuf * gimp_image_composite_preview (GimpImage *, ChannelType,
gint, gint);
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);
gint gimp_image_preview_valid (GimpImage *, ChannelType);
void gimp_image_invalidate_preview (GimpImage *);
gint gimp_image_preview_valid (const GimpImage *gimage,
ChannelType type);
void gimp_image_invalidate_preview (GimpImage *gimage);
void gimp_image_invalidate_previews (void);
void gimp_image_invalidate_previews (void);
TempBuf * gimp_image_construct_composite_preview (GimpImage *,
gint , gint);
TempBuf * gimp_image_construct_composite_preview (GimpImage *gimage,
gint width,
gint height);
#endif /* __GIMPIMAGE_H__ */

View File

@ -59,28 +59,58 @@
/* Local function declarations */
static void gimp_image_destroy (GtkObject *object);
static void gimp_image_free_projection (GimpImage *);
static void gimp_image_allocate_shadow (GimpImage *, gint, gint, gint);
static void gimp_image_allocate_projection (GimpImage *);
static void gimp_image_free_layers (GimpImage *);
static void gimp_image_free_channels (GimpImage *);
static void gimp_image_construct_layers (GimpImage *, gint, gint, gint, gint);
static void gimp_image_construct_channels (GimpImage *, gint, gint, gint, gint);
static void gimp_image_initialize_projection (GimpImage *, gint, gint, gint, gint);
static void gimp_image_get_active_channels (GimpImage *, GimpDrawable *, gint *);
static void gimp_image_destroy (GtkObject *object);
static void gimp_image_free_projection (GimpImage *gimage);
static void gimp_image_allocate_shadow (GimpImage *gimage,
gint width,
gint height,
gint bpp);
static void gimp_image_allocate_projection (GimpImage *gimage);
static void gimp_image_free_layers (GimpImage *gimage);
static void gimp_image_free_channels (GimpImage *gimage);
static void gimp_image_construct_layers (GimpImage *gimage,
gint x,
gint y,
gint w,
gint h);
static void gimp_image_construct_channels (GimpImage *gimage,
gint x,
gint y,
gint w,
gint h);
static void gimp_image_initialize_projection (GimpImage *gimage,
gint x,
gint y,
gint w,
gint h);
static void gimp_image_get_active_channels (GimpImage *gimage,
GimpDrawable *drawable,
gint *active);
/* projection functions */
static void project_intensity (GimpImage *, Layer *,
PixelRegion *, PixelRegion *,
PixelRegion *);
static void project_intensity_alpha (GimpImage *, Layer *,
PixelRegion *, PixelRegion *,
PixelRegion *);
static void project_indexed (GimpImage *, Layer *,
PixelRegion *, PixelRegion *);
static void project_channel (GimpImage *, Channel *,
PixelRegion *, PixelRegion *);
static void project_intensity (GimpImage *gimage,
Layer *layer,
PixelRegion *src,
PixelRegion *dest,
PixelRegion *mask);
static void project_intensity_alpha (GimpImage *gimage,
Layer *layer,
PixelRegion *src,
PixelRegion *dest,
PixelRegion *mask);
static void project_indexed (GimpImage *gimage,
Layer *layer,
PixelRegion *src,
PixelRegion *dest);
static void project_indexed_alpha (GimpImage *gimage,
Layer *layer,
PixelRegion *src,
PixelRegion *dest,
PixelRegion *mask);
static void project_channel (GimpImage *gimage,
Channel *layer,
PixelRegion *src,
PixelRegion *src2);
/*
* Global variables
@ -108,7 +138,8 @@ guint32 next_guide_id = 1; /* For generating guide_ID handles for PDB stuff */
* Static variables
*/
enum {
enum
{
CLEAN,
DIRTY,
REPAINT,
@ -120,8 +151,9 @@ enum {
LAST_SIGNAL
};
static guint gimp_image_signals[LAST_SIGNAL];
static GimpObjectClass *parent_class;
static guint gimp_image_signals[LAST_SIGNAL] = { 0 };
static GimpObjectClass *parent_class = NULL;
static void
@ -129,13 +161,11 @@ gimp_image_class_init (GimpImageClass *klass)
{
GtkObjectClass *object_class;
GtkType type;
object_class = GTK_OBJECT_CLASS(klass);
parent_class = gtk_type_class (gimp_object_get_type ());
type=object_class->type;
object_class->destroy = gimp_image_destroy;
object_class = GTK_OBJECT_CLASS (klass);
parent_class = gtk_type_class (gimp_object_get_type ());
type = object_class->type;
gimp_image_signals[CLEAN] =
gimp_signal_new ("clean", GTK_RUN_FIRST, type, 0,
@ -163,6 +193,17 @@ gimp_image_class_init (GimpImageClass *klass)
gimp_sigtype_int);
gtk_object_class_add_signals (object_class, gimp_image_signals, LAST_SIGNAL);
object_class->destroy = gimp_image_destroy;
klass->clean = NULL;
klass->dirty = NULL;
klass->repaint = NULL;
klass->rename = NULL;
klass->resize = NULL;
klass->restructure = NULL;
klass->colormap_changed = NULL;
klass->undo_event = NULL;
}
@ -384,9 +425,9 @@ gimp_image_set_resolution (GimpImage *gimage,
}
void
gimp_image_get_resolution (GimpImage *gimage,
gdouble *xresolution,
gdouble *yresolution)
gimp_image_get_resolution (const GimpImage *gimage,
gdouble *xresolution,
gdouble *yresolution)
{
g_return_if_fail (xresolution && yresolution);
@ -404,7 +445,7 @@ gimp_image_set_unit (GimpImage *gimage,
}
GimpUnit
gimp_image_get_unit (GimpImage *gimage)
gimp_image_get_unit (const GimpImage *gimage)
{
return gimage->unit;
}
@ -417,11 +458,23 @@ gimp_image_set_save_proc (GimpImage *gimage,
}
PlugInProcDef *
gimp_image_get_save_proc (GimpImage *gimage)
gimp_image_get_save_proc (const GimpImage *gimage)
{
return gimage->save_proc;
}
gint
gimp_image_get_width (const GimpImage *gimage)
{
return gimage->width;
}
gint
gimp_image_get_height (const GimpImage *gimage)
{
return gimage->height;
}
void
gimp_image_resize (GimpImage *gimage,
gint new_width,
@ -518,18 +571,6 @@ gimp_image_resize (GimpImage *gimage,
gimp_remove_busy_cursors (NULL);
}
gint
gimp_image_get_width (const GimpImage *gimage)
{
return gimage->width;
}
gint
gimp_image_get_height (const GimpImage *gimage)
{
return gimage->height;
}
void
gimp_image_scale (GimpImage *gimage,
gint new_width,
@ -696,7 +737,8 @@ gimp_image_destroy (GtkObject *object)
gimp_image_free_layers (gimage);
gimp_image_free_channels (gimage);
channel_delete (gimage->selection_mask);
gtk_object_unref (GTK_OBJECT (gimage->selection_mask));
if (gimage->comp_preview)
temp_buf_free (gimage->comp_preview);
@ -941,9 +983,9 @@ gimp_image_replace_image (GimpImage *gimage,
/* Get rid of these! A "foreground" is an UI concept.. */
void
gimp_image_get_foreground (GimpImage *gimage,
GimpDrawable *drawable,
guchar *fg)
gimp_image_get_foreground (const GimpImage *gimage,
const GimpDrawable *drawable,
guchar *fg)
{
guchar pfg[3];
@ -954,9 +996,9 @@ gimp_image_get_foreground (GimpImage *gimage,
}
void
gimp_image_get_background (GimpImage *gimage,
GimpDrawable *drawable,
guchar *bg)
gimp_image_get_background (const GimpImage *gimage,
const GimpDrawable *drawable,
guchar *bg)
{
guchar pbg[3];
@ -980,7 +1022,7 @@ gimp_image_get_color_at (GimpImage *gimage,
if (x < 0 || y < 0 || x >= gimage->width || y >= gimage->height)
return NULL;
dest = g_new (unsigned char, 5);
dest = g_new (guchar, 5);
tile = tile_manager_get_tile (gimp_image_composite (gimage), x, y,
TRUE, FALSE);
src = tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT);
@ -998,10 +1040,10 @@ gimp_image_get_color_at (GimpImage *gimage,
}
void
gimp_image_get_color (GimpImage *gimage,
GimpImageType d_type,
guchar *rgb,
guchar *src)
gimp_image_get_color (const GimpImage *gimage,
GimpImageType d_type,
guchar *rgb,
guchar *src)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
@ -1020,17 +1062,17 @@ gimp_image_get_color (GimpImage *gimage,
}
void
gimp_image_transform_color (GimpImage *gimage,
GimpDrawable *drawable,
guchar *src,
guchar *dest,
GimpImageBaseType type)
gimp_image_transform_color (const GimpImage *gimage,
const GimpDrawable *drawable,
guchar *src,
guchar *dest,
GimpImageBaseType type)
{
GimpImageType d_type;
g_return_if_fail (GIMP_IS_IMAGE (gimage));
d_type = (drawable != NULL) ? drawable_type (drawable) :
d_type = (drawable != NULL) ? gimp_drawable_type (drawable) :
gimp_image_base_type_with_alpha (gimage);
switch (type)
@ -1090,7 +1132,7 @@ gimp_image_transform_color (GimpImage *gimage,
}
}
Guide*
Guide *
gimp_image_add_hguide (GimpImage *gimage)
{
Guide *guide;
@ -1108,7 +1150,7 @@ gimp_image_add_hguide (GimpImage *gimage)
return guide;
}
Guide*
Guide *
gimp_image_add_vguide (GimpImage *gimage)
{
Guide *guide;
@ -1178,8 +1220,8 @@ list_func (gchar *key,
}
gchar **
gimp_image_parasite_list (GimpImage *gimage,
gint *count)
gimp_image_parasite_list (const GimpImage *gimage,
gint *count)
{
gchar **list;
gchar **cur;
@ -1242,9 +1284,11 @@ Tattoo
gimp_image_get_new_tattoo (GimpImage *image)
{
image->tattoo_state++;
if (image->tattoo_state <= 0)
g_warning ("Tattoo state has become corrupt (2.1 billion operation limit exceded)");
return (image->tattoo_state);
return image->tattoo_state;
}
Tattoo
@ -1334,18 +1378,6 @@ gimp_image_set_tattoo_state (GimpImage *gimage,
return retval;
}
void
gimp_image_colormap_changed (GimpImage *gimage,
gint col)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (col < gimage->num_cols);
gtk_signal_emit (GTK_OBJECT (gimage),
gimp_image_signals[COLORMAP_CHANGED],
col);
}
void
gimp_image_set_paths (GimpImage *gimage,
PathList *paths)
@ -1356,13 +1388,25 @@ gimp_image_set_paths (GimpImage *gimage,
}
PathList *
gimp_image_get_paths (GimpImage *gimage)
gimp_image_get_paths (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
return gimage->paths;
}
void
gimp_image_colormap_changed (const GimpImage *gimage,
gint col)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (col < gimage->num_cols);
gtk_signal_emit (GTK_OBJECT (gimage),
gimp_image_signals[COLORMAP_CHANGED],
col);
}
/************************************************************/
/* Projection functions */
/************************************************************/
@ -1478,8 +1522,10 @@ gimp_image_free_channels (GimpImage *gimage)
for (list = gimage->channels; list; list = g_slist_next (list))
{
channel = (Channel *) list->data;
channel_delete (channel);
gtk_object_unref (GTK_OBJECT (channel));
}
g_slist_free (gimage->channels);
}
@ -1748,8 +1794,7 @@ gimp_image_construct (GimpImage *gimage,
gint x,
gint y,
gint w,
gint h,
gboolean can_use_cowproject)
gint h)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
@ -1950,8 +1995,7 @@ gimp_image_invalidate (GimpImage *gimage,
if ((endx - startx) > 0 && (endy - starty) > 0)
gimp_image_construct (gimage,
startx, starty,
(endx - startx), (endy - starty),
TRUE);
(endx - startx), (endy - starty));
}
void
@ -1972,12 +2016,12 @@ gimp_image_validate (TileManager *tm,
w = tile_ewidth (tile);
h = tile_eheight (tile);
gimp_image_construct (gimage, x, y, w, h, FALSE);
gimp_image_construct (gimage, x, y, w, h);
}
gint
gimp_image_get_layer_index (GimpImage *gimage,
Layer *layer_arg)
gimp_image_get_layer_index (const GimpImage *gimage,
const Layer *layer_arg)
{
Layer *layer;
GSList *layers;
@ -1990,6 +2034,7 @@ gimp_image_get_layer_index (GimpImage *gimage,
layers = g_slist_next (layers), index++)
{
layer = (Layer *) layers->data;
if (layer == layer_arg)
return index;
}
@ -1998,23 +2043,22 @@ gimp_image_get_layer_index (GimpImage *gimage,
}
Layer *
gimp_image_get_layer_by_index (GimpImage *gimage,
gint layer_index)
gimp_image_get_layer_by_index (const GimpImage *gimage,
gint layer_index)
{
Layer *layer;
g_return_val_if_fail (gimage != NULL, NULL);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
layer =
(Layer *) g_slist_nth_data (gimage->layers, layer_index);
layer = (Layer *) g_slist_nth_data (gimage->layers, layer_index);
return layer;
}
gint
gimp_image_get_channel_index (GimpImage *gimage,
Channel *channel_ID)
gimp_image_get_channel_index (const GimpImage *gimage,
const Channel *channel_arg)
{
Channel *channel;
GSList *channels;
@ -2028,7 +2072,8 @@ gimp_image_get_channel_index (GimpImage *gimage,
channels = g_slist_next (channels), index++)
{
channel = (Channel *) channels->data;
if (channel == channel_ID)
if (channel == channel_arg)
return index;
}
@ -2036,7 +2081,7 @@ gimp_image_get_channel_index (GimpImage *gimage,
}
Layer *
gimp_image_get_active_layer (GimpImage *gimage)
gimp_image_get_active_layer (const GimpImage *gimage)
{
g_return_val_if_fail (gimage != NULL, NULL);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
@ -2045,7 +2090,7 @@ gimp_image_get_active_layer (GimpImage *gimage)
}
Channel *
gimp_image_get_active_channel (GimpImage *gimage)
gimp_image_get_active_channel (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
@ -2053,8 +2098,8 @@ gimp_image_get_active_channel (GimpImage *gimage)
}
Layer *
gimp_image_get_layer_by_tattoo (GimpImage *gimage,
Tattoo tattoo)
gimp_image_get_layer_by_tattoo (const GimpImage *gimage,
Tattoo tattoo)
{
Layer *layer;
GSList *layers;
@ -2066,6 +2111,7 @@ gimp_image_get_layer_by_tattoo (GimpImage *gimage,
layers = g_slist_next (layers))
{
layer = (Layer *) layers->data;
if (layer_get_tattoo (layer) == tattoo)
return layer;
}
@ -2074,8 +2120,8 @@ gimp_image_get_layer_by_tattoo (GimpImage *gimage,
}
Channel *
gimp_image_get_channel_by_tattoo (GimpImage *gimage,
Tattoo tattoo)
gimp_image_get_channel_by_tattoo (const GimpImage *gimage,
Tattoo tattoo)
{
Channel *channel;
GSList *channels;
@ -2087,6 +2133,7 @@ gimp_image_get_channel_by_tattoo (GimpImage *gimage,
channels = g_slist_next (channels))
{
channel = (Channel *) channels->data;
if (channel_get_tattoo (channel) == tattoo)
return channel;
}
@ -2095,8 +2142,8 @@ gimp_image_get_channel_by_tattoo (GimpImage *gimage,
}
Channel *
gimp_image_get_channel_by_name (GimpImage *gimage,
char *name)
gimp_image_get_channel_by_name (const GimpImage *gimage,
const gchar *name)
{
Channel *channel;
GSList *channels;
@ -2108,16 +2155,24 @@ gimp_image_get_channel_by_name (GimpImage *gimage,
channels = g_slist_next (channels))
{
channel = (Channel *) channels->data;
if (! strcmp(channel_get_name (channel),name) )
if (! strcmp (drawable_get_name (GIMP_DRAWABLE (channel)), name))
return channel;
}
return NULL;
}
gint
gimp_image_get_component_active (GimpImage *gimage,
ChannelType type)
Channel *
gimp_image_get_mask (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
return gimage->selection_mask;
}
gboolean
gimp_image_get_component_active (const GimpImage *gimage,
ChannelType type)
{
/* No sanity checking here... */
switch (type)
@ -2131,9 +2186,9 @@ gimp_image_get_component_active (GimpImage *gimage,
}
}
gint
gimp_image_get_component_visible (GimpImage *gimage,
ChannelType type)
gboolean
gimp_image_get_component_visible (const GimpImage *gimage,
ChannelType type)
{
/* No sanity checking here... */
switch (type)
@ -2147,35 +2202,29 @@ gimp_image_get_component_visible (GimpImage *gimage,
}
}
Channel *
gimp_image_get_mask (GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
return gimage->selection_mask;
}
gboolean
gimp_image_layer_boundary (GimpImage *gimage,
BoundSeg **segs,
int *num_segs)
gimp_image_layer_boundary (const GimpImage *gimage,
BoundSeg **segs,
gint *n_segs)
{
Layer *layer;
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
g_return_val_if_fail (segs != NULL, FALSE);
g_return_val_if_fail (n_segs != NULL, FALSE);
/* The second boundary corresponds to the active layer's
* perimeter...
*/
if ((layer = gimage->active_layer))
{
*segs = layer_boundary (layer, num_segs);
*segs = layer_boundary (layer, n_segs);
return TRUE;
}
else
{
*segs = NULL;
*num_segs = 0;
*n_segs = 0;
return FALSE;
}
}
@ -2185,6 +2234,7 @@ gimp_image_set_active_layer (GimpImage *gimage,
Layer *layer)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
g_return_val_if_fail (GIMP_IS_LAYER (layer), NULL);
/* First, find the layer in the gimage
* If it isn't valid, find the first layer that is
@ -2264,16 +2314,16 @@ gimp_image_unset_active_channel (GimpImage *gimage)
void
gimp_image_set_component_active (GimpImage *gimage,
ChannelType type,
gint value)
gboolean active)
{
/* No sanity checking here... */
switch (type)
{
case RED_CHANNEL: gimage->active[RED_PIX] = value; break;
case GREEN_CHANNEL: gimage->active[GREEN_PIX] = value; break;
case BLUE_CHANNEL: gimage->active[BLUE_PIX] = value; break;
case GRAY_CHANNEL: gimage->active[GRAY_PIX] = value; break;
case INDEXED_CHANNEL: gimage->active[INDEXED_PIX] = value; break;
case RED_CHANNEL: gimage->active[RED_PIX] = active; break;
case GREEN_CHANNEL: gimage->active[GREEN_PIX] = active; break;
case BLUE_CHANNEL: gimage->active[BLUE_PIX] = active; break;
case GRAY_CHANNEL: gimage->active[GRAY_PIX] = active; break;
case INDEXED_CHANNEL: gimage->active[INDEXED_PIX] = active; break;
case AUXILLARY_CHANNEL: break;
}
@ -2287,24 +2337,24 @@ gimp_image_set_component_active (GimpImage *gimage,
void
gimp_image_set_component_visible (GimpImage *gimage,
ChannelType type,
gint value)
gboolean visible)
{
/* No sanity checking here... */
switch (type)
{
case RED_CHANNEL: gimage->visible[RED_PIX] = value; break;
case GREEN_CHANNEL: gimage->visible[GREEN_PIX] = value; break;
case BLUE_CHANNEL: gimage->visible[BLUE_PIX] = value; break;
case GRAY_CHANNEL: gimage->visible[GRAY_PIX] = value; break;
case INDEXED_CHANNEL: gimage->visible[INDEXED_PIX] = value; break;
case RED_CHANNEL: gimage->visible[RED_PIX] = visible; break;
case GREEN_CHANNEL: gimage->visible[GREEN_PIX] = visible; break;
case BLUE_CHANNEL: gimage->visible[BLUE_PIX] = visible; break;
case GRAY_CHANNEL: gimage->visible[GRAY_PIX] = visible; break;
case INDEXED_CHANNEL: gimage->visible[INDEXED_PIX] = visible; break;
default: break;
}
}
Layer *
gimp_image_pick_correlate_layer (GimpImage *gimage,
gint x,
gint y)
gimp_image_pick_correlate_layer (const GimpImage *gimage,
gint x,
gint y)
{
Layer *layer;
GSList *list;
@ -2322,8 +2372,6 @@ gimp_image_pick_correlate_layer (GimpImage *gimage,
return NULL;
}
Layer *
gimp_image_raise_layer (GimpImage *gimage,
Layer *layer_arg)
@ -2763,7 +2811,7 @@ gimp_image_merge_layers (GimpImage *gimage,
}
merge_layer = layer_new (gimage, (x2 - x1), (y2 - y1),
type, drawable_get_name (GIMP_DRAWABLE(layer)),
type, drawable_get_name (GIMP_DRAWABLE (layer)),
OPAQUE_OPACITY, NORMAL_MODE);
if (!merge_layer)
{
@ -3009,12 +3057,18 @@ gimp_image_add_layer (GimpImage *gimage,
position = 1;
gimage->layers =
g_slist_insert (gimage->layers, layer_ref (float_layer), position);
g_slist_insert (gimage->layers, float_layer, position);
gtk_object_ref (GTK_OBJECT (float_layer));
gtk_object_sink (GTK_OBJECT (float_layer));
}
else
{
gimage->layers =
g_slist_prepend (gimage->layers, layer_ref (float_layer));
g_slist_prepend (gimage->layers, float_layer);
gtk_object_ref (GTK_OBJECT (float_layer));
gtk_object_sink (GTK_OBJECT (float_layer));
}
gimage->layer_stack = g_slist_prepend (gimage->layer_stack, float_layer);
@ -3374,7 +3428,10 @@ gimp_image_add_channel (GimpImage *gimage,
undo_push_channel (gimage, CHANNEL_ADD_UNDO, cu);
/* add the channel to the list */
gimage->channels = g_slist_prepend (gimage->channels, channel_ref (channel));
gimage->channels = g_slist_prepend (gimage->channels, channel);
gtk_object_ref (GTK_OBJECT (channel));
gtk_object_sink (GTK_OBJECT (channel));
/* notify this gimage of the currently active channel */
gimp_image_set_active_channel (gimage, channel);
@ -3419,9 +3476,9 @@ gimp_image_remove_channel (GimpImage *gimage,
0, 0,
drawable_width (GIMP_DRAWABLE(channel)),
drawable_height (GIMP_DRAWABLE(channel)));
/* Send out REMOVED signal from channel */
channel_removed (channel, gimage);
channel_removed (channel);
/* Important to push the undo here in case the push fails */
undo_push_channel (gimage, CHANNEL_REMOVE_UNDO, cu);
@ -3434,48 +3491,55 @@ gimp_image_remove_channel (GimpImage *gimage,
/************************************************************/
gboolean
gimp_image_is_empty (GimpImage *gimage)
gimp_image_is_empty (const GimpImage *gimage)
{
g_return_val_if_fail (gimage != NULL, TRUE);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), TRUE);
return (! gimage->layers);
return ! gimage->layers;
}
GimpDrawable *
gimp_image_active_drawable (GimpImage *gimage)
gimp_image_active_drawable (const GimpImage *gimage)
{
Layer *layer;
g_return_val_if_fail (gimage != NULL, NULL);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
/* If there is an active channel (a saved selection, etc.),
* we ignore the active layer
*/
if (gimage->active_channel != NULL)
return GIMP_DRAWABLE (gimage->active_channel);
{
return GIMP_DRAWABLE (gimage->active_channel);
}
else if (gimage->active_layer != NULL)
{
layer = gimage->active_layer;
if (layer->mask && layer->edit_mask)
return GIMP_DRAWABLE(layer->mask);
return GIMP_DRAWABLE (layer->mask);
else
return GIMP_DRAWABLE(layer);
return GIMP_DRAWABLE (layer);
}
else
return NULL;
return NULL;
}
GimpImageBaseType
gimp_image_base_type (GimpImage *gimage)
{
gimp_image_base_type (const GimpImage *gimage)
{
g_return_val_if_fail (gimage != NULL, -1);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), -1);
return gimage->base_type;
}
GimpImageType
gimp_image_base_type_with_alpha (GimpImage *gimage)
gimp_image_base_type_with_alpha (const GimpImage *gimage)
{
g_return_val_if_fail (gimage != NULL, -1);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), -1);
switch (gimage->base_type)
@ -3490,9 +3554,10 @@ gimp_image_base_type_with_alpha (GimpImage *gimage)
return RGB_GIMAGE;
}
gchar *
gimp_image_filename (GimpImage *gimage)
const gchar *
gimp_image_filename (const GimpImage *gimage)
{
g_return_val_if_fail (gimage != NULL, NULL);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
if (gimage->has_filename)
@ -3502,7 +3567,7 @@ gimp_image_filename (GimpImage *gimage)
}
gboolean
gimp_image_undo_is_enabled (GimpImage *gimage)
gimp_image_undo_is_enabled (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
@ -3550,7 +3615,7 @@ gimp_image_undo_enable (GimpImage *gimage)
void
gimp_image_undo_event (GimpImage *gimage,
int event)
gint event)
{
gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[UNDO_EVENT], event);
}
@ -3592,10 +3657,10 @@ gimp_image_dirty (GimpImage *gimage)
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
gimage->dirty++;
gtk_signal_emit(GTK_OBJECT(gimage), gimp_image_signals[DIRTY]);
gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[DIRTY]);
TRC (("dirty %d -> %d\n", gimage->dirty-1, gimage->dirty));
return gimage->dirty;
}
@ -3605,7 +3670,7 @@ gimp_image_clean (GimpImage *gimage)
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
gimage->dirty--;
gtk_signal_emit(GTK_OBJECT(gimage), gimp_image_signals[CLEAN]);
gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[CLEAN]);
TRC (("clean %d -> %d\n", gimage->dirty+1, gimage->dirty));
@ -3619,11 +3684,11 @@ gimp_image_clean_all (GimpImage *gimage)
gimage->dirty = 0;
gtk_signal_emit (GTK_OBJECT(gimage), gimp_image_signals[CLEAN]);
gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[CLEAN]);
}
Layer *
gimp_image_floating_sel (GimpImage *gimage)
gimp_image_floating_sel (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
@ -3634,7 +3699,7 @@ gimp_image_floating_sel (GimpImage *gimage)
}
guchar *
gimp_image_cmap (GimpImage *gimage)
gimp_image_cmap (const GimpImage *gimage)
{
return drawable_cmap (gimp_image_active_drawable (gimage));
}
@ -3651,13 +3716,15 @@ gimp_image_projection (GimpImage *gimage)
if ((gimage->projection == NULL) ||
(tile_manager_level_width (gimage->projection) != gimage->width) ||
(tile_manager_level_height (gimage->projection) != gimage->height))
gimp_image_allocate_projection (gimage);
{
gimp_image_allocate_projection (gimage);
}
return gimage->projection;
}
GimpImageType
gimp_image_projection_type (GimpImage *gimage)
gimp_image_projection_type (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), -1);
@ -3665,7 +3732,7 @@ gimp_image_projection_type (GimpImage *gimage)
}
gint
gimp_image_projection_bytes (GimpImage *gimage)
gimp_image_projection_bytes (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), -1);
@ -3673,7 +3740,7 @@ gimp_image_projection_bytes (GimpImage *gimage)
}
gint
gimp_image_projection_opacity (GimpImage *gimage)
gimp_image_projection_opacity (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), -1);
@ -3697,13 +3764,13 @@ gimp_image_composite (GimpImage *gimage)
}
GimpImageType
gimp_image_composite_type (GimpImage *gimage)
gimp_image_composite_type (const GimpImage *gimage)
{
return gimp_image_projection_type (gimage);
}
gint
gimp_image_composite_bytes (GimpImage *gimage)
gimp_image_composite_bytes (const GimpImage *gimage)
{
return gimp_image_projection_bytes (gimage);
}
@ -3913,8 +3980,8 @@ gimp_image_composite_preview (GimpImage *gimage,
}
gboolean
gimp_image_preview_valid (GimpImage *gimage,
ChannelType type)
gimp_image_preview_valid (const GimpImage *gimage,
ChannelType type)
{
switch (type)
{

View File

@ -88,10 +88,10 @@ typedef enum
struct _Guide
{
int ref_count;
int position;
int orientation;
guint32 guide_ID;
gint ref_count;
gint position;
InternalOrientationType orientation;
guint32 guide_ID;
};
@ -105,76 +105,103 @@ typedef struct _GimpImageRepaintArg
} GimpImageRepaintArg;
GtkType gimp_image_get_type (void);
/* function declarations */
GimpImage * gimp_image_new (gint, gint,
GimpImageBaseType);
void gimp_image_set_filename (GimpImage *, gchar *);
void gimp_image_set_resolution (GimpImage *,
gdouble, gdouble);
void gimp_image_get_resolution (GimpImage *,
gdouble *, gdouble *);
void gimp_image_set_unit (GimpImage *, GimpUnit);
GimpUnit gimp_image_get_unit (GimpImage *);
void gimp_image_set_save_proc (GimpImage *,
PlugInProcDef *);
PlugInProcDef * gimp_image_get_save_proc (GimpImage *);
gint gimp_image_get_width (const GimpImage *);
gint gimp_image_get_height (const GimpImage *);
void gimp_image_resize (GimpImage *,
gint, gint, gint, gint);
void gimp_image_scale (GimpImage *, gint, gint);
GimpImage * gimp_image_get_named (gchar *);
GimpImage * gimp_image_get_ID (gint);
TileManager * gimp_image_shadow (GimpImage *,
gint, gint, gint);
void gimp_image_free_shadow (GimpImage *);
void gimp_image_apply_image (GimpImage *, GimpDrawable *,
PixelRegion *, gint,
gint,
LayerModeEffects,
TileManager *, gint, gint);
void gimp_image_replace_image (GimpImage *, GimpDrawable *,
PixelRegion *, gint, gint,
PixelRegion *, gint, gint);
void gimp_image_get_foreground (GimpImage *, GimpDrawable *,
guchar *);
void gimp_image_get_background (GimpImage *, GimpDrawable *,
guchar *);
guchar * gimp_image_get_color_at (GimpImage *, gint, gint);
void gimp_image_get_color (GimpImage *,
GimpImageType,
guchar *,
guchar *);
void gimp_image_transform_color (GimpImage *,
GimpDrawable *,
guchar *,
guchar *,
GimpImageBaseType);
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 *);
GtkType gimp_image_get_type (void);
GimpParasite * gimp_image_parasite_find (const GimpImage *,
const gchar *name);
gchar ** gimp_image_parasite_list (GimpImage *gimage,
gint *count);
void gimp_image_parasite_attach (GimpImage *,
GimpParasite *);
void gimp_image_parasite_detach (GimpImage *, const gchar *);
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);
Tattoo gimp_image_get_new_tattoo (GimpImage *);
gboolean gimp_image_set_tattoo_state (GimpImage *, Tattoo);
Tattoo gimp_image_get_tattoo_state (GimpImage *);
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);
void gimp_image_set_paths (GimpImage *, PathList *);
PathList * gimp_image_get_paths (GimpImage *);
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);
/* Temporary hack till colormap manipulation is encapsulated in functions.
Call this whenever you modify an image's colormap. The ncol argument
@ -182,115 +209,169 @@ PathList * gimp_image_get_paths (GimpImage *);
Currently, use this also when the image's base type is changed to/from
indexed. */
void gimp_image_colormap_changed (GimpImage * image,
gint ncol);
void gimp_image_colormap_changed (const GimpImage *image,
gint col);
/* layer/channel functions */
gint gimp_image_get_layer_index (GimpImage *, Layer *);
Layer * gimp_image_get_layer_by_index (GimpImage *, gint);
gint gimp_image_get_channel_index (GimpImage *, Channel *);
Layer * gimp_image_get_active_layer (GimpImage *);
Channel * gimp_image_get_active_channel (GimpImage *);
Layer * gimp_image_get_layer_by_tattoo (GimpImage *, Tattoo);
Channel * gimp_image_get_channel_by_tattoo (GimpImage *, Tattoo);
Channel * gimp_image_get_channel_by_name (GimpImage *, gchar *);
Channel * gimp_image_get_mask (GimpImage *);
gint gimp_image_get_component_active (GimpImage *, ChannelType);
gint gimp_image_get_component_visible (GimpImage *, ChannelType);
gboolean gimp_image_layer_boundary (GimpImage *, BoundSeg **,
gint *);
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,
gint);
void gimp_image_set_component_visible (GimpImage *, ChannelType,
gint);
Layer * gimp_image_pick_correlate_layer (GimpImage *, gint, gint);
void gimp_image_set_layer_mask_apply (GimpImage *, gint);
void gimp_image_set_layer_mask_edit (GimpImage *, Layer *, gint);
void gimp_image_set_layer_mask_show (GimpImage *, gint);
Layer * gimp_image_raise_layer (GimpImage *, Layer *);
Layer * gimp_image_lower_layer (GimpImage *, Layer *);
Layer * gimp_image_raise_layer_to_top (GimpImage *, Layer *);
Layer * gimp_image_lower_layer_to_bottom (GimpImage *, Layer *);
Layer * gimp_image_position_layer (GimpImage *, Layer *,
gint, gboolean);
Layer * gimp_image_merge_visible_layers (GimpImage *, MergeType);
Layer * gimp_image_merge_down (GimpImage *, Layer *,
MergeType);
Layer * gimp_image_flatten (GimpImage *);
Layer * gimp_image_merge_layers (GimpImage *, GSList *,
MergeType);
Layer * gimp_image_add_layer (GimpImage *, Layer *, gint);
Layer * gimp_image_remove_layer (GimpImage *, Layer *);
LayerMask * gimp_image_add_layer_mask (GimpImage *, Layer *,
LayerMask *);
Channel * gimp_image_remove_layer_mask (GimpImage *, Layer *,
MaskApplyMode);
Channel * gimp_image_raise_channel (GimpImage *, Channel *);
Channel * gimp_image_lower_channel (GimpImage *, Channel *);
Channel * gimp_image_position_channel (GimpImage *, Channel *, gint);
Channel * gimp_image_add_channel (GimpImage *, Channel *, gint);
Channel * gimp_image_remove_channel (GimpImage *, Channel *);
void gimp_image_construct (GimpImage *,
gint, gint, gint, gint,
gboolean);
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 *, gint, gint,
gint, gint, gint,
gint, gint, gint);
void gimp_image_invalidate (GimpImage *, gint, gint,
gint, gint, gint,
gint, gint, gint);
void gimp_image_validate (TileManager *, Tile *);
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);
/* Access functions */
gboolean gimp_image_is_empty (GimpImage *);
GimpDrawable * gimp_image_active_drawable (GimpImage *);
gboolean gimp_image_is_empty (const GimpImage *gimage);
GimpDrawable * gimp_image_active_drawable (const GimpImage *gimage);
GimpImageBaseType gimp_image_base_type (GimpImage *gimage);
GimpImageType gimp_image_base_type_with_alpha (GimpImage *gimage);
GimpImageBaseType gimp_image_base_type (const GimpImage *gimage);
GimpImageType gimp_image_base_type_with_alpha (const GimpImage *gimage);
gchar * gimp_image_filename (GimpImage *);
gboolean gimp_image_undo_is_enabled (GimpImage *);
gboolean gimp_image_undo_enable (GimpImage *);
gboolean gimp_image_undo_disable (GimpImage *);
gboolean gimp_image_undo_freeze (GimpImage *);
gboolean gimp_image_undo_thaw (GimpImage *);
void gimp_image_undo_event (GimpImage *, gint);
gint gimp_image_dirty (GimpImage *);
gint gimp_image_clean (GimpImage *);
void gimp_image_clean_all (GimpImage *);
Layer * gimp_image_floating_sel (GimpImage *);
guchar * gimp_image_cmap (GimpImage *);
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);
/* projection access functions */
TileManager * gimp_image_projection (GimpImage *);
GimpImageType gimp_image_projection_type (GimpImage *);
gint gimp_image_projection_bytes (GimpImage *);
gint gimp_image_projection_opacity (GimpImage *);
void gimp_image_projection_realloc (GimpImage *);
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);
/* composite access functions */
TileManager * gimp_image_composite (GimpImage *);
GimpImageType gimp_image_composite_type (GimpImage *);
gint gimp_image_composite_bytes (GimpImage *);
TempBuf * gimp_image_composite_preview (GimpImage *, ChannelType,
gint, gint);
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);
gint gimp_image_preview_valid (GimpImage *, ChannelType);
void gimp_image_invalidate_preview (GimpImage *);
gint gimp_image_preview_valid (const GimpImage *gimage,
ChannelType type);
void gimp_image_invalidate_preview (GimpImage *gimage);
void gimp_image_invalidate_previews (void);
void gimp_image_invalidate_previews (void);
TempBuf * gimp_image_construct_composite_preview (GimpImage *,
gint , gint);
TempBuf * gimp_image_construct_composite_preview (GimpImage *gimage,
gint width,
gint height);
#endif /* __GIMPIMAGE_H__ */

View File

@ -59,28 +59,58 @@
/* Local function declarations */
static void gimp_image_destroy (GtkObject *object);
static void gimp_image_free_projection (GimpImage *);
static void gimp_image_allocate_shadow (GimpImage *, gint, gint, gint);
static void gimp_image_allocate_projection (GimpImage *);
static void gimp_image_free_layers (GimpImage *);
static void gimp_image_free_channels (GimpImage *);
static void gimp_image_construct_layers (GimpImage *, gint, gint, gint, gint);
static void gimp_image_construct_channels (GimpImage *, gint, gint, gint, gint);
static void gimp_image_initialize_projection (GimpImage *, gint, gint, gint, gint);
static void gimp_image_get_active_channels (GimpImage *, GimpDrawable *, gint *);
static void gimp_image_destroy (GtkObject *object);
static void gimp_image_free_projection (GimpImage *gimage);
static void gimp_image_allocate_shadow (GimpImage *gimage,
gint width,
gint height,
gint bpp);
static void gimp_image_allocate_projection (GimpImage *gimage);
static void gimp_image_free_layers (GimpImage *gimage);
static void gimp_image_free_channels (GimpImage *gimage);
static void gimp_image_construct_layers (GimpImage *gimage,
gint x,
gint y,
gint w,
gint h);
static void gimp_image_construct_channels (GimpImage *gimage,
gint x,
gint y,
gint w,
gint h);
static void gimp_image_initialize_projection (GimpImage *gimage,
gint x,
gint y,
gint w,
gint h);
static void gimp_image_get_active_channels (GimpImage *gimage,
GimpDrawable *drawable,
gint *active);
/* projection functions */
static void project_intensity (GimpImage *, Layer *,
PixelRegion *, PixelRegion *,
PixelRegion *);
static void project_intensity_alpha (GimpImage *, Layer *,
PixelRegion *, PixelRegion *,
PixelRegion *);
static void project_indexed (GimpImage *, Layer *,
PixelRegion *, PixelRegion *);
static void project_channel (GimpImage *, Channel *,
PixelRegion *, PixelRegion *);
static void project_intensity (GimpImage *gimage,
Layer *layer,
PixelRegion *src,
PixelRegion *dest,
PixelRegion *mask);
static void project_intensity_alpha (GimpImage *gimage,
Layer *layer,
PixelRegion *src,
PixelRegion *dest,
PixelRegion *mask);
static void project_indexed (GimpImage *gimage,
Layer *layer,
PixelRegion *src,
PixelRegion *dest);
static void project_indexed_alpha (GimpImage *gimage,
Layer *layer,
PixelRegion *src,
PixelRegion *dest,
PixelRegion *mask);
static void project_channel (GimpImage *gimage,
Channel *layer,
PixelRegion *src,
PixelRegion *src2);
/*
* Global variables
@ -108,7 +138,8 @@ guint32 next_guide_id = 1; /* For generating guide_ID handles for PDB stuff */
* Static variables
*/
enum {
enum
{
CLEAN,
DIRTY,
REPAINT,
@ -120,8 +151,9 @@ enum {
LAST_SIGNAL
};
static guint gimp_image_signals[LAST_SIGNAL];
static GimpObjectClass *parent_class;
static guint gimp_image_signals[LAST_SIGNAL] = { 0 };
static GimpObjectClass *parent_class = NULL;
static void
@ -129,13 +161,11 @@ gimp_image_class_init (GimpImageClass *klass)
{
GtkObjectClass *object_class;
GtkType type;
object_class = GTK_OBJECT_CLASS(klass);
parent_class = gtk_type_class (gimp_object_get_type ());
type=object_class->type;
object_class->destroy = gimp_image_destroy;
object_class = GTK_OBJECT_CLASS (klass);
parent_class = gtk_type_class (gimp_object_get_type ());
type = object_class->type;
gimp_image_signals[CLEAN] =
gimp_signal_new ("clean", GTK_RUN_FIRST, type, 0,
@ -163,6 +193,17 @@ gimp_image_class_init (GimpImageClass *klass)
gimp_sigtype_int);
gtk_object_class_add_signals (object_class, gimp_image_signals, LAST_SIGNAL);
object_class->destroy = gimp_image_destroy;
klass->clean = NULL;
klass->dirty = NULL;
klass->repaint = NULL;
klass->rename = NULL;
klass->resize = NULL;
klass->restructure = NULL;
klass->colormap_changed = NULL;
klass->undo_event = NULL;
}
@ -384,9 +425,9 @@ gimp_image_set_resolution (GimpImage *gimage,
}
void
gimp_image_get_resolution (GimpImage *gimage,
gdouble *xresolution,
gdouble *yresolution)
gimp_image_get_resolution (const GimpImage *gimage,
gdouble *xresolution,
gdouble *yresolution)
{
g_return_if_fail (xresolution && yresolution);
@ -404,7 +445,7 @@ gimp_image_set_unit (GimpImage *gimage,
}
GimpUnit
gimp_image_get_unit (GimpImage *gimage)
gimp_image_get_unit (const GimpImage *gimage)
{
return gimage->unit;
}
@ -417,11 +458,23 @@ gimp_image_set_save_proc (GimpImage *gimage,
}
PlugInProcDef *
gimp_image_get_save_proc (GimpImage *gimage)
gimp_image_get_save_proc (const GimpImage *gimage)
{
return gimage->save_proc;
}
gint
gimp_image_get_width (const GimpImage *gimage)
{
return gimage->width;
}
gint
gimp_image_get_height (const GimpImage *gimage)
{
return gimage->height;
}
void
gimp_image_resize (GimpImage *gimage,
gint new_width,
@ -518,18 +571,6 @@ gimp_image_resize (GimpImage *gimage,
gimp_remove_busy_cursors (NULL);
}
gint
gimp_image_get_width (const GimpImage *gimage)
{
return gimage->width;
}
gint
gimp_image_get_height (const GimpImage *gimage)
{
return gimage->height;
}
void
gimp_image_scale (GimpImage *gimage,
gint new_width,
@ -696,7 +737,8 @@ gimp_image_destroy (GtkObject *object)
gimp_image_free_layers (gimage);
gimp_image_free_channels (gimage);
channel_delete (gimage->selection_mask);
gtk_object_unref (GTK_OBJECT (gimage->selection_mask));
if (gimage->comp_preview)
temp_buf_free (gimage->comp_preview);
@ -941,9 +983,9 @@ gimp_image_replace_image (GimpImage *gimage,
/* Get rid of these! A "foreground" is an UI concept.. */
void
gimp_image_get_foreground (GimpImage *gimage,
GimpDrawable *drawable,
guchar *fg)
gimp_image_get_foreground (const GimpImage *gimage,
const GimpDrawable *drawable,
guchar *fg)
{
guchar pfg[3];
@ -954,9 +996,9 @@ gimp_image_get_foreground (GimpImage *gimage,
}
void
gimp_image_get_background (GimpImage *gimage,
GimpDrawable *drawable,
guchar *bg)
gimp_image_get_background (const GimpImage *gimage,
const GimpDrawable *drawable,
guchar *bg)
{
guchar pbg[3];
@ -980,7 +1022,7 @@ gimp_image_get_color_at (GimpImage *gimage,
if (x < 0 || y < 0 || x >= gimage->width || y >= gimage->height)
return NULL;
dest = g_new (unsigned char, 5);
dest = g_new (guchar, 5);
tile = tile_manager_get_tile (gimp_image_composite (gimage), x, y,
TRUE, FALSE);
src = tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT);
@ -998,10 +1040,10 @@ gimp_image_get_color_at (GimpImage *gimage,
}
void
gimp_image_get_color (GimpImage *gimage,
GimpImageType d_type,
guchar *rgb,
guchar *src)
gimp_image_get_color (const GimpImage *gimage,
GimpImageType d_type,
guchar *rgb,
guchar *src)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
@ -1020,17 +1062,17 @@ gimp_image_get_color (GimpImage *gimage,
}
void
gimp_image_transform_color (GimpImage *gimage,
GimpDrawable *drawable,
guchar *src,
guchar *dest,
GimpImageBaseType type)
gimp_image_transform_color (const GimpImage *gimage,
const GimpDrawable *drawable,
guchar *src,
guchar *dest,
GimpImageBaseType type)
{
GimpImageType d_type;
g_return_if_fail (GIMP_IS_IMAGE (gimage));
d_type = (drawable != NULL) ? drawable_type (drawable) :
d_type = (drawable != NULL) ? gimp_drawable_type (drawable) :
gimp_image_base_type_with_alpha (gimage);
switch (type)
@ -1090,7 +1132,7 @@ gimp_image_transform_color (GimpImage *gimage,
}
}
Guide*
Guide *
gimp_image_add_hguide (GimpImage *gimage)
{
Guide *guide;
@ -1108,7 +1150,7 @@ gimp_image_add_hguide (GimpImage *gimage)
return guide;
}
Guide*
Guide *
gimp_image_add_vguide (GimpImage *gimage)
{
Guide *guide;
@ -1178,8 +1220,8 @@ list_func (gchar *key,
}
gchar **
gimp_image_parasite_list (GimpImage *gimage,
gint *count)
gimp_image_parasite_list (const GimpImage *gimage,
gint *count)
{
gchar **list;
gchar **cur;
@ -1242,9 +1284,11 @@ Tattoo
gimp_image_get_new_tattoo (GimpImage *image)
{
image->tattoo_state++;
if (image->tattoo_state <= 0)
g_warning ("Tattoo state has become corrupt (2.1 billion operation limit exceded)");
return (image->tattoo_state);
return image->tattoo_state;
}
Tattoo
@ -1334,18 +1378,6 @@ gimp_image_set_tattoo_state (GimpImage *gimage,
return retval;
}
void
gimp_image_colormap_changed (GimpImage *gimage,
gint col)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (col < gimage->num_cols);
gtk_signal_emit (GTK_OBJECT (gimage),
gimp_image_signals[COLORMAP_CHANGED],
col);
}
void
gimp_image_set_paths (GimpImage *gimage,
PathList *paths)
@ -1356,13 +1388,25 @@ gimp_image_set_paths (GimpImage *gimage,
}
PathList *
gimp_image_get_paths (GimpImage *gimage)
gimp_image_get_paths (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
return gimage->paths;
}
void
gimp_image_colormap_changed (const GimpImage *gimage,
gint col)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (col < gimage->num_cols);
gtk_signal_emit (GTK_OBJECT (gimage),
gimp_image_signals[COLORMAP_CHANGED],
col);
}
/************************************************************/
/* Projection functions */
/************************************************************/
@ -1478,8 +1522,10 @@ gimp_image_free_channels (GimpImage *gimage)
for (list = gimage->channels; list; list = g_slist_next (list))
{
channel = (Channel *) list->data;
channel_delete (channel);
gtk_object_unref (GTK_OBJECT (channel));
}
g_slist_free (gimage->channels);
}
@ -1748,8 +1794,7 @@ gimp_image_construct (GimpImage *gimage,
gint x,
gint y,
gint w,
gint h,
gboolean can_use_cowproject)
gint h)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
@ -1950,8 +1995,7 @@ gimp_image_invalidate (GimpImage *gimage,
if ((endx - startx) > 0 && (endy - starty) > 0)
gimp_image_construct (gimage,
startx, starty,
(endx - startx), (endy - starty),
TRUE);
(endx - startx), (endy - starty));
}
void
@ -1972,12 +2016,12 @@ gimp_image_validate (TileManager *tm,
w = tile_ewidth (tile);
h = tile_eheight (tile);
gimp_image_construct (gimage, x, y, w, h, FALSE);
gimp_image_construct (gimage, x, y, w, h);
}
gint
gimp_image_get_layer_index (GimpImage *gimage,
Layer *layer_arg)
gimp_image_get_layer_index (const GimpImage *gimage,
const Layer *layer_arg)
{
Layer *layer;
GSList *layers;
@ -1990,6 +2034,7 @@ gimp_image_get_layer_index (GimpImage *gimage,
layers = g_slist_next (layers), index++)
{
layer = (Layer *) layers->data;
if (layer == layer_arg)
return index;
}
@ -1998,23 +2043,22 @@ gimp_image_get_layer_index (GimpImage *gimage,
}
Layer *
gimp_image_get_layer_by_index (GimpImage *gimage,
gint layer_index)
gimp_image_get_layer_by_index (const GimpImage *gimage,
gint layer_index)
{
Layer *layer;
g_return_val_if_fail (gimage != NULL, NULL);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
layer =
(Layer *) g_slist_nth_data (gimage->layers, layer_index);
layer = (Layer *) g_slist_nth_data (gimage->layers, layer_index);
return layer;
}
gint
gimp_image_get_channel_index (GimpImage *gimage,
Channel *channel_ID)
gimp_image_get_channel_index (const GimpImage *gimage,
const Channel *channel_arg)
{
Channel *channel;
GSList *channels;
@ -2028,7 +2072,8 @@ gimp_image_get_channel_index (GimpImage *gimage,
channels = g_slist_next (channels), index++)
{
channel = (Channel *) channels->data;
if (channel == channel_ID)
if (channel == channel_arg)
return index;
}
@ -2036,7 +2081,7 @@ gimp_image_get_channel_index (GimpImage *gimage,
}
Layer *
gimp_image_get_active_layer (GimpImage *gimage)
gimp_image_get_active_layer (const GimpImage *gimage)
{
g_return_val_if_fail (gimage != NULL, NULL);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
@ -2045,7 +2090,7 @@ gimp_image_get_active_layer (GimpImage *gimage)
}
Channel *
gimp_image_get_active_channel (GimpImage *gimage)
gimp_image_get_active_channel (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
@ -2053,8 +2098,8 @@ gimp_image_get_active_channel (GimpImage *gimage)
}
Layer *
gimp_image_get_layer_by_tattoo (GimpImage *gimage,
Tattoo tattoo)
gimp_image_get_layer_by_tattoo (const GimpImage *gimage,
Tattoo tattoo)
{
Layer *layer;
GSList *layers;
@ -2066,6 +2111,7 @@ gimp_image_get_layer_by_tattoo (GimpImage *gimage,
layers = g_slist_next (layers))
{
layer = (Layer *) layers->data;
if (layer_get_tattoo (layer) == tattoo)
return layer;
}
@ -2074,8 +2120,8 @@ gimp_image_get_layer_by_tattoo (GimpImage *gimage,
}
Channel *
gimp_image_get_channel_by_tattoo (GimpImage *gimage,
Tattoo tattoo)
gimp_image_get_channel_by_tattoo (const GimpImage *gimage,
Tattoo tattoo)
{
Channel *channel;
GSList *channels;
@ -2087,6 +2133,7 @@ gimp_image_get_channel_by_tattoo (GimpImage *gimage,
channels = g_slist_next (channels))
{
channel = (Channel *) channels->data;
if (channel_get_tattoo (channel) == tattoo)
return channel;
}
@ -2095,8 +2142,8 @@ gimp_image_get_channel_by_tattoo (GimpImage *gimage,
}
Channel *
gimp_image_get_channel_by_name (GimpImage *gimage,
char *name)
gimp_image_get_channel_by_name (const GimpImage *gimage,
const gchar *name)
{
Channel *channel;
GSList *channels;
@ -2108,16 +2155,24 @@ gimp_image_get_channel_by_name (GimpImage *gimage,
channels = g_slist_next (channels))
{
channel = (Channel *) channels->data;
if (! strcmp(channel_get_name (channel),name) )
if (! strcmp (drawable_get_name (GIMP_DRAWABLE (channel)), name))
return channel;
}
return NULL;
}
gint
gimp_image_get_component_active (GimpImage *gimage,
ChannelType type)
Channel *
gimp_image_get_mask (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
return gimage->selection_mask;
}
gboolean
gimp_image_get_component_active (const GimpImage *gimage,
ChannelType type)
{
/* No sanity checking here... */
switch (type)
@ -2131,9 +2186,9 @@ gimp_image_get_component_active (GimpImage *gimage,
}
}
gint
gimp_image_get_component_visible (GimpImage *gimage,
ChannelType type)
gboolean
gimp_image_get_component_visible (const GimpImage *gimage,
ChannelType type)
{
/* No sanity checking here... */
switch (type)
@ -2147,35 +2202,29 @@ gimp_image_get_component_visible (GimpImage *gimage,
}
}
Channel *
gimp_image_get_mask (GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
return gimage->selection_mask;
}
gboolean
gimp_image_layer_boundary (GimpImage *gimage,
BoundSeg **segs,
int *num_segs)
gimp_image_layer_boundary (const GimpImage *gimage,
BoundSeg **segs,
gint *n_segs)
{
Layer *layer;
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
g_return_val_if_fail (segs != NULL, FALSE);
g_return_val_if_fail (n_segs != NULL, FALSE);
/* The second boundary corresponds to the active layer's
* perimeter...
*/
if ((layer = gimage->active_layer))
{
*segs = layer_boundary (layer, num_segs);
*segs = layer_boundary (layer, n_segs);
return TRUE;
}
else
{
*segs = NULL;
*num_segs = 0;
*n_segs = 0;
return FALSE;
}
}
@ -2185,6 +2234,7 @@ gimp_image_set_active_layer (GimpImage *gimage,
Layer *layer)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
g_return_val_if_fail (GIMP_IS_LAYER (layer), NULL);
/* First, find the layer in the gimage
* If it isn't valid, find the first layer that is
@ -2264,16 +2314,16 @@ gimp_image_unset_active_channel (GimpImage *gimage)
void
gimp_image_set_component_active (GimpImage *gimage,
ChannelType type,
gint value)
gboolean active)
{
/* No sanity checking here... */
switch (type)
{
case RED_CHANNEL: gimage->active[RED_PIX] = value; break;
case GREEN_CHANNEL: gimage->active[GREEN_PIX] = value; break;
case BLUE_CHANNEL: gimage->active[BLUE_PIX] = value; break;
case GRAY_CHANNEL: gimage->active[GRAY_PIX] = value; break;
case INDEXED_CHANNEL: gimage->active[INDEXED_PIX] = value; break;
case RED_CHANNEL: gimage->active[RED_PIX] = active; break;
case GREEN_CHANNEL: gimage->active[GREEN_PIX] = active; break;
case BLUE_CHANNEL: gimage->active[BLUE_PIX] = active; break;
case GRAY_CHANNEL: gimage->active[GRAY_PIX] = active; break;
case INDEXED_CHANNEL: gimage->active[INDEXED_PIX] = active; break;
case AUXILLARY_CHANNEL: break;
}
@ -2287,24 +2337,24 @@ gimp_image_set_component_active (GimpImage *gimage,
void
gimp_image_set_component_visible (GimpImage *gimage,
ChannelType type,
gint value)
gboolean visible)
{
/* No sanity checking here... */
switch (type)
{
case RED_CHANNEL: gimage->visible[RED_PIX] = value; break;
case GREEN_CHANNEL: gimage->visible[GREEN_PIX] = value; break;
case BLUE_CHANNEL: gimage->visible[BLUE_PIX] = value; break;
case GRAY_CHANNEL: gimage->visible[GRAY_PIX] = value; break;
case INDEXED_CHANNEL: gimage->visible[INDEXED_PIX] = value; break;
case RED_CHANNEL: gimage->visible[RED_PIX] = visible; break;
case GREEN_CHANNEL: gimage->visible[GREEN_PIX] = visible; break;
case BLUE_CHANNEL: gimage->visible[BLUE_PIX] = visible; break;
case GRAY_CHANNEL: gimage->visible[GRAY_PIX] = visible; break;
case INDEXED_CHANNEL: gimage->visible[INDEXED_PIX] = visible; break;
default: break;
}
}
Layer *
gimp_image_pick_correlate_layer (GimpImage *gimage,
gint x,
gint y)
gimp_image_pick_correlate_layer (const GimpImage *gimage,
gint x,
gint y)
{
Layer *layer;
GSList *list;
@ -2322,8 +2372,6 @@ gimp_image_pick_correlate_layer (GimpImage *gimage,
return NULL;
}
Layer *
gimp_image_raise_layer (GimpImage *gimage,
Layer *layer_arg)
@ -2763,7 +2811,7 @@ gimp_image_merge_layers (GimpImage *gimage,
}
merge_layer = layer_new (gimage, (x2 - x1), (y2 - y1),
type, drawable_get_name (GIMP_DRAWABLE(layer)),
type, drawable_get_name (GIMP_DRAWABLE (layer)),
OPAQUE_OPACITY, NORMAL_MODE);
if (!merge_layer)
{
@ -3009,12 +3057,18 @@ gimp_image_add_layer (GimpImage *gimage,
position = 1;
gimage->layers =
g_slist_insert (gimage->layers, layer_ref (float_layer), position);
g_slist_insert (gimage->layers, float_layer, position);
gtk_object_ref (GTK_OBJECT (float_layer));
gtk_object_sink (GTK_OBJECT (float_layer));
}
else
{
gimage->layers =
g_slist_prepend (gimage->layers, layer_ref (float_layer));
g_slist_prepend (gimage->layers, float_layer);
gtk_object_ref (GTK_OBJECT (float_layer));
gtk_object_sink (GTK_OBJECT (float_layer));
}
gimage->layer_stack = g_slist_prepend (gimage->layer_stack, float_layer);
@ -3374,7 +3428,10 @@ gimp_image_add_channel (GimpImage *gimage,
undo_push_channel (gimage, CHANNEL_ADD_UNDO, cu);
/* add the channel to the list */
gimage->channels = g_slist_prepend (gimage->channels, channel_ref (channel));
gimage->channels = g_slist_prepend (gimage->channels, channel);
gtk_object_ref (GTK_OBJECT (channel));
gtk_object_sink (GTK_OBJECT (channel));
/* notify this gimage of the currently active channel */
gimp_image_set_active_channel (gimage, channel);
@ -3419,9 +3476,9 @@ gimp_image_remove_channel (GimpImage *gimage,
0, 0,
drawable_width (GIMP_DRAWABLE(channel)),
drawable_height (GIMP_DRAWABLE(channel)));
/* Send out REMOVED signal from channel */
channel_removed (channel, gimage);
channel_removed (channel);
/* Important to push the undo here in case the push fails */
undo_push_channel (gimage, CHANNEL_REMOVE_UNDO, cu);
@ -3434,48 +3491,55 @@ gimp_image_remove_channel (GimpImage *gimage,
/************************************************************/
gboolean
gimp_image_is_empty (GimpImage *gimage)
gimp_image_is_empty (const GimpImage *gimage)
{
g_return_val_if_fail (gimage != NULL, TRUE);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), TRUE);
return (! gimage->layers);
return ! gimage->layers;
}
GimpDrawable *
gimp_image_active_drawable (GimpImage *gimage)
gimp_image_active_drawable (const GimpImage *gimage)
{
Layer *layer;
g_return_val_if_fail (gimage != NULL, NULL);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
/* If there is an active channel (a saved selection, etc.),
* we ignore the active layer
*/
if (gimage->active_channel != NULL)
return GIMP_DRAWABLE (gimage->active_channel);
{
return GIMP_DRAWABLE (gimage->active_channel);
}
else if (gimage->active_layer != NULL)
{
layer = gimage->active_layer;
if (layer->mask && layer->edit_mask)
return GIMP_DRAWABLE(layer->mask);
return GIMP_DRAWABLE (layer->mask);
else
return GIMP_DRAWABLE(layer);
return GIMP_DRAWABLE (layer);
}
else
return NULL;
return NULL;
}
GimpImageBaseType
gimp_image_base_type (GimpImage *gimage)
{
gimp_image_base_type (const GimpImage *gimage)
{
g_return_val_if_fail (gimage != NULL, -1);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), -1);
return gimage->base_type;
}
GimpImageType
gimp_image_base_type_with_alpha (GimpImage *gimage)
gimp_image_base_type_with_alpha (const GimpImage *gimage)
{
g_return_val_if_fail (gimage != NULL, -1);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), -1);
switch (gimage->base_type)
@ -3490,9 +3554,10 @@ gimp_image_base_type_with_alpha (GimpImage *gimage)
return RGB_GIMAGE;
}
gchar *
gimp_image_filename (GimpImage *gimage)
const gchar *
gimp_image_filename (const GimpImage *gimage)
{
g_return_val_if_fail (gimage != NULL, NULL);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
if (gimage->has_filename)
@ -3502,7 +3567,7 @@ gimp_image_filename (GimpImage *gimage)
}
gboolean
gimp_image_undo_is_enabled (GimpImage *gimage)
gimp_image_undo_is_enabled (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
@ -3550,7 +3615,7 @@ gimp_image_undo_enable (GimpImage *gimage)
void
gimp_image_undo_event (GimpImage *gimage,
int event)
gint event)
{
gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[UNDO_EVENT], event);
}
@ -3592,10 +3657,10 @@ gimp_image_dirty (GimpImage *gimage)
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
gimage->dirty++;
gtk_signal_emit(GTK_OBJECT(gimage), gimp_image_signals[DIRTY]);
gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[DIRTY]);
TRC (("dirty %d -> %d\n", gimage->dirty-1, gimage->dirty));
return gimage->dirty;
}
@ -3605,7 +3670,7 @@ gimp_image_clean (GimpImage *gimage)
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
gimage->dirty--;
gtk_signal_emit(GTK_OBJECT(gimage), gimp_image_signals[CLEAN]);
gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[CLEAN]);
TRC (("clean %d -> %d\n", gimage->dirty+1, gimage->dirty));
@ -3619,11 +3684,11 @@ gimp_image_clean_all (GimpImage *gimage)
gimage->dirty = 0;
gtk_signal_emit (GTK_OBJECT(gimage), gimp_image_signals[CLEAN]);
gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[CLEAN]);
}
Layer *
gimp_image_floating_sel (GimpImage *gimage)
gimp_image_floating_sel (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
@ -3634,7 +3699,7 @@ gimp_image_floating_sel (GimpImage *gimage)
}
guchar *
gimp_image_cmap (GimpImage *gimage)
gimp_image_cmap (const GimpImage *gimage)
{
return drawable_cmap (gimp_image_active_drawable (gimage));
}
@ -3651,13 +3716,15 @@ gimp_image_projection (GimpImage *gimage)
if ((gimage->projection == NULL) ||
(tile_manager_level_width (gimage->projection) != gimage->width) ||
(tile_manager_level_height (gimage->projection) != gimage->height))
gimp_image_allocate_projection (gimage);
{
gimp_image_allocate_projection (gimage);
}
return gimage->projection;
}
GimpImageType
gimp_image_projection_type (GimpImage *gimage)
gimp_image_projection_type (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), -1);
@ -3665,7 +3732,7 @@ gimp_image_projection_type (GimpImage *gimage)
}
gint
gimp_image_projection_bytes (GimpImage *gimage)
gimp_image_projection_bytes (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), -1);
@ -3673,7 +3740,7 @@ gimp_image_projection_bytes (GimpImage *gimage)
}
gint
gimp_image_projection_opacity (GimpImage *gimage)
gimp_image_projection_opacity (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), -1);
@ -3697,13 +3764,13 @@ gimp_image_composite (GimpImage *gimage)
}
GimpImageType
gimp_image_composite_type (GimpImage *gimage)
gimp_image_composite_type (const GimpImage *gimage)
{
return gimp_image_projection_type (gimage);
}
gint
gimp_image_composite_bytes (GimpImage *gimage)
gimp_image_composite_bytes (const GimpImage *gimage)
{
return gimp_image_projection_bytes (gimage);
}
@ -3913,8 +3980,8 @@ gimp_image_composite_preview (GimpImage *gimage,
}
gboolean
gimp_image_preview_valid (GimpImage *gimage,
ChannelType type)
gimp_image_preview_valid (const GimpImage *gimage,
ChannelType type)
{
switch (type)
{

View File

@ -88,10 +88,10 @@ typedef enum
struct _Guide
{
int ref_count;
int position;
int orientation;
guint32 guide_ID;
gint ref_count;
gint position;
InternalOrientationType orientation;
guint32 guide_ID;
};
@ -105,76 +105,103 @@ typedef struct _GimpImageRepaintArg
} GimpImageRepaintArg;
GtkType gimp_image_get_type (void);
/* function declarations */
GimpImage * gimp_image_new (gint, gint,
GimpImageBaseType);
void gimp_image_set_filename (GimpImage *, gchar *);
void gimp_image_set_resolution (GimpImage *,
gdouble, gdouble);
void gimp_image_get_resolution (GimpImage *,
gdouble *, gdouble *);
void gimp_image_set_unit (GimpImage *, GimpUnit);
GimpUnit gimp_image_get_unit (GimpImage *);
void gimp_image_set_save_proc (GimpImage *,
PlugInProcDef *);
PlugInProcDef * gimp_image_get_save_proc (GimpImage *);
gint gimp_image_get_width (const GimpImage *);
gint gimp_image_get_height (const GimpImage *);
void gimp_image_resize (GimpImage *,
gint, gint, gint, gint);
void gimp_image_scale (GimpImage *, gint, gint);
GimpImage * gimp_image_get_named (gchar *);
GimpImage * gimp_image_get_ID (gint);
TileManager * gimp_image_shadow (GimpImage *,
gint, gint, gint);
void gimp_image_free_shadow (GimpImage *);
void gimp_image_apply_image (GimpImage *, GimpDrawable *,
PixelRegion *, gint,
gint,
LayerModeEffects,
TileManager *, gint, gint);
void gimp_image_replace_image (GimpImage *, GimpDrawable *,
PixelRegion *, gint, gint,
PixelRegion *, gint, gint);
void gimp_image_get_foreground (GimpImage *, GimpDrawable *,
guchar *);
void gimp_image_get_background (GimpImage *, GimpDrawable *,
guchar *);
guchar * gimp_image_get_color_at (GimpImage *, gint, gint);
void gimp_image_get_color (GimpImage *,
GimpImageType,
guchar *,
guchar *);
void gimp_image_transform_color (GimpImage *,
GimpDrawable *,
guchar *,
guchar *,
GimpImageBaseType);
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 *);
GtkType gimp_image_get_type (void);
GimpParasite * gimp_image_parasite_find (const GimpImage *,
const gchar *name);
gchar ** gimp_image_parasite_list (GimpImage *gimage,
gint *count);
void gimp_image_parasite_attach (GimpImage *,
GimpParasite *);
void gimp_image_parasite_detach (GimpImage *, const gchar *);
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);
Tattoo gimp_image_get_new_tattoo (GimpImage *);
gboolean gimp_image_set_tattoo_state (GimpImage *, Tattoo);
Tattoo gimp_image_get_tattoo_state (GimpImage *);
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);
void gimp_image_set_paths (GimpImage *, PathList *);
PathList * gimp_image_get_paths (GimpImage *);
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);
/* Temporary hack till colormap manipulation is encapsulated in functions.
Call this whenever you modify an image's colormap. The ncol argument
@ -182,115 +209,169 @@ PathList * gimp_image_get_paths (GimpImage *);
Currently, use this also when the image's base type is changed to/from
indexed. */
void gimp_image_colormap_changed (GimpImage * image,
gint ncol);
void gimp_image_colormap_changed (const GimpImage *image,
gint col);
/* layer/channel functions */
gint gimp_image_get_layer_index (GimpImage *, Layer *);
Layer * gimp_image_get_layer_by_index (GimpImage *, gint);
gint gimp_image_get_channel_index (GimpImage *, Channel *);
Layer * gimp_image_get_active_layer (GimpImage *);
Channel * gimp_image_get_active_channel (GimpImage *);
Layer * gimp_image_get_layer_by_tattoo (GimpImage *, Tattoo);
Channel * gimp_image_get_channel_by_tattoo (GimpImage *, Tattoo);
Channel * gimp_image_get_channel_by_name (GimpImage *, gchar *);
Channel * gimp_image_get_mask (GimpImage *);
gint gimp_image_get_component_active (GimpImage *, ChannelType);
gint gimp_image_get_component_visible (GimpImage *, ChannelType);
gboolean gimp_image_layer_boundary (GimpImage *, BoundSeg **,
gint *);
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,
gint);
void gimp_image_set_component_visible (GimpImage *, ChannelType,
gint);
Layer * gimp_image_pick_correlate_layer (GimpImage *, gint, gint);
void gimp_image_set_layer_mask_apply (GimpImage *, gint);
void gimp_image_set_layer_mask_edit (GimpImage *, Layer *, gint);
void gimp_image_set_layer_mask_show (GimpImage *, gint);
Layer * gimp_image_raise_layer (GimpImage *, Layer *);
Layer * gimp_image_lower_layer (GimpImage *, Layer *);
Layer * gimp_image_raise_layer_to_top (GimpImage *, Layer *);
Layer * gimp_image_lower_layer_to_bottom (GimpImage *, Layer *);
Layer * gimp_image_position_layer (GimpImage *, Layer *,
gint, gboolean);
Layer * gimp_image_merge_visible_layers (GimpImage *, MergeType);
Layer * gimp_image_merge_down (GimpImage *, Layer *,
MergeType);
Layer * gimp_image_flatten (GimpImage *);
Layer * gimp_image_merge_layers (GimpImage *, GSList *,
MergeType);
Layer * gimp_image_add_layer (GimpImage *, Layer *, gint);
Layer * gimp_image_remove_layer (GimpImage *, Layer *);
LayerMask * gimp_image_add_layer_mask (GimpImage *, Layer *,
LayerMask *);
Channel * gimp_image_remove_layer_mask (GimpImage *, Layer *,
MaskApplyMode);
Channel * gimp_image_raise_channel (GimpImage *, Channel *);
Channel * gimp_image_lower_channel (GimpImage *, Channel *);
Channel * gimp_image_position_channel (GimpImage *, Channel *, gint);
Channel * gimp_image_add_channel (GimpImage *, Channel *, gint);
Channel * gimp_image_remove_channel (GimpImage *, Channel *);
void gimp_image_construct (GimpImage *,
gint, gint, gint, gint,
gboolean);
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 *, gint, gint,
gint, gint, gint,
gint, gint, gint);
void gimp_image_invalidate (GimpImage *, gint, gint,
gint, gint, gint,
gint, gint, gint);
void gimp_image_validate (TileManager *, Tile *);
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);
/* Access functions */
gboolean gimp_image_is_empty (GimpImage *);
GimpDrawable * gimp_image_active_drawable (GimpImage *);
gboolean gimp_image_is_empty (const GimpImage *gimage);
GimpDrawable * gimp_image_active_drawable (const GimpImage *gimage);
GimpImageBaseType gimp_image_base_type (GimpImage *gimage);
GimpImageType gimp_image_base_type_with_alpha (GimpImage *gimage);
GimpImageBaseType gimp_image_base_type (const GimpImage *gimage);
GimpImageType gimp_image_base_type_with_alpha (const GimpImage *gimage);
gchar * gimp_image_filename (GimpImage *);
gboolean gimp_image_undo_is_enabled (GimpImage *);
gboolean gimp_image_undo_enable (GimpImage *);
gboolean gimp_image_undo_disable (GimpImage *);
gboolean gimp_image_undo_freeze (GimpImage *);
gboolean gimp_image_undo_thaw (GimpImage *);
void gimp_image_undo_event (GimpImage *, gint);
gint gimp_image_dirty (GimpImage *);
gint gimp_image_clean (GimpImage *);
void gimp_image_clean_all (GimpImage *);
Layer * gimp_image_floating_sel (GimpImage *);
guchar * gimp_image_cmap (GimpImage *);
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);
/* projection access functions */
TileManager * gimp_image_projection (GimpImage *);
GimpImageType gimp_image_projection_type (GimpImage *);
gint gimp_image_projection_bytes (GimpImage *);
gint gimp_image_projection_opacity (GimpImage *);
void gimp_image_projection_realloc (GimpImage *);
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);
/* composite access functions */
TileManager * gimp_image_composite (GimpImage *);
GimpImageType gimp_image_composite_type (GimpImage *);
gint gimp_image_composite_bytes (GimpImage *);
TempBuf * gimp_image_composite_preview (GimpImage *, ChannelType,
gint, gint);
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);
gint gimp_image_preview_valid (GimpImage *, ChannelType);
void gimp_image_invalidate_preview (GimpImage *);
gint gimp_image_preview_valid (const GimpImage *gimage,
ChannelType type);
void gimp_image_invalidate_preview (GimpImage *gimage);
void gimp_image_invalidate_previews (void);
void gimp_image_invalidate_previews (void);
TempBuf * gimp_image_construct_composite_preview (GimpImage *,
gint , gint);
TempBuf * gimp_image_construct_composite_preview (GimpImage *gimage,
gint width,
gint height);
#endif /* __GIMPIMAGE_H__ */

View File

@ -228,7 +228,7 @@ qmask_activate (GtkWidget *widget,
gmask = channel_copy (gimage_get_mask (gimg));
gimp_image_add_channel (gimg, gmask, 0);
channel_set_color (gmask, color);
channel_set_name (gmask, "Qmask");
drawable_set_name (GIMP_DRAWABLE (gmask), "Qmask");
channel_set_opacity (gmask, opacity);
gimage_mask_none (gimg); /* Clear the selection */
}

View File

@ -228,7 +228,7 @@ qmask_activate (GtkWidget *widget,
gmask = channel_copy (gimage_get_mask (gimg));
gimp_image_add_channel (gimg, gmask, 0);
channel_set_color (gmask, color);
channel_set_name (gmask, "Qmask");
drawable_set_name (GIMP_DRAWABLE (gmask), "Qmask");
channel_set_opacity (gmask, opacity);
gimage_mask_none (gimg); /* Clear the selection */
}

View File

@ -59,28 +59,58 @@
/* Local function declarations */
static void gimp_image_destroy (GtkObject *object);
static void gimp_image_free_projection (GimpImage *);
static void gimp_image_allocate_shadow (GimpImage *, gint, gint, gint);
static void gimp_image_allocate_projection (GimpImage *);
static void gimp_image_free_layers (GimpImage *);
static void gimp_image_free_channels (GimpImage *);
static void gimp_image_construct_layers (GimpImage *, gint, gint, gint, gint);
static void gimp_image_construct_channels (GimpImage *, gint, gint, gint, gint);
static void gimp_image_initialize_projection (GimpImage *, gint, gint, gint, gint);
static void gimp_image_get_active_channels (GimpImage *, GimpDrawable *, gint *);
static void gimp_image_destroy (GtkObject *object);
static void gimp_image_free_projection (GimpImage *gimage);
static void gimp_image_allocate_shadow (GimpImage *gimage,
gint width,
gint height,
gint bpp);
static void gimp_image_allocate_projection (GimpImage *gimage);
static void gimp_image_free_layers (GimpImage *gimage);
static void gimp_image_free_channels (GimpImage *gimage);
static void gimp_image_construct_layers (GimpImage *gimage,
gint x,
gint y,
gint w,
gint h);
static void gimp_image_construct_channels (GimpImage *gimage,
gint x,
gint y,
gint w,
gint h);
static void gimp_image_initialize_projection (GimpImage *gimage,
gint x,
gint y,
gint w,
gint h);
static void gimp_image_get_active_channels (GimpImage *gimage,
GimpDrawable *drawable,
gint *active);
/* projection functions */
static void project_intensity (GimpImage *, Layer *,
PixelRegion *, PixelRegion *,
PixelRegion *);
static void project_intensity_alpha (GimpImage *, Layer *,
PixelRegion *, PixelRegion *,
PixelRegion *);
static void project_indexed (GimpImage *, Layer *,
PixelRegion *, PixelRegion *);
static void project_channel (GimpImage *, Channel *,
PixelRegion *, PixelRegion *);
static void project_intensity (GimpImage *gimage,
Layer *layer,
PixelRegion *src,
PixelRegion *dest,
PixelRegion *mask);
static void project_intensity_alpha (GimpImage *gimage,
Layer *layer,
PixelRegion *src,
PixelRegion *dest,
PixelRegion *mask);
static void project_indexed (GimpImage *gimage,
Layer *layer,
PixelRegion *src,
PixelRegion *dest);
static void project_indexed_alpha (GimpImage *gimage,
Layer *layer,
PixelRegion *src,
PixelRegion *dest,
PixelRegion *mask);
static void project_channel (GimpImage *gimage,
Channel *layer,
PixelRegion *src,
PixelRegion *src2);
/*
* Global variables
@ -108,7 +138,8 @@ guint32 next_guide_id = 1; /* For generating guide_ID handles for PDB stuff */
* Static variables
*/
enum {
enum
{
CLEAN,
DIRTY,
REPAINT,
@ -120,8 +151,9 @@ enum {
LAST_SIGNAL
};
static guint gimp_image_signals[LAST_SIGNAL];
static GimpObjectClass *parent_class;
static guint gimp_image_signals[LAST_SIGNAL] = { 0 };
static GimpObjectClass *parent_class = NULL;
static void
@ -129,13 +161,11 @@ gimp_image_class_init (GimpImageClass *klass)
{
GtkObjectClass *object_class;
GtkType type;
object_class = GTK_OBJECT_CLASS(klass);
parent_class = gtk_type_class (gimp_object_get_type ());
type=object_class->type;
object_class->destroy = gimp_image_destroy;
object_class = GTK_OBJECT_CLASS (klass);
parent_class = gtk_type_class (gimp_object_get_type ());
type = object_class->type;
gimp_image_signals[CLEAN] =
gimp_signal_new ("clean", GTK_RUN_FIRST, type, 0,
@ -163,6 +193,17 @@ gimp_image_class_init (GimpImageClass *klass)
gimp_sigtype_int);
gtk_object_class_add_signals (object_class, gimp_image_signals, LAST_SIGNAL);
object_class->destroy = gimp_image_destroy;
klass->clean = NULL;
klass->dirty = NULL;
klass->repaint = NULL;
klass->rename = NULL;
klass->resize = NULL;
klass->restructure = NULL;
klass->colormap_changed = NULL;
klass->undo_event = NULL;
}
@ -384,9 +425,9 @@ gimp_image_set_resolution (GimpImage *gimage,
}
void
gimp_image_get_resolution (GimpImage *gimage,
gdouble *xresolution,
gdouble *yresolution)
gimp_image_get_resolution (const GimpImage *gimage,
gdouble *xresolution,
gdouble *yresolution)
{
g_return_if_fail (xresolution && yresolution);
@ -404,7 +445,7 @@ gimp_image_set_unit (GimpImage *gimage,
}
GimpUnit
gimp_image_get_unit (GimpImage *gimage)
gimp_image_get_unit (const GimpImage *gimage)
{
return gimage->unit;
}
@ -417,11 +458,23 @@ gimp_image_set_save_proc (GimpImage *gimage,
}
PlugInProcDef *
gimp_image_get_save_proc (GimpImage *gimage)
gimp_image_get_save_proc (const GimpImage *gimage)
{
return gimage->save_proc;
}
gint
gimp_image_get_width (const GimpImage *gimage)
{
return gimage->width;
}
gint
gimp_image_get_height (const GimpImage *gimage)
{
return gimage->height;
}
void
gimp_image_resize (GimpImage *gimage,
gint new_width,
@ -518,18 +571,6 @@ gimp_image_resize (GimpImage *gimage,
gimp_remove_busy_cursors (NULL);
}
gint
gimp_image_get_width (const GimpImage *gimage)
{
return gimage->width;
}
gint
gimp_image_get_height (const GimpImage *gimage)
{
return gimage->height;
}
void
gimp_image_scale (GimpImage *gimage,
gint new_width,
@ -696,7 +737,8 @@ gimp_image_destroy (GtkObject *object)
gimp_image_free_layers (gimage);
gimp_image_free_channels (gimage);
channel_delete (gimage->selection_mask);
gtk_object_unref (GTK_OBJECT (gimage->selection_mask));
if (gimage->comp_preview)
temp_buf_free (gimage->comp_preview);
@ -941,9 +983,9 @@ gimp_image_replace_image (GimpImage *gimage,
/* Get rid of these! A "foreground" is an UI concept.. */
void
gimp_image_get_foreground (GimpImage *gimage,
GimpDrawable *drawable,
guchar *fg)
gimp_image_get_foreground (const GimpImage *gimage,
const GimpDrawable *drawable,
guchar *fg)
{
guchar pfg[3];
@ -954,9 +996,9 @@ gimp_image_get_foreground (GimpImage *gimage,
}
void
gimp_image_get_background (GimpImage *gimage,
GimpDrawable *drawable,
guchar *bg)
gimp_image_get_background (const GimpImage *gimage,
const GimpDrawable *drawable,
guchar *bg)
{
guchar pbg[3];
@ -980,7 +1022,7 @@ gimp_image_get_color_at (GimpImage *gimage,
if (x < 0 || y < 0 || x >= gimage->width || y >= gimage->height)
return NULL;
dest = g_new (unsigned char, 5);
dest = g_new (guchar, 5);
tile = tile_manager_get_tile (gimp_image_composite (gimage), x, y,
TRUE, FALSE);
src = tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT);
@ -998,10 +1040,10 @@ gimp_image_get_color_at (GimpImage *gimage,
}
void
gimp_image_get_color (GimpImage *gimage,
GimpImageType d_type,
guchar *rgb,
guchar *src)
gimp_image_get_color (const GimpImage *gimage,
GimpImageType d_type,
guchar *rgb,
guchar *src)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
@ -1020,17 +1062,17 @@ gimp_image_get_color (GimpImage *gimage,
}
void
gimp_image_transform_color (GimpImage *gimage,
GimpDrawable *drawable,
guchar *src,
guchar *dest,
GimpImageBaseType type)
gimp_image_transform_color (const GimpImage *gimage,
const GimpDrawable *drawable,
guchar *src,
guchar *dest,
GimpImageBaseType type)
{
GimpImageType d_type;
g_return_if_fail (GIMP_IS_IMAGE (gimage));
d_type = (drawable != NULL) ? drawable_type (drawable) :
d_type = (drawable != NULL) ? gimp_drawable_type (drawable) :
gimp_image_base_type_with_alpha (gimage);
switch (type)
@ -1090,7 +1132,7 @@ gimp_image_transform_color (GimpImage *gimage,
}
}
Guide*
Guide *
gimp_image_add_hguide (GimpImage *gimage)
{
Guide *guide;
@ -1108,7 +1150,7 @@ gimp_image_add_hguide (GimpImage *gimage)
return guide;
}
Guide*
Guide *
gimp_image_add_vguide (GimpImage *gimage)
{
Guide *guide;
@ -1178,8 +1220,8 @@ list_func (gchar *key,
}
gchar **
gimp_image_parasite_list (GimpImage *gimage,
gint *count)
gimp_image_parasite_list (const GimpImage *gimage,
gint *count)
{
gchar **list;
gchar **cur;
@ -1242,9 +1284,11 @@ Tattoo
gimp_image_get_new_tattoo (GimpImage *image)
{
image->tattoo_state++;
if (image->tattoo_state <= 0)
g_warning ("Tattoo state has become corrupt (2.1 billion operation limit exceded)");
return (image->tattoo_state);
return image->tattoo_state;
}
Tattoo
@ -1334,18 +1378,6 @@ gimp_image_set_tattoo_state (GimpImage *gimage,
return retval;
}
void
gimp_image_colormap_changed (GimpImage *gimage,
gint col)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (col < gimage->num_cols);
gtk_signal_emit (GTK_OBJECT (gimage),
gimp_image_signals[COLORMAP_CHANGED],
col);
}
void
gimp_image_set_paths (GimpImage *gimage,
PathList *paths)
@ -1356,13 +1388,25 @@ gimp_image_set_paths (GimpImage *gimage,
}
PathList *
gimp_image_get_paths (GimpImage *gimage)
gimp_image_get_paths (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
return gimage->paths;
}
void
gimp_image_colormap_changed (const GimpImage *gimage,
gint col)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (col < gimage->num_cols);
gtk_signal_emit (GTK_OBJECT (gimage),
gimp_image_signals[COLORMAP_CHANGED],
col);
}
/************************************************************/
/* Projection functions */
/************************************************************/
@ -1478,8 +1522,10 @@ gimp_image_free_channels (GimpImage *gimage)
for (list = gimage->channels; list; list = g_slist_next (list))
{
channel = (Channel *) list->data;
channel_delete (channel);
gtk_object_unref (GTK_OBJECT (channel));
}
g_slist_free (gimage->channels);
}
@ -1748,8 +1794,7 @@ gimp_image_construct (GimpImage *gimage,
gint x,
gint y,
gint w,
gint h,
gboolean can_use_cowproject)
gint h)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
@ -1950,8 +1995,7 @@ gimp_image_invalidate (GimpImage *gimage,
if ((endx - startx) > 0 && (endy - starty) > 0)
gimp_image_construct (gimage,
startx, starty,
(endx - startx), (endy - starty),
TRUE);
(endx - startx), (endy - starty));
}
void
@ -1972,12 +2016,12 @@ gimp_image_validate (TileManager *tm,
w = tile_ewidth (tile);
h = tile_eheight (tile);
gimp_image_construct (gimage, x, y, w, h, FALSE);
gimp_image_construct (gimage, x, y, w, h);
}
gint
gimp_image_get_layer_index (GimpImage *gimage,
Layer *layer_arg)
gimp_image_get_layer_index (const GimpImage *gimage,
const Layer *layer_arg)
{
Layer *layer;
GSList *layers;
@ -1990,6 +2034,7 @@ gimp_image_get_layer_index (GimpImage *gimage,
layers = g_slist_next (layers), index++)
{
layer = (Layer *) layers->data;
if (layer == layer_arg)
return index;
}
@ -1998,23 +2043,22 @@ gimp_image_get_layer_index (GimpImage *gimage,
}
Layer *
gimp_image_get_layer_by_index (GimpImage *gimage,
gint layer_index)
gimp_image_get_layer_by_index (const GimpImage *gimage,
gint layer_index)
{
Layer *layer;
g_return_val_if_fail (gimage != NULL, NULL);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
layer =
(Layer *) g_slist_nth_data (gimage->layers, layer_index);
layer = (Layer *) g_slist_nth_data (gimage->layers, layer_index);
return layer;
}
gint
gimp_image_get_channel_index (GimpImage *gimage,
Channel *channel_ID)
gimp_image_get_channel_index (const GimpImage *gimage,
const Channel *channel_arg)
{
Channel *channel;
GSList *channels;
@ -2028,7 +2072,8 @@ gimp_image_get_channel_index (GimpImage *gimage,
channels = g_slist_next (channels), index++)
{
channel = (Channel *) channels->data;
if (channel == channel_ID)
if (channel == channel_arg)
return index;
}
@ -2036,7 +2081,7 @@ gimp_image_get_channel_index (GimpImage *gimage,
}
Layer *
gimp_image_get_active_layer (GimpImage *gimage)
gimp_image_get_active_layer (const GimpImage *gimage)
{
g_return_val_if_fail (gimage != NULL, NULL);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
@ -2045,7 +2090,7 @@ gimp_image_get_active_layer (GimpImage *gimage)
}
Channel *
gimp_image_get_active_channel (GimpImage *gimage)
gimp_image_get_active_channel (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
@ -2053,8 +2098,8 @@ gimp_image_get_active_channel (GimpImage *gimage)
}
Layer *
gimp_image_get_layer_by_tattoo (GimpImage *gimage,
Tattoo tattoo)
gimp_image_get_layer_by_tattoo (const GimpImage *gimage,
Tattoo tattoo)
{
Layer *layer;
GSList *layers;
@ -2066,6 +2111,7 @@ gimp_image_get_layer_by_tattoo (GimpImage *gimage,
layers = g_slist_next (layers))
{
layer = (Layer *) layers->data;
if (layer_get_tattoo (layer) == tattoo)
return layer;
}
@ -2074,8 +2120,8 @@ gimp_image_get_layer_by_tattoo (GimpImage *gimage,
}
Channel *
gimp_image_get_channel_by_tattoo (GimpImage *gimage,
Tattoo tattoo)
gimp_image_get_channel_by_tattoo (const GimpImage *gimage,
Tattoo tattoo)
{
Channel *channel;
GSList *channels;
@ -2087,6 +2133,7 @@ gimp_image_get_channel_by_tattoo (GimpImage *gimage,
channels = g_slist_next (channels))
{
channel = (Channel *) channels->data;
if (channel_get_tattoo (channel) == tattoo)
return channel;
}
@ -2095,8 +2142,8 @@ gimp_image_get_channel_by_tattoo (GimpImage *gimage,
}
Channel *
gimp_image_get_channel_by_name (GimpImage *gimage,
char *name)
gimp_image_get_channel_by_name (const GimpImage *gimage,
const gchar *name)
{
Channel *channel;
GSList *channels;
@ -2108,16 +2155,24 @@ gimp_image_get_channel_by_name (GimpImage *gimage,
channels = g_slist_next (channels))
{
channel = (Channel *) channels->data;
if (! strcmp(channel_get_name (channel),name) )
if (! strcmp (drawable_get_name (GIMP_DRAWABLE (channel)), name))
return channel;
}
return NULL;
}
gint
gimp_image_get_component_active (GimpImage *gimage,
ChannelType type)
Channel *
gimp_image_get_mask (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
return gimage->selection_mask;
}
gboolean
gimp_image_get_component_active (const GimpImage *gimage,
ChannelType type)
{
/* No sanity checking here... */
switch (type)
@ -2131,9 +2186,9 @@ gimp_image_get_component_active (GimpImage *gimage,
}
}
gint
gimp_image_get_component_visible (GimpImage *gimage,
ChannelType type)
gboolean
gimp_image_get_component_visible (const GimpImage *gimage,
ChannelType type)
{
/* No sanity checking here... */
switch (type)
@ -2147,35 +2202,29 @@ gimp_image_get_component_visible (GimpImage *gimage,
}
}
Channel *
gimp_image_get_mask (GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
return gimage->selection_mask;
}
gboolean
gimp_image_layer_boundary (GimpImage *gimage,
BoundSeg **segs,
int *num_segs)
gimp_image_layer_boundary (const GimpImage *gimage,
BoundSeg **segs,
gint *n_segs)
{
Layer *layer;
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
g_return_val_if_fail (segs != NULL, FALSE);
g_return_val_if_fail (n_segs != NULL, FALSE);
/* The second boundary corresponds to the active layer's
* perimeter...
*/
if ((layer = gimage->active_layer))
{
*segs = layer_boundary (layer, num_segs);
*segs = layer_boundary (layer, n_segs);
return TRUE;
}
else
{
*segs = NULL;
*num_segs = 0;
*n_segs = 0;
return FALSE;
}
}
@ -2185,6 +2234,7 @@ gimp_image_set_active_layer (GimpImage *gimage,
Layer *layer)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
g_return_val_if_fail (GIMP_IS_LAYER (layer), NULL);
/* First, find the layer in the gimage
* If it isn't valid, find the first layer that is
@ -2264,16 +2314,16 @@ gimp_image_unset_active_channel (GimpImage *gimage)
void
gimp_image_set_component_active (GimpImage *gimage,
ChannelType type,
gint value)
gboolean active)
{
/* No sanity checking here... */
switch (type)
{
case RED_CHANNEL: gimage->active[RED_PIX] = value; break;
case GREEN_CHANNEL: gimage->active[GREEN_PIX] = value; break;
case BLUE_CHANNEL: gimage->active[BLUE_PIX] = value; break;
case GRAY_CHANNEL: gimage->active[GRAY_PIX] = value; break;
case INDEXED_CHANNEL: gimage->active[INDEXED_PIX] = value; break;
case RED_CHANNEL: gimage->active[RED_PIX] = active; break;
case GREEN_CHANNEL: gimage->active[GREEN_PIX] = active; break;
case BLUE_CHANNEL: gimage->active[BLUE_PIX] = active; break;
case GRAY_CHANNEL: gimage->active[GRAY_PIX] = active; break;
case INDEXED_CHANNEL: gimage->active[INDEXED_PIX] = active; break;
case AUXILLARY_CHANNEL: break;
}
@ -2287,24 +2337,24 @@ gimp_image_set_component_active (GimpImage *gimage,
void
gimp_image_set_component_visible (GimpImage *gimage,
ChannelType type,
gint value)
gboolean visible)
{
/* No sanity checking here... */
switch (type)
{
case RED_CHANNEL: gimage->visible[RED_PIX] = value; break;
case GREEN_CHANNEL: gimage->visible[GREEN_PIX] = value; break;
case BLUE_CHANNEL: gimage->visible[BLUE_PIX] = value; break;
case GRAY_CHANNEL: gimage->visible[GRAY_PIX] = value; break;
case INDEXED_CHANNEL: gimage->visible[INDEXED_PIX] = value; break;
case RED_CHANNEL: gimage->visible[RED_PIX] = visible; break;
case GREEN_CHANNEL: gimage->visible[GREEN_PIX] = visible; break;
case BLUE_CHANNEL: gimage->visible[BLUE_PIX] = visible; break;
case GRAY_CHANNEL: gimage->visible[GRAY_PIX] = visible; break;
case INDEXED_CHANNEL: gimage->visible[INDEXED_PIX] = visible; break;
default: break;
}
}
Layer *
gimp_image_pick_correlate_layer (GimpImage *gimage,
gint x,
gint y)
gimp_image_pick_correlate_layer (const GimpImage *gimage,
gint x,
gint y)
{
Layer *layer;
GSList *list;
@ -2322,8 +2372,6 @@ gimp_image_pick_correlate_layer (GimpImage *gimage,
return NULL;
}
Layer *
gimp_image_raise_layer (GimpImage *gimage,
Layer *layer_arg)
@ -2763,7 +2811,7 @@ gimp_image_merge_layers (GimpImage *gimage,
}
merge_layer = layer_new (gimage, (x2 - x1), (y2 - y1),
type, drawable_get_name (GIMP_DRAWABLE(layer)),
type, drawable_get_name (GIMP_DRAWABLE (layer)),
OPAQUE_OPACITY, NORMAL_MODE);
if (!merge_layer)
{
@ -3009,12 +3057,18 @@ gimp_image_add_layer (GimpImage *gimage,
position = 1;
gimage->layers =
g_slist_insert (gimage->layers, layer_ref (float_layer), position);
g_slist_insert (gimage->layers, float_layer, position);
gtk_object_ref (GTK_OBJECT (float_layer));
gtk_object_sink (GTK_OBJECT (float_layer));
}
else
{
gimage->layers =
g_slist_prepend (gimage->layers, layer_ref (float_layer));
g_slist_prepend (gimage->layers, float_layer);
gtk_object_ref (GTK_OBJECT (float_layer));
gtk_object_sink (GTK_OBJECT (float_layer));
}
gimage->layer_stack = g_slist_prepend (gimage->layer_stack, float_layer);
@ -3374,7 +3428,10 @@ gimp_image_add_channel (GimpImage *gimage,
undo_push_channel (gimage, CHANNEL_ADD_UNDO, cu);
/* add the channel to the list */
gimage->channels = g_slist_prepend (gimage->channels, channel_ref (channel));
gimage->channels = g_slist_prepend (gimage->channels, channel);
gtk_object_ref (GTK_OBJECT (channel));
gtk_object_sink (GTK_OBJECT (channel));
/* notify this gimage of the currently active channel */
gimp_image_set_active_channel (gimage, channel);
@ -3419,9 +3476,9 @@ gimp_image_remove_channel (GimpImage *gimage,
0, 0,
drawable_width (GIMP_DRAWABLE(channel)),
drawable_height (GIMP_DRAWABLE(channel)));
/* Send out REMOVED signal from channel */
channel_removed (channel, gimage);
channel_removed (channel);
/* Important to push the undo here in case the push fails */
undo_push_channel (gimage, CHANNEL_REMOVE_UNDO, cu);
@ -3434,48 +3491,55 @@ gimp_image_remove_channel (GimpImage *gimage,
/************************************************************/
gboolean
gimp_image_is_empty (GimpImage *gimage)
gimp_image_is_empty (const GimpImage *gimage)
{
g_return_val_if_fail (gimage != NULL, TRUE);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), TRUE);
return (! gimage->layers);
return ! gimage->layers;
}
GimpDrawable *
gimp_image_active_drawable (GimpImage *gimage)
gimp_image_active_drawable (const GimpImage *gimage)
{
Layer *layer;
g_return_val_if_fail (gimage != NULL, NULL);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
/* If there is an active channel (a saved selection, etc.),
* we ignore the active layer
*/
if (gimage->active_channel != NULL)
return GIMP_DRAWABLE (gimage->active_channel);
{
return GIMP_DRAWABLE (gimage->active_channel);
}
else if (gimage->active_layer != NULL)
{
layer = gimage->active_layer;
if (layer->mask && layer->edit_mask)
return GIMP_DRAWABLE(layer->mask);
return GIMP_DRAWABLE (layer->mask);
else
return GIMP_DRAWABLE(layer);
return GIMP_DRAWABLE (layer);
}
else
return NULL;
return NULL;
}
GimpImageBaseType
gimp_image_base_type (GimpImage *gimage)
{
gimp_image_base_type (const GimpImage *gimage)
{
g_return_val_if_fail (gimage != NULL, -1);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), -1);
return gimage->base_type;
}
GimpImageType
gimp_image_base_type_with_alpha (GimpImage *gimage)
gimp_image_base_type_with_alpha (const GimpImage *gimage)
{
g_return_val_if_fail (gimage != NULL, -1);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), -1);
switch (gimage->base_type)
@ -3490,9 +3554,10 @@ gimp_image_base_type_with_alpha (GimpImage *gimage)
return RGB_GIMAGE;
}
gchar *
gimp_image_filename (GimpImage *gimage)
const gchar *
gimp_image_filename (const GimpImage *gimage)
{
g_return_val_if_fail (gimage != NULL, NULL);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
if (gimage->has_filename)
@ -3502,7 +3567,7 @@ gimp_image_filename (GimpImage *gimage)
}
gboolean
gimp_image_undo_is_enabled (GimpImage *gimage)
gimp_image_undo_is_enabled (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
@ -3550,7 +3615,7 @@ gimp_image_undo_enable (GimpImage *gimage)
void
gimp_image_undo_event (GimpImage *gimage,
int event)
gint event)
{
gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[UNDO_EVENT], event);
}
@ -3592,10 +3657,10 @@ gimp_image_dirty (GimpImage *gimage)
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
gimage->dirty++;
gtk_signal_emit(GTK_OBJECT(gimage), gimp_image_signals[DIRTY]);
gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[DIRTY]);
TRC (("dirty %d -> %d\n", gimage->dirty-1, gimage->dirty));
return gimage->dirty;
}
@ -3605,7 +3670,7 @@ gimp_image_clean (GimpImage *gimage)
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
gimage->dirty--;
gtk_signal_emit(GTK_OBJECT(gimage), gimp_image_signals[CLEAN]);
gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[CLEAN]);
TRC (("clean %d -> %d\n", gimage->dirty+1, gimage->dirty));
@ -3619,11 +3684,11 @@ gimp_image_clean_all (GimpImage *gimage)
gimage->dirty = 0;
gtk_signal_emit (GTK_OBJECT(gimage), gimp_image_signals[CLEAN]);
gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[CLEAN]);
}
Layer *
gimp_image_floating_sel (GimpImage *gimage)
gimp_image_floating_sel (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
@ -3634,7 +3699,7 @@ gimp_image_floating_sel (GimpImage *gimage)
}
guchar *
gimp_image_cmap (GimpImage *gimage)
gimp_image_cmap (const GimpImage *gimage)
{
return drawable_cmap (gimp_image_active_drawable (gimage));
}
@ -3651,13 +3716,15 @@ gimp_image_projection (GimpImage *gimage)
if ((gimage->projection == NULL) ||
(tile_manager_level_width (gimage->projection) != gimage->width) ||
(tile_manager_level_height (gimage->projection) != gimage->height))
gimp_image_allocate_projection (gimage);
{
gimp_image_allocate_projection (gimage);
}
return gimage->projection;
}
GimpImageType
gimp_image_projection_type (GimpImage *gimage)
gimp_image_projection_type (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), -1);
@ -3665,7 +3732,7 @@ gimp_image_projection_type (GimpImage *gimage)
}
gint
gimp_image_projection_bytes (GimpImage *gimage)
gimp_image_projection_bytes (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), -1);
@ -3673,7 +3740,7 @@ gimp_image_projection_bytes (GimpImage *gimage)
}
gint
gimp_image_projection_opacity (GimpImage *gimage)
gimp_image_projection_opacity (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), -1);
@ -3697,13 +3764,13 @@ gimp_image_composite (GimpImage *gimage)
}
GimpImageType
gimp_image_composite_type (GimpImage *gimage)
gimp_image_composite_type (const GimpImage *gimage)
{
return gimp_image_projection_type (gimage);
}
gint
gimp_image_composite_bytes (GimpImage *gimage)
gimp_image_composite_bytes (const GimpImage *gimage)
{
return gimp_image_projection_bytes (gimage);
}
@ -3913,8 +3980,8 @@ gimp_image_composite_preview (GimpImage *gimage,
}
gboolean
gimp_image_preview_valid (GimpImage *gimage,
ChannelType type)
gimp_image_preview_valid (const GimpImage *gimage,
ChannelType type)
{
switch (type)
{

View File

@ -88,10 +88,10 @@ typedef enum
struct _Guide
{
int ref_count;
int position;
int orientation;
guint32 guide_ID;
gint ref_count;
gint position;
InternalOrientationType orientation;
guint32 guide_ID;
};
@ -105,76 +105,103 @@ typedef struct _GimpImageRepaintArg
} GimpImageRepaintArg;
GtkType gimp_image_get_type (void);
/* function declarations */
GimpImage * gimp_image_new (gint, gint,
GimpImageBaseType);
void gimp_image_set_filename (GimpImage *, gchar *);
void gimp_image_set_resolution (GimpImage *,
gdouble, gdouble);
void gimp_image_get_resolution (GimpImage *,
gdouble *, gdouble *);
void gimp_image_set_unit (GimpImage *, GimpUnit);
GimpUnit gimp_image_get_unit (GimpImage *);
void gimp_image_set_save_proc (GimpImage *,
PlugInProcDef *);
PlugInProcDef * gimp_image_get_save_proc (GimpImage *);
gint gimp_image_get_width (const GimpImage *);
gint gimp_image_get_height (const GimpImage *);
void gimp_image_resize (GimpImage *,
gint, gint, gint, gint);
void gimp_image_scale (GimpImage *, gint, gint);
GimpImage * gimp_image_get_named (gchar *);
GimpImage * gimp_image_get_ID (gint);
TileManager * gimp_image_shadow (GimpImage *,
gint, gint, gint);
void gimp_image_free_shadow (GimpImage *);
void gimp_image_apply_image (GimpImage *, GimpDrawable *,
PixelRegion *, gint,
gint,
LayerModeEffects,
TileManager *, gint, gint);
void gimp_image_replace_image (GimpImage *, GimpDrawable *,
PixelRegion *, gint, gint,
PixelRegion *, gint, gint);
void gimp_image_get_foreground (GimpImage *, GimpDrawable *,
guchar *);
void gimp_image_get_background (GimpImage *, GimpDrawable *,
guchar *);
guchar * gimp_image_get_color_at (GimpImage *, gint, gint);
void gimp_image_get_color (GimpImage *,
GimpImageType,
guchar *,
guchar *);
void gimp_image_transform_color (GimpImage *,
GimpDrawable *,
guchar *,
guchar *,
GimpImageBaseType);
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 *);
GtkType gimp_image_get_type (void);
GimpParasite * gimp_image_parasite_find (const GimpImage *,
const gchar *name);
gchar ** gimp_image_parasite_list (GimpImage *gimage,
gint *count);
void gimp_image_parasite_attach (GimpImage *,
GimpParasite *);
void gimp_image_parasite_detach (GimpImage *, const gchar *);
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);
Tattoo gimp_image_get_new_tattoo (GimpImage *);
gboolean gimp_image_set_tattoo_state (GimpImage *, Tattoo);
Tattoo gimp_image_get_tattoo_state (GimpImage *);
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);
void gimp_image_set_paths (GimpImage *, PathList *);
PathList * gimp_image_get_paths (GimpImage *);
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);
/* Temporary hack till colormap manipulation is encapsulated in functions.
Call this whenever you modify an image's colormap. The ncol argument
@ -182,115 +209,169 @@ PathList * gimp_image_get_paths (GimpImage *);
Currently, use this also when the image's base type is changed to/from
indexed. */
void gimp_image_colormap_changed (GimpImage * image,
gint ncol);
void gimp_image_colormap_changed (const GimpImage *image,
gint col);
/* layer/channel functions */
gint gimp_image_get_layer_index (GimpImage *, Layer *);
Layer * gimp_image_get_layer_by_index (GimpImage *, gint);
gint gimp_image_get_channel_index (GimpImage *, Channel *);
Layer * gimp_image_get_active_layer (GimpImage *);
Channel * gimp_image_get_active_channel (GimpImage *);
Layer * gimp_image_get_layer_by_tattoo (GimpImage *, Tattoo);
Channel * gimp_image_get_channel_by_tattoo (GimpImage *, Tattoo);
Channel * gimp_image_get_channel_by_name (GimpImage *, gchar *);
Channel * gimp_image_get_mask (GimpImage *);
gint gimp_image_get_component_active (GimpImage *, ChannelType);
gint gimp_image_get_component_visible (GimpImage *, ChannelType);
gboolean gimp_image_layer_boundary (GimpImage *, BoundSeg **,
gint *);
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,
gint);
void gimp_image_set_component_visible (GimpImage *, ChannelType,
gint);
Layer * gimp_image_pick_correlate_layer (GimpImage *, gint, gint);
void gimp_image_set_layer_mask_apply (GimpImage *, gint);
void gimp_image_set_layer_mask_edit (GimpImage *, Layer *, gint);
void gimp_image_set_layer_mask_show (GimpImage *, gint);
Layer * gimp_image_raise_layer (GimpImage *, Layer *);
Layer * gimp_image_lower_layer (GimpImage *, Layer *);
Layer * gimp_image_raise_layer_to_top (GimpImage *, Layer *);
Layer * gimp_image_lower_layer_to_bottom (GimpImage *, Layer *);
Layer * gimp_image_position_layer (GimpImage *, Layer *,
gint, gboolean);
Layer * gimp_image_merge_visible_layers (GimpImage *, MergeType);
Layer * gimp_image_merge_down (GimpImage *, Layer *,
MergeType);
Layer * gimp_image_flatten (GimpImage *);
Layer * gimp_image_merge_layers (GimpImage *, GSList *,
MergeType);
Layer * gimp_image_add_layer (GimpImage *, Layer *, gint);
Layer * gimp_image_remove_layer (GimpImage *, Layer *);
LayerMask * gimp_image_add_layer_mask (GimpImage *, Layer *,
LayerMask *);
Channel * gimp_image_remove_layer_mask (GimpImage *, Layer *,
MaskApplyMode);
Channel * gimp_image_raise_channel (GimpImage *, Channel *);
Channel * gimp_image_lower_channel (GimpImage *, Channel *);
Channel * gimp_image_position_channel (GimpImage *, Channel *, gint);
Channel * gimp_image_add_channel (GimpImage *, Channel *, gint);
Channel * gimp_image_remove_channel (GimpImage *, Channel *);
void gimp_image_construct (GimpImage *,
gint, gint, gint, gint,
gboolean);
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 *, gint, gint,
gint, gint, gint,
gint, gint, gint);
void gimp_image_invalidate (GimpImage *, gint, gint,
gint, gint, gint,
gint, gint, gint);
void gimp_image_validate (TileManager *, Tile *);
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);
/* Access functions */
gboolean gimp_image_is_empty (GimpImage *);
GimpDrawable * gimp_image_active_drawable (GimpImage *);
gboolean gimp_image_is_empty (const GimpImage *gimage);
GimpDrawable * gimp_image_active_drawable (const GimpImage *gimage);
GimpImageBaseType gimp_image_base_type (GimpImage *gimage);
GimpImageType gimp_image_base_type_with_alpha (GimpImage *gimage);
GimpImageBaseType gimp_image_base_type (const GimpImage *gimage);
GimpImageType gimp_image_base_type_with_alpha (const GimpImage *gimage);
gchar * gimp_image_filename (GimpImage *);
gboolean gimp_image_undo_is_enabled (GimpImage *);
gboolean gimp_image_undo_enable (GimpImage *);
gboolean gimp_image_undo_disable (GimpImage *);
gboolean gimp_image_undo_freeze (GimpImage *);
gboolean gimp_image_undo_thaw (GimpImage *);
void gimp_image_undo_event (GimpImage *, gint);
gint gimp_image_dirty (GimpImage *);
gint gimp_image_clean (GimpImage *);
void gimp_image_clean_all (GimpImage *);
Layer * gimp_image_floating_sel (GimpImage *);
guchar * gimp_image_cmap (GimpImage *);
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);
/* projection access functions */
TileManager * gimp_image_projection (GimpImage *);
GimpImageType gimp_image_projection_type (GimpImage *);
gint gimp_image_projection_bytes (GimpImage *);
gint gimp_image_projection_opacity (GimpImage *);
void gimp_image_projection_realloc (GimpImage *);
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);
/* composite access functions */
TileManager * gimp_image_composite (GimpImage *);
GimpImageType gimp_image_composite_type (GimpImage *);
gint gimp_image_composite_bytes (GimpImage *);
TempBuf * gimp_image_composite_preview (GimpImage *, ChannelType,
gint, gint);
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);
gint gimp_image_preview_valid (GimpImage *, ChannelType);
void gimp_image_invalidate_preview (GimpImage *);
gint gimp_image_preview_valid (const GimpImage *gimage,
ChannelType type);
void gimp_image_invalidate_preview (GimpImage *gimage);
void gimp_image_invalidate_previews (void);
void gimp_image_invalidate_previews (void);
TempBuf * gimp_image_construct_composite_preview (GimpImage *,
gint , gint);
TempBuf * gimp_image_construct_composite_preview (GimpImage *gimage,
gint width,
gint height);
#endif /* __GIMPIMAGE_H__ */

View File

@ -59,28 +59,58 @@
/* Local function declarations */
static void gimp_image_destroy (GtkObject *object);
static void gimp_image_free_projection (GimpImage *);
static void gimp_image_allocate_shadow (GimpImage *, gint, gint, gint);
static void gimp_image_allocate_projection (GimpImage *);
static void gimp_image_free_layers (GimpImage *);
static void gimp_image_free_channels (GimpImage *);
static void gimp_image_construct_layers (GimpImage *, gint, gint, gint, gint);
static void gimp_image_construct_channels (GimpImage *, gint, gint, gint, gint);
static void gimp_image_initialize_projection (GimpImage *, gint, gint, gint, gint);
static void gimp_image_get_active_channels (GimpImage *, GimpDrawable *, gint *);
static void gimp_image_destroy (GtkObject *object);
static void gimp_image_free_projection (GimpImage *gimage);
static void gimp_image_allocate_shadow (GimpImage *gimage,
gint width,
gint height,
gint bpp);
static void gimp_image_allocate_projection (GimpImage *gimage);
static void gimp_image_free_layers (GimpImage *gimage);
static void gimp_image_free_channels (GimpImage *gimage);
static void gimp_image_construct_layers (GimpImage *gimage,
gint x,
gint y,
gint w,
gint h);
static void gimp_image_construct_channels (GimpImage *gimage,
gint x,
gint y,
gint w,
gint h);
static void gimp_image_initialize_projection (GimpImage *gimage,
gint x,
gint y,
gint w,
gint h);
static void gimp_image_get_active_channels (GimpImage *gimage,
GimpDrawable *drawable,
gint *active);
/* projection functions */
static void project_intensity (GimpImage *, Layer *,
PixelRegion *, PixelRegion *,
PixelRegion *);
static void project_intensity_alpha (GimpImage *, Layer *,
PixelRegion *, PixelRegion *,
PixelRegion *);
static void project_indexed (GimpImage *, Layer *,
PixelRegion *, PixelRegion *);
static void project_channel (GimpImage *, Channel *,
PixelRegion *, PixelRegion *);
static void project_intensity (GimpImage *gimage,
Layer *layer,
PixelRegion *src,
PixelRegion *dest,
PixelRegion *mask);
static void project_intensity_alpha (GimpImage *gimage,
Layer *layer,
PixelRegion *src,
PixelRegion *dest,
PixelRegion *mask);
static void project_indexed (GimpImage *gimage,
Layer *layer,
PixelRegion *src,
PixelRegion *dest);
static void project_indexed_alpha (GimpImage *gimage,
Layer *layer,
PixelRegion *src,
PixelRegion *dest,
PixelRegion *mask);
static void project_channel (GimpImage *gimage,
Channel *layer,
PixelRegion *src,
PixelRegion *src2);
/*
* Global variables
@ -108,7 +138,8 @@ guint32 next_guide_id = 1; /* For generating guide_ID handles for PDB stuff */
* Static variables
*/
enum {
enum
{
CLEAN,
DIRTY,
REPAINT,
@ -120,8 +151,9 @@ enum {
LAST_SIGNAL
};
static guint gimp_image_signals[LAST_SIGNAL];
static GimpObjectClass *parent_class;
static guint gimp_image_signals[LAST_SIGNAL] = { 0 };
static GimpObjectClass *parent_class = NULL;
static void
@ -129,13 +161,11 @@ gimp_image_class_init (GimpImageClass *klass)
{
GtkObjectClass *object_class;
GtkType type;
object_class = GTK_OBJECT_CLASS(klass);
parent_class = gtk_type_class (gimp_object_get_type ());
type=object_class->type;
object_class->destroy = gimp_image_destroy;
object_class = GTK_OBJECT_CLASS (klass);
parent_class = gtk_type_class (gimp_object_get_type ());
type = object_class->type;
gimp_image_signals[CLEAN] =
gimp_signal_new ("clean", GTK_RUN_FIRST, type, 0,
@ -163,6 +193,17 @@ gimp_image_class_init (GimpImageClass *klass)
gimp_sigtype_int);
gtk_object_class_add_signals (object_class, gimp_image_signals, LAST_SIGNAL);
object_class->destroy = gimp_image_destroy;
klass->clean = NULL;
klass->dirty = NULL;
klass->repaint = NULL;
klass->rename = NULL;
klass->resize = NULL;
klass->restructure = NULL;
klass->colormap_changed = NULL;
klass->undo_event = NULL;
}
@ -384,9 +425,9 @@ gimp_image_set_resolution (GimpImage *gimage,
}
void
gimp_image_get_resolution (GimpImage *gimage,
gdouble *xresolution,
gdouble *yresolution)
gimp_image_get_resolution (const GimpImage *gimage,
gdouble *xresolution,
gdouble *yresolution)
{
g_return_if_fail (xresolution && yresolution);
@ -404,7 +445,7 @@ gimp_image_set_unit (GimpImage *gimage,
}
GimpUnit
gimp_image_get_unit (GimpImage *gimage)
gimp_image_get_unit (const GimpImage *gimage)
{
return gimage->unit;
}
@ -417,11 +458,23 @@ gimp_image_set_save_proc (GimpImage *gimage,
}
PlugInProcDef *
gimp_image_get_save_proc (GimpImage *gimage)
gimp_image_get_save_proc (const GimpImage *gimage)
{
return gimage->save_proc;
}
gint
gimp_image_get_width (const GimpImage *gimage)
{
return gimage->width;
}
gint
gimp_image_get_height (const GimpImage *gimage)
{
return gimage->height;
}
void
gimp_image_resize (GimpImage *gimage,
gint new_width,
@ -518,18 +571,6 @@ gimp_image_resize (GimpImage *gimage,
gimp_remove_busy_cursors (NULL);
}
gint
gimp_image_get_width (const GimpImage *gimage)
{
return gimage->width;
}
gint
gimp_image_get_height (const GimpImage *gimage)
{
return gimage->height;
}
void
gimp_image_scale (GimpImage *gimage,
gint new_width,
@ -696,7 +737,8 @@ gimp_image_destroy (GtkObject *object)
gimp_image_free_layers (gimage);
gimp_image_free_channels (gimage);
channel_delete (gimage->selection_mask);
gtk_object_unref (GTK_OBJECT (gimage->selection_mask));
if (gimage->comp_preview)
temp_buf_free (gimage->comp_preview);
@ -941,9 +983,9 @@ gimp_image_replace_image (GimpImage *gimage,
/* Get rid of these! A "foreground" is an UI concept.. */
void
gimp_image_get_foreground (GimpImage *gimage,
GimpDrawable *drawable,
guchar *fg)
gimp_image_get_foreground (const GimpImage *gimage,
const GimpDrawable *drawable,
guchar *fg)
{
guchar pfg[3];
@ -954,9 +996,9 @@ gimp_image_get_foreground (GimpImage *gimage,
}
void
gimp_image_get_background (GimpImage *gimage,
GimpDrawable *drawable,
guchar *bg)
gimp_image_get_background (const GimpImage *gimage,
const GimpDrawable *drawable,
guchar *bg)
{
guchar pbg[3];
@ -980,7 +1022,7 @@ gimp_image_get_color_at (GimpImage *gimage,
if (x < 0 || y < 0 || x >= gimage->width || y >= gimage->height)
return NULL;
dest = g_new (unsigned char, 5);
dest = g_new (guchar, 5);
tile = tile_manager_get_tile (gimp_image_composite (gimage), x, y,
TRUE, FALSE);
src = tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT);
@ -998,10 +1040,10 @@ gimp_image_get_color_at (GimpImage *gimage,
}
void
gimp_image_get_color (GimpImage *gimage,
GimpImageType d_type,
guchar *rgb,
guchar *src)
gimp_image_get_color (const GimpImage *gimage,
GimpImageType d_type,
guchar *rgb,
guchar *src)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
@ -1020,17 +1062,17 @@ gimp_image_get_color (GimpImage *gimage,
}
void
gimp_image_transform_color (GimpImage *gimage,
GimpDrawable *drawable,
guchar *src,
guchar *dest,
GimpImageBaseType type)
gimp_image_transform_color (const GimpImage *gimage,
const GimpDrawable *drawable,
guchar *src,
guchar *dest,
GimpImageBaseType type)
{
GimpImageType d_type;
g_return_if_fail (GIMP_IS_IMAGE (gimage));
d_type = (drawable != NULL) ? drawable_type (drawable) :
d_type = (drawable != NULL) ? gimp_drawable_type (drawable) :
gimp_image_base_type_with_alpha (gimage);
switch (type)
@ -1090,7 +1132,7 @@ gimp_image_transform_color (GimpImage *gimage,
}
}
Guide*
Guide *
gimp_image_add_hguide (GimpImage *gimage)
{
Guide *guide;
@ -1108,7 +1150,7 @@ gimp_image_add_hguide (GimpImage *gimage)
return guide;
}
Guide*
Guide *
gimp_image_add_vguide (GimpImage *gimage)
{
Guide *guide;
@ -1178,8 +1220,8 @@ list_func (gchar *key,
}
gchar **
gimp_image_parasite_list (GimpImage *gimage,
gint *count)
gimp_image_parasite_list (const GimpImage *gimage,
gint *count)
{
gchar **list;
gchar **cur;
@ -1242,9 +1284,11 @@ Tattoo
gimp_image_get_new_tattoo (GimpImage *image)
{
image->tattoo_state++;
if (image->tattoo_state <= 0)
g_warning ("Tattoo state has become corrupt (2.1 billion operation limit exceded)");
return (image->tattoo_state);
return image->tattoo_state;
}
Tattoo
@ -1334,18 +1378,6 @@ gimp_image_set_tattoo_state (GimpImage *gimage,
return retval;
}
void
gimp_image_colormap_changed (GimpImage *gimage,
gint col)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (col < gimage->num_cols);
gtk_signal_emit (GTK_OBJECT (gimage),
gimp_image_signals[COLORMAP_CHANGED],
col);
}
void
gimp_image_set_paths (GimpImage *gimage,
PathList *paths)
@ -1356,13 +1388,25 @@ gimp_image_set_paths (GimpImage *gimage,
}
PathList *
gimp_image_get_paths (GimpImage *gimage)
gimp_image_get_paths (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
return gimage->paths;
}
void
gimp_image_colormap_changed (const GimpImage *gimage,
gint col)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (col < gimage->num_cols);
gtk_signal_emit (GTK_OBJECT (gimage),
gimp_image_signals[COLORMAP_CHANGED],
col);
}
/************************************************************/
/* Projection functions */
/************************************************************/
@ -1478,8 +1522,10 @@ gimp_image_free_channels (GimpImage *gimage)
for (list = gimage->channels; list; list = g_slist_next (list))
{
channel = (Channel *) list->data;
channel_delete (channel);
gtk_object_unref (GTK_OBJECT (channel));
}
g_slist_free (gimage->channels);
}
@ -1748,8 +1794,7 @@ gimp_image_construct (GimpImage *gimage,
gint x,
gint y,
gint w,
gint h,
gboolean can_use_cowproject)
gint h)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
@ -1950,8 +1995,7 @@ gimp_image_invalidate (GimpImage *gimage,
if ((endx - startx) > 0 && (endy - starty) > 0)
gimp_image_construct (gimage,
startx, starty,
(endx - startx), (endy - starty),
TRUE);
(endx - startx), (endy - starty));
}
void
@ -1972,12 +2016,12 @@ gimp_image_validate (TileManager *tm,
w = tile_ewidth (tile);
h = tile_eheight (tile);
gimp_image_construct (gimage, x, y, w, h, FALSE);
gimp_image_construct (gimage, x, y, w, h);
}
gint
gimp_image_get_layer_index (GimpImage *gimage,
Layer *layer_arg)
gimp_image_get_layer_index (const GimpImage *gimage,
const Layer *layer_arg)
{
Layer *layer;
GSList *layers;
@ -1990,6 +2034,7 @@ gimp_image_get_layer_index (GimpImage *gimage,
layers = g_slist_next (layers), index++)
{
layer = (Layer *) layers->data;
if (layer == layer_arg)
return index;
}
@ -1998,23 +2043,22 @@ gimp_image_get_layer_index (GimpImage *gimage,
}
Layer *
gimp_image_get_layer_by_index (GimpImage *gimage,
gint layer_index)
gimp_image_get_layer_by_index (const GimpImage *gimage,
gint layer_index)
{
Layer *layer;
g_return_val_if_fail (gimage != NULL, NULL);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
layer =
(Layer *) g_slist_nth_data (gimage->layers, layer_index);
layer = (Layer *) g_slist_nth_data (gimage->layers, layer_index);
return layer;
}
gint
gimp_image_get_channel_index (GimpImage *gimage,
Channel *channel_ID)
gimp_image_get_channel_index (const GimpImage *gimage,
const Channel *channel_arg)
{
Channel *channel;
GSList *channels;
@ -2028,7 +2072,8 @@ gimp_image_get_channel_index (GimpImage *gimage,
channels = g_slist_next (channels), index++)
{
channel = (Channel *) channels->data;
if (channel == channel_ID)
if (channel == channel_arg)
return index;
}
@ -2036,7 +2081,7 @@ gimp_image_get_channel_index (GimpImage *gimage,
}
Layer *
gimp_image_get_active_layer (GimpImage *gimage)
gimp_image_get_active_layer (const GimpImage *gimage)
{
g_return_val_if_fail (gimage != NULL, NULL);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
@ -2045,7 +2090,7 @@ gimp_image_get_active_layer (GimpImage *gimage)
}
Channel *
gimp_image_get_active_channel (GimpImage *gimage)
gimp_image_get_active_channel (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
@ -2053,8 +2098,8 @@ gimp_image_get_active_channel (GimpImage *gimage)
}
Layer *
gimp_image_get_layer_by_tattoo (GimpImage *gimage,
Tattoo tattoo)
gimp_image_get_layer_by_tattoo (const GimpImage *gimage,
Tattoo tattoo)
{
Layer *layer;
GSList *layers;
@ -2066,6 +2111,7 @@ gimp_image_get_layer_by_tattoo (GimpImage *gimage,
layers = g_slist_next (layers))
{
layer = (Layer *) layers->data;
if (layer_get_tattoo (layer) == tattoo)
return layer;
}
@ -2074,8 +2120,8 @@ gimp_image_get_layer_by_tattoo (GimpImage *gimage,
}
Channel *
gimp_image_get_channel_by_tattoo (GimpImage *gimage,
Tattoo tattoo)
gimp_image_get_channel_by_tattoo (const GimpImage *gimage,
Tattoo tattoo)
{
Channel *channel;
GSList *channels;
@ -2087,6 +2133,7 @@ gimp_image_get_channel_by_tattoo (GimpImage *gimage,
channels = g_slist_next (channels))
{
channel = (Channel *) channels->data;
if (channel_get_tattoo (channel) == tattoo)
return channel;
}
@ -2095,8 +2142,8 @@ gimp_image_get_channel_by_tattoo (GimpImage *gimage,
}
Channel *
gimp_image_get_channel_by_name (GimpImage *gimage,
char *name)
gimp_image_get_channel_by_name (const GimpImage *gimage,
const gchar *name)
{
Channel *channel;
GSList *channels;
@ -2108,16 +2155,24 @@ gimp_image_get_channel_by_name (GimpImage *gimage,
channels = g_slist_next (channels))
{
channel = (Channel *) channels->data;
if (! strcmp(channel_get_name (channel),name) )
if (! strcmp (drawable_get_name (GIMP_DRAWABLE (channel)), name))
return channel;
}
return NULL;
}
gint
gimp_image_get_component_active (GimpImage *gimage,
ChannelType type)
Channel *
gimp_image_get_mask (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
return gimage->selection_mask;
}
gboolean
gimp_image_get_component_active (const GimpImage *gimage,
ChannelType type)
{
/* No sanity checking here... */
switch (type)
@ -2131,9 +2186,9 @@ gimp_image_get_component_active (GimpImage *gimage,
}
}
gint
gimp_image_get_component_visible (GimpImage *gimage,
ChannelType type)
gboolean
gimp_image_get_component_visible (const GimpImage *gimage,
ChannelType type)
{
/* No sanity checking here... */
switch (type)
@ -2147,35 +2202,29 @@ gimp_image_get_component_visible (GimpImage *gimage,
}
}
Channel *
gimp_image_get_mask (GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
return gimage->selection_mask;
}
gboolean
gimp_image_layer_boundary (GimpImage *gimage,
BoundSeg **segs,
int *num_segs)
gimp_image_layer_boundary (const GimpImage *gimage,
BoundSeg **segs,
gint *n_segs)
{
Layer *layer;
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
g_return_val_if_fail (segs != NULL, FALSE);
g_return_val_if_fail (n_segs != NULL, FALSE);
/* The second boundary corresponds to the active layer's
* perimeter...
*/
if ((layer = gimage->active_layer))
{
*segs = layer_boundary (layer, num_segs);
*segs = layer_boundary (layer, n_segs);
return TRUE;
}
else
{
*segs = NULL;
*num_segs = 0;
*n_segs = 0;
return FALSE;
}
}
@ -2185,6 +2234,7 @@ gimp_image_set_active_layer (GimpImage *gimage,
Layer *layer)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
g_return_val_if_fail (GIMP_IS_LAYER (layer), NULL);
/* First, find the layer in the gimage
* If it isn't valid, find the first layer that is
@ -2264,16 +2314,16 @@ gimp_image_unset_active_channel (GimpImage *gimage)
void
gimp_image_set_component_active (GimpImage *gimage,
ChannelType type,
gint value)
gboolean active)
{
/* No sanity checking here... */
switch (type)
{
case RED_CHANNEL: gimage->active[RED_PIX] = value; break;
case GREEN_CHANNEL: gimage->active[GREEN_PIX] = value; break;
case BLUE_CHANNEL: gimage->active[BLUE_PIX] = value; break;
case GRAY_CHANNEL: gimage->active[GRAY_PIX] = value; break;
case INDEXED_CHANNEL: gimage->active[INDEXED_PIX] = value; break;
case RED_CHANNEL: gimage->active[RED_PIX] = active; break;
case GREEN_CHANNEL: gimage->active[GREEN_PIX] = active; break;
case BLUE_CHANNEL: gimage->active[BLUE_PIX] = active; break;
case GRAY_CHANNEL: gimage->active[GRAY_PIX] = active; break;
case INDEXED_CHANNEL: gimage->active[INDEXED_PIX] = active; break;
case AUXILLARY_CHANNEL: break;
}
@ -2287,24 +2337,24 @@ gimp_image_set_component_active (GimpImage *gimage,
void
gimp_image_set_component_visible (GimpImage *gimage,
ChannelType type,
gint value)
gboolean visible)
{
/* No sanity checking here... */
switch (type)
{
case RED_CHANNEL: gimage->visible[RED_PIX] = value; break;
case GREEN_CHANNEL: gimage->visible[GREEN_PIX] = value; break;
case BLUE_CHANNEL: gimage->visible[BLUE_PIX] = value; break;
case GRAY_CHANNEL: gimage->visible[GRAY_PIX] = value; break;
case INDEXED_CHANNEL: gimage->visible[INDEXED_PIX] = value; break;
case RED_CHANNEL: gimage->visible[RED_PIX] = visible; break;
case GREEN_CHANNEL: gimage->visible[GREEN_PIX] = visible; break;
case BLUE_CHANNEL: gimage->visible[BLUE_PIX] = visible; break;
case GRAY_CHANNEL: gimage->visible[GRAY_PIX] = visible; break;
case INDEXED_CHANNEL: gimage->visible[INDEXED_PIX] = visible; break;
default: break;
}
}
Layer *
gimp_image_pick_correlate_layer (GimpImage *gimage,
gint x,
gint y)
gimp_image_pick_correlate_layer (const GimpImage *gimage,
gint x,
gint y)
{
Layer *layer;
GSList *list;
@ -2322,8 +2372,6 @@ gimp_image_pick_correlate_layer (GimpImage *gimage,
return NULL;
}
Layer *
gimp_image_raise_layer (GimpImage *gimage,
Layer *layer_arg)
@ -2763,7 +2811,7 @@ gimp_image_merge_layers (GimpImage *gimage,
}
merge_layer = layer_new (gimage, (x2 - x1), (y2 - y1),
type, drawable_get_name (GIMP_DRAWABLE(layer)),
type, drawable_get_name (GIMP_DRAWABLE (layer)),
OPAQUE_OPACITY, NORMAL_MODE);
if (!merge_layer)
{
@ -3009,12 +3057,18 @@ gimp_image_add_layer (GimpImage *gimage,
position = 1;
gimage->layers =
g_slist_insert (gimage->layers, layer_ref (float_layer), position);
g_slist_insert (gimage->layers, float_layer, position);
gtk_object_ref (GTK_OBJECT (float_layer));
gtk_object_sink (GTK_OBJECT (float_layer));
}
else
{
gimage->layers =
g_slist_prepend (gimage->layers, layer_ref (float_layer));
g_slist_prepend (gimage->layers, float_layer);
gtk_object_ref (GTK_OBJECT (float_layer));
gtk_object_sink (GTK_OBJECT (float_layer));
}
gimage->layer_stack = g_slist_prepend (gimage->layer_stack, float_layer);
@ -3374,7 +3428,10 @@ gimp_image_add_channel (GimpImage *gimage,
undo_push_channel (gimage, CHANNEL_ADD_UNDO, cu);
/* add the channel to the list */
gimage->channels = g_slist_prepend (gimage->channels, channel_ref (channel));
gimage->channels = g_slist_prepend (gimage->channels, channel);
gtk_object_ref (GTK_OBJECT (channel));
gtk_object_sink (GTK_OBJECT (channel));
/* notify this gimage of the currently active channel */
gimp_image_set_active_channel (gimage, channel);
@ -3419,9 +3476,9 @@ gimp_image_remove_channel (GimpImage *gimage,
0, 0,
drawable_width (GIMP_DRAWABLE(channel)),
drawable_height (GIMP_DRAWABLE(channel)));
/* Send out REMOVED signal from channel */
channel_removed (channel, gimage);
channel_removed (channel);
/* Important to push the undo here in case the push fails */
undo_push_channel (gimage, CHANNEL_REMOVE_UNDO, cu);
@ -3434,48 +3491,55 @@ gimp_image_remove_channel (GimpImage *gimage,
/************************************************************/
gboolean
gimp_image_is_empty (GimpImage *gimage)
gimp_image_is_empty (const GimpImage *gimage)
{
g_return_val_if_fail (gimage != NULL, TRUE);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), TRUE);
return (! gimage->layers);
return ! gimage->layers;
}
GimpDrawable *
gimp_image_active_drawable (GimpImage *gimage)
gimp_image_active_drawable (const GimpImage *gimage)
{
Layer *layer;
g_return_val_if_fail (gimage != NULL, NULL);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
/* If there is an active channel (a saved selection, etc.),
* we ignore the active layer
*/
if (gimage->active_channel != NULL)
return GIMP_DRAWABLE (gimage->active_channel);
{
return GIMP_DRAWABLE (gimage->active_channel);
}
else if (gimage->active_layer != NULL)
{
layer = gimage->active_layer;
if (layer->mask && layer->edit_mask)
return GIMP_DRAWABLE(layer->mask);
return GIMP_DRAWABLE (layer->mask);
else
return GIMP_DRAWABLE(layer);
return GIMP_DRAWABLE (layer);
}
else
return NULL;
return NULL;
}
GimpImageBaseType
gimp_image_base_type (GimpImage *gimage)
{
gimp_image_base_type (const GimpImage *gimage)
{
g_return_val_if_fail (gimage != NULL, -1);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), -1);
return gimage->base_type;
}
GimpImageType
gimp_image_base_type_with_alpha (GimpImage *gimage)
gimp_image_base_type_with_alpha (const GimpImage *gimage)
{
g_return_val_if_fail (gimage != NULL, -1);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), -1);
switch (gimage->base_type)
@ -3490,9 +3554,10 @@ gimp_image_base_type_with_alpha (GimpImage *gimage)
return RGB_GIMAGE;
}
gchar *
gimp_image_filename (GimpImage *gimage)
const gchar *
gimp_image_filename (const GimpImage *gimage)
{
g_return_val_if_fail (gimage != NULL, NULL);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
if (gimage->has_filename)
@ -3502,7 +3567,7 @@ gimp_image_filename (GimpImage *gimage)
}
gboolean
gimp_image_undo_is_enabled (GimpImage *gimage)
gimp_image_undo_is_enabled (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
@ -3550,7 +3615,7 @@ gimp_image_undo_enable (GimpImage *gimage)
void
gimp_image_undo_event (GimpImage *gimage,
int event)
gint event)
{
gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[UNDO_EVENT], event);
}
@ -3592,10 +3657,10 @@ gimp_image_dirty (GimpImage *gimage)
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
gimage->dirty++;
gtk_signal_emit(GTK_OBJECT(gimage), gimp_image_signals[DIRTY]);
gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[DIRTY]);
TRC (("dirty %d -> %d\n", gimage->dirty-1, gimage->dirty));
return gimage->dirty;
}
@ -3605,7 +3670,7 @@ gimp_image_clean (GimpImage *gimage)
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
gimage->dirty--;
gtk_signal_emit(GTK_OBJECT(gimage), gimp_image_signals[CLEAN]);
gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[CLEAN]);
TRC (("clean %d -> %d\n", gimage->dirty+1, gimage->dirty));
@ -3619,11 +3684,11 @@ gimp_image_clean_all (GimpImage *gimage)
gimage->dirty = 0;
gtk_signal_emit (GTK_OBJECT(gimage), gimp_image_signals[CLEAN]);
gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[CLEAN]);
}
Layer *
gimp_image_floating_sel (GimpImage *gimage)
gimp_image_floating_sel (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
@ -3634,7 +3699,7 @@ gimp_image_floating_sel (GimpImage *gimage)
}
guchar *
gimp_image_cmap (GimpImage *gimage)
gimp_image_cmap (const GimpImage *gimage)
{
return drawable_cmap (gimp_image_active_drawable (gimage));
}
@ -3651,13 +3716,15 @@ gimp_image_projection (GimpImage *gimage)
if ((gimage->projection == NULL) ||
(tile_manager_level_width (gimage->projection) != gimage->width) ||
(tile_manager_level_height (gimage->projection) != gimage->height))
gimp_image_allocate_projection (gimage);
{
gimp_image_allocate_projection (gimage);
}
return gimage->projection;
}
GimpImageType
gimp_image_projection_type (GimpImage *gimage)
gimp_image_projection_type (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), -1);
@ -3665,7 +3732,7 @@ gimp_image_projection_type (GimpImage *gimage)
}
gint
gimp_image_projection_bytes (GimpImage *gimage)
gimp_image_projection_bytes (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), -1);
@ -3673,7 +3740,7 @@ gimp_image_projection_bytes (GimpImage *gimage)
}
gint
gimp_image_projection_opacity (GimpImage *gimage)
gimp_image_projection_opacity (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), -1);
@ -3697,13 +3764,13 @@ gimp_image_composite (GimpImage *gimage)
}
GimpImageType
gimp_image_composite_type (GimpImage *gimage)
gimp_image_composite_type (const GimpImage *gimage)
{
return gimp_image_projection_type (gimage);
}
gint
gimp_image_composite_bytes (GimpImage *gimage)
gimp_image_composite_bytes (const GimpImage *gimage)
{
return gimp_image_projection_bytes (gimage);
}
@ -3913,8 +3980,8 @@ gimp_image_composite_preview (GimpImage *gimage,
}
gboolean
gimp_image_preview_valid (GimpImage *gimage,
ChannelType type)
gimp_image_preview_valid (const GimpImage *gimage,
ChannelType type)
{
switch (type)
{

View File

@ -88,10 +88,10 @@ typedef enum
struct _Guide
{
int ref_count;
int position;
int orientation;
guint32 guide_ID;
gint ref_count;
gint position;
InternalOrientationType orientation;
guint32 guide_ID;
};
@ -105,76 +105,103 @@ typedef struct _GimpImageRepaintArg
} GimpImageRepaintArg;
GtkType gimp_image_get_type (void);
/* function declarations */
GimpImage * gimp_image_new (gint, gint,
GimpImageBaseType);
void gimp_image_set_filename (GimpImage *, gchar *);
void gimp_image_set_resolution (GimpImage *,
gdouble, gdouble);
void gimp_image_get_resolution (GimpImage *,
gdouble *, gdouble *);
void gimp_image_set_unit (GimpImage *, GimpUnit);
GimpUnit gimp_image_get_unit (GimpImage *);
void gimp_image_set_save_proc (GimpImage *,
PlugInProcDef *);
PlugInProcDef * gimp_image_get_save_proc (GimpImage *);
gint gimp_image_get_width (const GimpImage *);
gint gimp_image_get_height (const GimpImage *);
void gimp_image_resize (GimpImage *,
gint, gint, gint, gint);
void gimp_image_scale (GimpImage *, gint, gint);
GimpImage * gimp_image_get_named (gchar *);
GimpImage * gimp_image_get_ID (gint);
TileManager * gimp_image_shadow (GimpImage *,
gint, gint, gint);
void gimp_image_free_shadow (GimpImage *);
void gimp_image_apply_image (GimpImage *, GimpDrawable *,
PixelRegion *, gint,
gint,
LayerModeEffects,
TileManager *, gint, gint);
void gimp_image_replace_image (GimpImage *, GimpDrawable *,
PixelRegion *, gint, gint,
PixelRegion *, gint, gint);
void gimp_image_get_foreground (GimpImage *, GimpDrawable *,
guchar *);
void gimp_image_get_background (GimpImage *, GimpDrawable *,
guchar *);
guchar * gimp_image_get_color_at (GimpImage *, gint, gint);
void gimp_image_get_color (GimpImage *,
GimpImageType,
guchar *,
guchar *);
void gimp_image_transform_color (GimpImage *,
GimpDrawable *,
guchar *,
guchar *,
GimpImageBaseType);
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 *);
GtkType gimp_image_get_type (void);
GimpParasite * gimp_image_parasite_find (const GimpImage *,
const gchar *name);
gchar ** gimp_image_parasite_list (GimpImage *gimage,
gint *count);
void gimp_image_parasite_attach (GimpImage *,
GimpParasite *);
void gimp_image_parasite_detach (GimpImage *, const gchar *);
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);
Tattoo gimp_image_get_new_tattoo (GimpImage *);
gboolean gimp_image_set_tattoo_state (GimpImage *, Tattoo);
Tattoo gimp_image_get_tattoo_state (GimpImage *);
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);
void gimp_image_set_paths (GimpImage *, PathList *);
PathList * gimp_image_get_paths (GimpImage *);
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);
/* Temporary hack till colormap manipulation is encapsulated in functions.
Call this whenever you modify an image's colormap. The ncol argument
@ -182,115 +209,169 @@ PathList * gimp_image_get_paths (GimpImage *);
Currently, use this also when the image's base type is changed to/from
indexed. */
void gimp_image_colormap_changed (GimpImage * image,
gint ncol);
void gimp_image_colormap_changed (const GimpImage *image,
gint col);
/* layer/channel functions */
gint gimp_image_get_layer_index (GimpImage *, Layer *);
Layer * gimp_image_get_layer_by_index (GimpImage *, gint);
gint gimp_image_get_channel_index (GimpImage *, Channel *);
Layer * gimp_image_get_active_layer (GimpImage *);
Channel * gimp_image_get_active_channel (GimpImage *);
Layer * gimp_image_get_layer_by_tattoo (GimpImage *, Tattoo);
Channel * gimp_image_get_channel_by_tattoo (GimpImage *, Tattoo);
Channel * gimp_image_get_channel_by_name (GimpImage *, gchar *);
Channel * gimp_image_get_mask (GimpImage *);
gint gimp_image_get_component_active (GimpImage *, ChannelType);
gint gimp_image_get_component_visible (GimpImage *, ChannelType);
gboolean gimp_image_layer_boundary (GimpImage *, BoundSeg **,
gint *);
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,
gint);
void gimp_image_set_component_visible (GimpImage *, ChannelType,
gint);
Layer * gimp_image_pick_correlate_layer (GimpImage *, gint, gint);
void gimp_image_set_layer_mask_apply (GimpImage *, gint);
void gimp_image_set_layer_mask_edit (GimpImage *, Layer *, gint);
void gimp_image_set_layer_mask_show (GimpImage *, gint);
Layer * gimp_image_raise_layer (GimpImage *, Layer *);
Layer * gimp_image_lower_layer (GimpImage *, Layer *);
Layer * gimp_image_raise_layer_to_top (GimpImage *, Layer *);
Layer * gimp_image_lower_layer_to_bottom (GimpImage *, Layer *);
Layer * gimp_image_position_layer (GimpImage *, Layer *,
gint, gboolean);
Layer * gimp_image_merge_visible_layers (GimpImage *, MergeType);
Layer * gimp_image_merge_down (GimpImage *, Layer *,
MergeType);
Layer * gimp_image_flatten (GimpImage *);
Layer * gimp_image_merge_layers (GimpImage *, GSList *,
MergeType);
Layer * gimp_image_add_layer (GimpImage *, Layer *, gint);
Layer * gimp_image_remove_layer (GimpImage *, Layer *);
LayerMask * gimp_image_add_layer_mask (GimpImage *, Layer *,
LayerMask *);
Channel * gimp_image_remove_layer_mask (GimpImage *, Layer *,
MaskApplyMode);
Channel * gimp_image_raise_channel (GimpImage *, Channel *);
Channel * gimp_image_lower_channel (GimpImage *, Channel *);
Channel * gimp_image_position_channel (GimpImage *, Channel *, gint);
Channel * gimp_image_add_channel (GimpImage *, Channel *, gint);
Channel * gimp_image_remove_channel (GimpImage *, Channel *);
void gimp_image_construct (GimpImage *,
gint, gint, gint, gint,
gboolean);
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 *, gint, gint,
gint, gint, gint,
gint, gint, gint);
void gimp_image_invalidate (GimpImage *, gint, gint,
gint, gint, gint,
gint, gint, gint);
void gimp_image_validate (TileManager *, Tile *);
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);
/* Access functions */
gboolean gimp_image_is_empty (GimpImage *);
GimpDrawable * gimp_image_active_drawable (GimpImage *);
gboolean gimp_image_is_empty (const GimpImage *gimage);
GimpDrawable * gimp_image_active_drawable (const GimpImage *gimage);
GimpImageBaseType gimp_image_base_type (GimpImage *gimage);
GimpImageType gimp_image_base_type_with_alpha (GimpImage *gimage);
GimpImageBaseType gimp_image_base_type (const GimpImage *gimage);
GimpImageType gimp_image_base_type_with_alpha (const GimpImage *gimage);
gchar * gimp_image_filename (GimpImage *);
gboolean gimp_image_undo_is_enabled (GimpImage *);
gboolean gimp_image_undo_enable (GimpImage *);
gboolean gimp_image_undo_disable (GimpImage *);
gboolean gimp_image_undo_freeze (GimpImage *);
gboolean gimp_image_undo_thaw (GimpImage *);
void gimp_image_undo_event (GimpImage *, gint);
gint gimp_image_dirty (GimpImage *);
gint gimp_image_clean (GimpImage *);
void gimp_image_clean_all (GimpImage *);
Layer * gimp_image_floating_sel (GimpImage *);
guchar * gimp_image_cmap (GimpImage *);
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);
/* projection access functions */
TileManager * gimp_image_projection (GimpImage *);
GimpImageType gimp_image_projection_type (GimpImage *);
gint gimp_image_projection_bytes (GimpImage *);
gint gimp_image_projection_opacity (GimpImage *);
void gimp_image_projection_realloc (GimpImage *);
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);
/* composite access functions */
TileManager * gimp_image_composite (GimpImage *);
GimpImageType gimp_image_composite_type (GimpImage *);
gint gimp_image_composite_bytes (GimpImage *);
TempBuf * gimp_image_composite_preview (GimpImage *, ChannelType,
gint, gint);
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);
gint gimp_image_preview_valid (GimpImage *, ChannelType);
void gimp_image_invalidate_preview (GimpImage *);
gint gimp_image_preview_valid (const GimpImage *gimage,
ChannelType type);
void gimp_image_invalidate_preview (GimpImage *gimage);
void gimp_image_invalidate_previews (void);
void gimp_image_invalidate_previews (void);
TempBuf * gimp_image_construct_composite_preview (GimpImage *,
gint , gint);
TempBuf * gimp_image_construct_composite_preview (GimpImage *gimage,
gint width,
gint height);
#endif /* __GIMPIMAGE_H__ */

View File

@ -1430,7 +1430,7 @@ undo_push_layer (GImage *gimage,
{
/* if this is a remove layer, delete the layer */
if (type == LAYER_REMOVE_UNDO)
layer_unref (lu->layer);
gtk_object_unref (GTK_OBJECT (lu->layer));
g_free (lu);
return FALSE;
}
@ -1516,7 +1516,7 @@ undo_free_layer (UndoState state,
*/
if ((state == REDO && type == LAYER_ADD_UNDO) ||
(state == UNDO && type == LAYER_REMOVE_UNDO))
layer_unref (lu->layer);
gtk_object_unref (GTK_OBJECT (lu->layer));
g_free (lu);
}

View File

@ -59,28 +59,58 @@
/* Local function declarations */
static void gimp_image_destroy (GtkObject *object);
static void gimp_image_free_projection (GimpImage *);
static void gimp_image_allocate_shadow (GimpImage *, gint, gint, gint);
static void gimp_image_allocate_projection (GimpImage *);
static void gimp_image_free_layers (GimpImage *);
static void gimp_image_free_channels (GimpImage *);
static void gimp_image_construct_layers (GimpImage *, gint, gint, gint, gint);
static void gimp_image_construct_channels (GimpImage *, gint, gint, gint, gint);
static void gimp_image_initialize_projection (GimpImage *, gint, gint, gint, gint);
static void gimp_image_get_active_channels (GimpImage *, GimpDrawable *, gint *);
static void gimp_image_destroy (GtkObject *object);
static void gimp_image_free_projection (GimpImage *gimage);
static void gimp_image_allocate_shadow (GimpImage *gimage,
gint width,
gint height,
gint bpp);
static void gimp_image_allocate_projection (GimpImage *gimage);
static void gimp_image_free_layers (GimpImage *gimage);
static void gimp_image_free_channels (GimpImage *gimage);
static void gimp_image_construct_layers (GimpImage *gimage,
gint x,
gint y,
gint w,
gint h);
static void gimp_image_construct_channels (GimpImage *gimage,
gint x,
gint y,
gint w,
gint h);
static void gimp_image_initialize_projection (GimpImage *gimage,
gint x,
gint y,
gint w,
gint h);
static void gimp_image_get_active_channels (GimpImage *gimage,
GimpDrawable *drawable,
gint *active);
/* projection functions */
static void project_intensity (GimpImage *, Layer *,
PixelRegion *, PixelRegion *,
PixelRegion *);
static void project_intensity_alpha (GimpImage *, Layer *,
PixelRegion *, PixelRegion *,
PixelRegion *);
static void project_indexed (GimpImage *, Layer *,
PixelRegion *, PixelRegion *);
static void project_channel (GimpImage *, Channel *,
PixelRegion *, PixelRegion *);
static void project_intensity (GimpImage *gimage,
Layer *layer,
PixelRegion *src,
PixelRegion *dest,
PixelRegion *mask);
static void project_intensity_alpha (GimpImage *gimage,
Layer *layer,
PixelRegion *src,
PixelRegion *dest,
PixelRegion *mask);
static void project_indexed (GimpImage *gimage,
Layer *layer,
PixelRegion *src,
PixelRegion *dest);
static void project_indexed_alpha (GimpImage *gimage,
Layer *layer,
PixelRegion *src,
PixelRegion *dest,
PixelRegion *mask);
static void project_channel (GimpImage *gimage,
Channel *layer,
PixelRegion *src,
PixelRegion *src2);
/*
* Global variables
@ -108,7 +138,8 @@ guint32 next_guide_id = 1; /* For generating guide_ID handles for PDB stuff */
* Static variables
*/
enum {
enum
{
CLEAN,
DIRTY,
REPAINT,
@ -120,8 +151,9 @@ enum {
LAST_SIGNAL
};
static guint gimp_image_signals[LAST_SIGNAL];
static GimpObjectClass *parent_class;
static guint gimp_image_signals[LAST_SIGNAL] = { 0 };
static GimpObjectClass *parent_class = NULL;
static void
@ -129,13 +161,11 @@ gimp_image_class_init (GimpImageClass *klass)
{
GtkObjectClass *object_class;
GtkType type;
object_class = GTK_OBJECT_CLASS(klass);
parent_class = gtk_type_class (gimp_object_get_type ());
type=object_class->type;
object_class->destroy = gimp_image_destroy;
object_class = GTK_OBJECT_CLASS (klass);
parent_class = gtk_type_class (gimp_object_get_type ());
type = object_class->type;
gimp_image_signals[CLEAN] =
gimp_signal_new ("clean", GTK_RUN_FIRST, type, 0,
@ -163,6 +193,17 @@ gimp_image_class_init (GimpImageClass *klass)
gimp_sigtype_int);
gtk_object_class_add_signals (object_class, gimp_image_signals, LAST_SIGNAL);
object_class->destroy = gimp_image_destroy;
klass->clean = NULL;
klass->dirty = NULL;
klass->repaint = NULL;
klass->rename = NULL;
klass->resize = NULL;
klass->restructure = NULL;
klass->colormap_changed = NULL;
klass->undo_event = NULL;
}
@ -384,9 +425,9 @@ gimp_image_set_resolution (GimpImage *gimage,
}
void
gimp_image_get_resolution (GimpImage *gimage,
gdouble *xresolution,
gdouble *yresolution)
gimp_image_get_resolution (const GimpImage *gimage,
gdouble *xresolution,
gdouble *yresolution)
{
g_return_if_fail (xresolution && yresolution);
@ -404,7 +445,7 @@ gimp_image_set_unit (GimpImage *gimage,
}
GimpUnit
gimp_image_get_unit (GimpImage *gimage)
gimp_image_get_unit (const GimpImage *gimage)
{
return gimage->unit;
}
@ -417,11 +458,23 @@ gimp_image_set_save_proc (GimpImage *gimage,
}
PlugInProcDef *
gimp_image_get_save_proc (GimpImage *gimage)
gimp_image_get_save_proc (const GimpImage *gimage)
{
return gimage->save_proc;
}
gint
gimp_image_get_width (const GimpImage *gimage)
{
return gimage->width;
}
gint
gimp_image_get_height (const GimpImage *gimage)
{
return gimage->height;
}
void
gimp_image_resize (GimpImage *gimage,
gint new_width,
@ -518,18 +571,6 @@ gimp_image_resize (GimpImage *gimage,
gimp_remove_busy_cursors (NULL);
}
gint
gimp_image_get_width (const GimpImage *gimage)
{
return gimage->width;
}
gint
gimp_image_get_height (const GimpImage *gimage)
{
return gimage->height;
}
void
gimp_image_scale (GimpImage *gimage,
gint new_width,
@ -696,7 +737,8 @@ gimp_image_destroy (GtkObject *object)
gimp_image_free_layers (gimage);
gimp_image_free_channels (gimage);
channel_delete (gimage->selection_mask);
gtk_object_unref (GTK_OBJECT (gimage->selection_mask));
if (gimage->comp_preview)
temp_buf_free (gimage->comp_preview);
@ -941,9 +983,9 @@ gimp_image_replace_image (GimpImage *gimage,
/* Get rid of these! A "foreground" is an UI concept.. */
void
gimp_image_get_foreground (GimpImage *gimage,
GimpDrawable *drawable,
guchar *fg)
gimp_image_get_foreground (const GimpImage *gimage,
const GimpDrawable *drawable,
guchar *fg)
{
guchar pfg[3];
@ -954,9 +996,9 @@ gimp_image_get_foreground (GimpImage *gimage,
}
void
gimp_image_get_background (GimpImage *gimage,
GimpDrawable *drawable,
guchar *bg)
gimp_image_get_background (const GimpImage *gimage,
const GimpDrawable *drawable,
guchar *bg)
{
guchar pbg[3];
@ -980,7 +1022,7 @@ gimp_image_get_color_at (GimpImage *gimage,
if (x < 0 || y < 0 || x >= gimage->width || y >= gimage->height)
return NULL;
dest = g_new (unsigned char, 5);
dest = g_new (guchar, 5);
tile = tile_manager_get_tile (gimp_image_composite (gimage), x, y,
TRUE, FALSE);
src = tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT);
@ -998,10 +1040,10 @@ gimp_image_get_color_at (GimpImage *gimage,
}
void
gimp_image_get_color (GimpImage *gimage,
GimpImageType d_type,
guchar *rgb,
guchar *src)
gimp_image_get_color (const GimpImage *gimage,
GimpImageType d_type,
guchar *rgb,
guchar *src)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
@ -1020,17 +1062,17 @@ gimp_image_get_color (GimpImage *gimage,
}
void
gimp_image_transform_color (GimpImage *gimage,
GimpDrawable *drawable,
guchar *src,
guchar *dest,
GimpImageBaseType type)
gimp_image_transform_color (const GimpImage *gimage,
const GimpDrawable *drawable,
guchar *src,
guchar *dest,
GimpImageBaseType type)
{
GimpImageType d_type;
g_return_if_fail (GIMP_IS_IMAGE (gimage));
d_type = (drawable != NULL) ? drawable_type (drawable) :
d_type = (drawable != NULL) ? gimp_drawable_type (drawable) :
gimp_image_base_type_with_alpha (gimage);
switch (type)
@ -1090,7 +1132,7 @@ gimp_image_transform_color (GimpImage *gimage,
}
}
Guide*
Guide *
gimp_image_add_hguide (GimpImage *gimage)
{
Guide *guide;
@ -1108,7 +1150,7 @@ gimp_image_add_hguide (GimpImage *gimage)
return guide;
}
Guide*
Guide *
gimp_image_add_vguide (GimpImage *gimage)
{
Guide *guide;
@ -1178,8 +1220,8 @@ list_func (gchar *key,
}
gchar **
gimp_image_parasite_list (GimpImage *gimage,
gint *count)
gimp_image_parasite_list (const GimpImage *gimage,
gint *count)
{
gchar **list;
gchar **cur;
@ -1242,9 +1284,11 @@ Tattoo
gimp_image_get_new_tattoo (GimpImage *image)
{
image->tattoo_state++;
if (image->tattoo_state <= 0)
g_warning ("Tattoo state has become corrupt (2.1 billion operation limit exceded)");
return (image->tattoo_state);
return image->tattoo_state;
}
Tattoo
@ -1334,18 +1378,6 @@ gimp_image_set_tattoo_state (GimpImage *gimage,
return retval;
}
void
gimp_image_colormap_changed (GimpImage *gimage,
gint col)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (col < gimage->num_cols);
gtk_signal_emit (GTK_OBJECT (gimage),
gimp_image_signals[COLORMAP_CHANGED],
col);
}
void
gimp_image_set_paths (GimpImage *gimage,
PathList *paths)
@ -1356,13 +1388,25 @@ gimp_image_set_paths (GimpImage *gimage,
}
PathList *
gimp_image_get_paths (GimpImage *gimage)
gimp_image_get_paths (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
return gimage->paths;
}
void
gimp_image_colormap_changed (const GimpImage *gimage,
gint col)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (col < gimage->num_cols);
gtk_signal_emit (GTK_OBJECT (gimage),
gimp_image_signals[COLORMAP_CHANGED],
col);
}
/************************************************************/
/* Projection functions */
/************************************************************/
@ -1478,8 +1522,10 @@ gimp_image_free_channels (GimpImage *gimage)
for (list = gimage->channels; list; list = g_slist_next (list))
{
channel = (Channel *) list->data;
channel_delete (channel);
gtk_object_unref (GTK_OBJECT (channel));
}
g_slist_free (gimage->channels);
}
@ -1748,8 +1794,7 @@ gimp_image_construct (GimpImage *gimage,
gint x,
gint y,
gint w,
gint h,
gboolean can_use_cowproject)
gint h)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
@ -1950,8 +1995,7 @@ gimp_image_invalidate (GimpImage *gimage,
if ((endx - startx) > 0 && (endy - starty) > 0)
gimp_image_construct (gimage,
startx, starty,
(endx - startx), (endy - starty),
TRUE);
(endx - startx), (endy - starty));
}
void
@ -1972,12 +2016,12 @@ gimp_image_validate (TileManager *tm,
w = tile_ewidth (tile);
h = tile_eheight (tile);
gimp_image_construct (gimage, x, y, w, h, FALSE);
gimp_image_construct (gimage, x, y, w, h);
}
gint
gimp_image_get_layer_index (GimpImage *gimage,
Layer *layer_arg)
gimp_image_get_layer_index (const GimpImage *gimage,
const Layer *layer_arg)
{
Layer *layer;
GSList *layers;
@ -1990,6 +2034,7 @@ gimp_image_get_layer_index (GimpImage *gimage,
layers = g_slist_next (layers), index++)
{
layer = (Layer *) layers->data;
if (layer == layer_arg)
return index;
}
@ -1998,23 +2043,22 @@ gimp_image_get_layer_index (GimpImage *gimage,
}
Layer *
gimp_image_get_layer_by_index (GimpImage *gimage,
gint layer_index)
gimp_image_get_layer_by_index (const GimpImage *gimage,
gint layer_index)
{
Layer *layer;
g_return_val_if_fail (gimage != NULL, NULL);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
layer =
(Layer *) g_slist_nth_data (gimage->layers, layer_index);
layer = (Layer *) g_slist_nth_data (gimage->layers, layer_index);
return layer;
}
gint
gimp_image_get_channel_index (GimpImage *gimage,
Channel *channel_ID)
gimp_image_get_channel_index (const GimpImage *gimage,
const Channel *channel_arg)
{
Channel *channel;
GSList *channels;
@ -2028,7 +2072,8 @@ gimp_image_get_channel_index (GimpImage *gimage,
channels = g_slist_next (channels), index++)
{
channel = (Channel *) channels->data;
if (channel == channel_ID)
if (channel == channel_arg)
return index;
}
@ -2036,7 +2081,7 @@ gimp_image_get_channel_index (GimpImage *gimage,
}
Layer *
gimp_image_get_active_layer (GimpImage *gimage)
gimp_image_get_active_layer (const GimpImage *gimage)
{
g_return_val_if_fail (gimage != NULL, NULL);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
@ -2045,7 +2090,7 @@ gimp_image_get_active_layer (GimpImage *gimage)
}
Channel *
gimp_image_get_active_channel (GimpImage *gimage)
gimp_image_get_active_channel (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
@ -2053,8 +2098,8 @@ gimp_image_get_active_channel (GimpImage *gimage)
}
Layer *
gimp_image_get_layer_by_tattoo (GimpImage *gimage,
Tattoo tattoo)
gimp_image_get_layer_by_tattoo (const GimpImage *gimage,
Tattoo tattoo)
{
Layer *layer;
GSList *layers;
@ -2066,6 +2111,7 @@ gimp_image_get_layer_by_tattoo (GimpImage *gimage,
layers = g_slist_next (layers))
{
layer = (Layer *) layers->data;
if (layer_get_tattoo (layer) == tattoo)
return layer;
}
@ -2074,8 +2120,8 @@ gimp_image_get_layer_by_tattoo (GimpImage *gimage,
}
Channel *
gimp_image_get_channel_by_tattoo (GimpImage *gimage,
Tattoo tattoo)
gimp_image_get_channel_by_tattoo (const GimpImage *gimage,
Tattoo tattoo)
{
Channel *channel;
GSList *channels;
@ -2087,6 +2133,7 @@ gimp_image_get_channel_by_tattoo (GimpImage *gimage,
channels = g_slist_next (channels))
{
channel = (Channel *) channels->data;
if (channel_get_tattoo (channel) == tattoo)
return channel;
}
@ -2095,8 +2142,8 @@ gimp_image_get_channel_by_tattoo (GimpImage *gimage,
}
Channel *
gimp_image_get_channel_by_name (GimpImage *gimage,
char *name)
gimp_image_get_channel_by_name (const GimpImage *gimage,
const gchar *name)
{
Channel *channel;
GSList *channels;
@ -2108,16 +2155,24 @@ gimp_image_get_channel_by_name (GimpImage *gimage,
channels = g_slist_next (channels))
{
channel = (Channel *) channels->data;
if (! strcmp(channel_get_name (channel),name) )
if (! strcmp (drawable_get_name (GIMP_DRAWABLE (channel)), name))
return channel;
}
return NULL;
}
gint
gimp_image_get_component_active (GimpImage *gimage,
ChannelType type)
Channel *
gimp_image_get_mask (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
return gimage->selection_mask;
}
gboolean
gimp_image_get_component_active (const GimpImage *gimage,
ChannelType type)
{
/* No sanity checking here... */
switch (type)
@ -2131,9 +2186,9 @@ gimp_image_get_component_active (GimpImage *gimage,
}
}
gint
gimp_image_get_component_visible (GimpImage *gimage,
ChannelType type)
gboolean
gimp_image_get_component_visible (const GimpImage *gimage,
ChannelType type)
{
/* No sanity checking here... */
switch (type)
@ -2147,35 +2202,29 @@ gimp_image_get_component_visible (GimpImage *gimage,
}
}
Channel *
gimp_image_get_mask (GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
return gimage->selection_mask;
}
gboolean
gimp_image_layer_boundary (GimpImage *gimage,
BoundSeg **segs,
int *num_segs)
gimp_image_layer_boundary (const GimpImage *gimage,
BoundSeg **segs,
gint *n_segs)
{
Layer *layer;
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
g_return_val_if_fail (segs != NULL, FALSE);
g_return_val_if_fail (n_segs != NULL, FALSE);
/* The second boundary corresponds to the active layer's
* perimeter...
*/
if ((layer = gimage->active_layer))
{
*segs = layer_boundary (layer, num_segs);
*segs = layer_boundary (layer, n_segs);
return TRUE;
}
else
{
*segs = NULL;
*num_segs = 0;
*n_segs = 0;
return FALSE;
}
}
@ -2185,6 +2234,7 @@ gimp_image_set_active_layer (GimpImage *gimage,
Layer *layer)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
g_return_val_if_fail (GIMP_IS_LAYER (layer), NULL);
/* First, find the layer in the gimage
* If it isn't valid, find the first layer that is
@ -2264,16 +2314,16 @@ gimp_image_unset_active_channel (GimpImage *gimage)
void
gimp_image_set_component_active (GimpImage *gimage,
ChannelType type,
gint value)
gboolean active)
{
/* No sanity checking here... */
switch (type)
{
case RED_CHANNEL: gimage->active[RED_PIX] = value; break;
case GREEN_CHANNEL: gimage->active[GREEN_PIX] = value; break;
case BLUE_CHANNEL: gimage->active[BLUE_PIX] = value; break;
case GRAY_CHANNEL: gimage->active[GRAY_PIX] = value; break;
case INDEXED_CHANNEL: gimage->active[INDEXED_PIX] = value; break;
case RED_CHANNEL: gimage->active[RED_PIX] = active; break;
case GREEN_CHANNEL: gimage->active[GREEN_PIX] = active; break;
case BLUE_CHANNEL: gimage->active[BLUE_PIX] = active; break;
case GRAY_CHANNEL: gimage->active[GRAY_PIX] = active; break;
case INDEXED_CHANNEL: gimage->active[INDEXED_PIX] = active; break;
case AUXILLARY_CHANNEL: break;
}
@ -2287,24 +2337,24 @@ gimp_image_set_component_active (GimpImage *gimage,
void
gimp_image_set_component_visible (GimpImage *gimage,
ChannelType type,
gint value)
gboolean visible)
{
/* No sanity checking here... */
switch (type)
{
case RED_CHANNEL: gimage->visible[RED_PIX] = value; break;
case GREEN_CHANNEL: gimage->visible[GREEN_PIX] = value; break;
case BLUE_CHANNEL: gimage->visible[BLUE_PIX] = value; break;
case GRAY_CHANNEL: gimage->visible[GRAY_PIX] = value; break;
case INDEXED_CHANNEL: gimage->visible[INDEXED_PIX] = value; break;
case RED_CHANNEL: gimage->visible[RED_PIX] = visible; break;
case GREEN_CHANNEL: gimage->visible[GREEN_PIX] = visible; break;
case BLUE_CHANNEL: gimage->visible[BLUE_PIX] = visible; break;
case GRAY_CHANNEL: gimage->visible[GRAY_PIX] = visible; break;
case INDEXED_CHANNEL: gimage->visible[INDEXED_PIX] = visible; break;
default: break;
}
}
Layer *
gimp_image_pick_correlate_layer (GimpImage *gimage,
gint x,
gint y)
gimp_image_pick_correlate_layer (const GimpImage *gimage,
gint x,
gint y)
{
Layer *layer;
GSList *list;
@ -2322,8 +2372,6 @@ gimp_image_pick_correlate_layer (GimpImage *gimage,
return NULL;
}
Layer *
gimp_image_raise_layer (GimpImage *gimage,
Layer *layer_arg)
@ -2763,7 +2811,7 @@ gimp_image_merge_layers (GimpImage *gimage,
}
merge_layer = layer_new (gimage, (x2 - x1), (y2 - y1),
type, drawable_get_name (GIMP_DRAWABLE(layer)),
type, drawable_get_name (GIMP_DRAWABLE (layer)),
OPAQUE_OPACITY, NORMAL_MODE);
if (!merge_layer)
{
@ -3009,12 +3057,18 @@ gimp_image_add_layer (GimpImage *gimage,
position = 1;
gimage->layers =
g_slist_insert (gimage->layers, layer_ref (float_layer), position);
g_slist_insert (gimage->layers, float_layer, position);
gtk_object_ref (GTK_OBJECT (float_layer));
gtk_object_sink (GTK_OBJECT (float_layer));
}
else
{
gimage->layers =
g_slist_prepend (gimage->layers, layer_ref (float_layer));
g_slist_prepend (gimage->layers, float_layer);
gtk_object_ref (GTK_OBJECT (float_layer));
gtk_object_sink (GTK_OBJECT (float_layer));
}
gimage->layer_stack = g_slist_prepend (gimage->layer_stack, float_layer);
@ -3374,7 +3428,10 @@ gimp_image_add_channel (GimpImage *gimage,
undo_push_channel (gimage, CHANNEL_ADD_UNDO, cu);
/* add the channel to the list */
gimage->channels = g_slist_prepend (gimage->channels, channel_ref (channel));
gimage->channels = g_slist_prepend (gimage->channels, channel);
gtk_object_ref (GTK_OBJECT (channel));
gtk_object_sink (GTK_OBJECT (channel));
/* notify this gimage of the currently active channel */
gimp_image_set_active_channel (gimage, channel);
@ -3419,9 +3476,9 @@ gimp_image_remove_channel (GimpImage *gimage,
0, 0,
drawable_width (GIMP_DRAWABLE(channel)),
drawable_height (GIMP_DRAWABLE(channel)));
/* Send out REMOVED signal from channel */
channel_removed (channel, gimage);
channel_removed (channel);
/* Important to push the undo here in case the push fails */
undo_push_channel (gimage, CHANNEL_REMOVE_UNDO, cu);
@ -3434,48 +3491,55 @@ gimp_image_remove_channel (GimpImage *gimage,
/************************************************************/
gboolean
gimp_image_is_empty (GimpImage *gimage)
gimp_image_is_empty (const GimpImage *gimage)
{
g_return_val_if_fail (gimage != NULL, TRUE);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), TRUE);
return (! gimage->layers);
return ! gimage->layers;
}
GimpDrawable *
gimp_image_active_drawable (GimpImage *gimage)
gimp_image_active_drawable (const GimpImage *gimage)
{
Layer *layer;
g_return_val_if_fail (gimage != NULL, NULL);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
/* If there is an active channel (a saved selection, etc.),
* we ignore the active layer
*/
if (gimage->active_channel != NULL)
return GIMP_DRAWABLE (gimage->active_channel);
{
return GIMP_DRAWABLE (gimage->active_channel);
}
else if (gimage->active_layer != NULL)
{
layer = gimage->active_layer;
if (layer->mask && layer->edit_mask)
return GIMP_DRAWABLE(layer->mask);
return GIMP_DRAWABLE (layer->mask);
else
return GIMP_DRAWABLE(layer);
return GIMP_DRAWABLE (layer);
}
else
return NULL;
return NULL;
}
GimpImageBaseType
gimp_image_base_type (GimpImage *gimage)
{
gimp_image_base_type (const GimpImage *gimage)
{
g_return_val_if_fail (gimage != NULL, -1);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), -1);
return gimage->base_type;
}
GimpImageType
gimp_image_base_type_with_alpha (GimpImage *gimage)
gimp_image_base_type_with_alpha (const GimpImage *gimage)
{
g_return_val_if_fail (gimage != NULL, -1);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), -1);
switch (gimage->base_type)
@ -3490,9 +3554,10 @@ gimp_image_base_type_with_alpha (GimpImage *gimage)
return RGB_GIMAGE;
}
gchar *
gimp_image_filename (GimpImage *gimage)
const gchar *
gimp_image_filename (const GimpImage *gimage)
{
g_return_val_if_fail (gimage != NULL, NULL);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
if (gimage->has_filename)
@ -3502,7 +3567,7 @@ gimp_image_filename (GimpImage *gimage)
}
gboolean
gimp_image_undo_is_enabled (GimpImage *gimage)
gimp_image_undo_is_enabled (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
@ -3550,7 +3615,7 @@ gimp_image_undo_enable (GimpImage *gimage)
void
gimp_image_undo_event (GimpImage *gimage,
int event)
gint event)
{
gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[UNDO_EVENT], event);
}
@ -3592,10 +3657,10 @@ gimp_image_dirty (GimpImage *gimage)
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
gimage->dirty++;
gtk_signal_emit(GTK_OBJECT(gimage), gimp_image_signals[DIRTY]);
gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[DIRTY]);
TRC (("dirty %d -> %d\n", gimage->dirty-1, gimage->dirty));
return gimage->dirty;
}
@ -3605,7 +3670,7 @@ gimp_image_clean (GimpImage *gimage)
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
gimage->dirty--;
gtk_signal_emit(GTK_OBJECT(gimage), gimp_image_signals[CLEAN]);
gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[CLEAN]);
TRC (("clean %d -> %d\n", gimage->dirty+1, gimage->dirty));
@ -3619,11 +3684,11 @@ gimp_image_clean_all (GimpImage *gimage)
gimage->dirty = 0;
gtk_signal_emit (GTK_OBJECT(gimage), gimp_image_signals[CLEAN]);
gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[CLEAN]);
}
Layer *
gimp_image_floating_sel (GimpImage *gimage)
gimp_image_floating_sel (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
@ -3634,7 +3699,7 @@ gimp_image_floating_sel (GimpImage *gimage)
}
guchar *
gimp_image_cmap (GimpImage *gimage)
gimp_image_cmap (const GimpImage *gimage)
{
return drawable_cmap (gimp_image_active_drawable (gimage));
}
@ -3651,13 +3716,15 @@ gimp_image_projection (GimpImage *gimage)
if ((gimage->projection == NULL) ||
(tile_manager_level_width (gimage->projection) != gimage->width) ||
(tile_manager_level_height (gimage->projection) != gimage->height))
gimp_image_allocate_projection (gimage);
{
gimp_image_allocate_projection (gimage);
}
return gimage->projection;
}
GimpImageType
gimp_image_projection_type (GimpImage *gimage)
gimp_image_projection_type (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), -1);
@ -3665,7 +3732,7 @@ gimp_image_projection_type (GimpImage *gimage)
}
gint
gimp_image_projection_bytes (GimpImage *gimage)
gimp_image_projection_bytes (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), -1);
@ -3673,7 +3740,7 @@ gimp_image_projection_bytes (GimpImage *gimage)
}
gint
gimp_image_projection_opacity (GimpImage *gimage)
gimp_image_projection_opacity (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), -1);
@ -3697,13 +3764,13 @@ gimp_image_composite (GimpImage *gimage)
}
GimpImageType
gimp_image_composite_type (GimpImage *gimage)
gimp_image_composite_type (const GimpImage *gimage)
{
return gimp_image_projection_type (gimage);
}
gint
gimp_image_composite_bytes (GimpImage *gimage)
gimp_image_composite_bytes (const GimpImage *gimage)
{
return gimp_image_projection_bytes (gimage);
}
@ -3913,8 +3980,8 @@ gimp_image_composite_preview (GimpImage *gimage,
}
gboolean
gimp_image_preview_valid (GimpImage *gimage,
ChannelType type)
gimp_image_preview_valid (const GimpImage *gimage,
ChannelType type)
{
switch (type)
{

View File

@ -88,10 +88,10 @@ typedef enum
struct _Guide
{
int ref_count;
int position;
int orientation;
guint32 guide_ID;
gint ref_count;
gint position;
InternalOrientationType orientation;
guint32 guide_ID;
};
@ -105,76 +105,103 @@ typedef struct _GimpImageRepaintArg
} GimpImageRepaintArg;
GtkType gimp_image_get_type (void);
/* function declarations */
GimpImage * gimp_image_new (gint, gint,
GimpImageBaseType);
void gimp_image_set_filename (GimpImage *, gchar *);
void gimp_image_set_resolution (GimpImage *,
gdouble, gdouble);
void gimp_image_get_resolution (GimpImage *,
gdouble *, gdouble *);
void gimp_image_set_unit (GimpImage *, GimpUnit);
GimpUnit gimp_image_get_unit (GimpImage *);
void gimp_image_set_save_proc (GimpImage *,
PlugInProcDef *);
PlugInProcDef * gimp_image_get_save_proc (GimpImage *);
gint gimp_image_get_width (const GimpImage *);
gint gimp_image_get_height (const GimpImage *);
void gimp_image_resize (GimpImage *,
gint, gint, gint, gint);
void gimp_image_scale (GimpImage *, gint, gint);
GimpImage * gimp_image_get_named (gchar *);
GimpImage * gimp_image_get_ID (gint);
TileManager * gimp_image_shadow (GimpImage *,
gint, gint, gint);
void gimp_image_free_shadow (GimpImage *);
void gimp_image_apply_image (GimpImage *, GimpDrawable *,
PixelRegion *, gint,
gint,
LayerModeEffects,
TileManager *, gint, gint);
void gimp_image_replace_image (GimpImage *, GimpDrawable *,
PixelRegion *, gint, gint,
PixelRegion *, gint, gint);
void gimp_image_get_foreground (GimpImage *, GimpDrawable *,
guchar *);
void gimp_image_get_background (GimpImage *, GimpDrawable *,
guchar *);
guchar * gimp_image_get_color_at (GimpImage *, gint, gint);
void gimp_image_get_color (GimpImage *,
GimpImageType,
guchar *,
guchar *);
void gimp_image_transform_color (GimpImage *,
GimpDrawable *,
guchar *,
guchar *,
GimpImageBaseType);
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 *);
GtkType gimp_image_get_type (void);
GimpParasite * gimp_image_parasite_find (const GimpImage *,
const gchar *name);
gchar ** gimp_image_parasite_list (GimpImage *gimage,
gint *count);
void gimp_image_parasite_attach (GimpImage *,
GimpParasite *);
void gimp_image_parasite_detach (GimpImage *, const gchar *);
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);
Tattoo gimp_image_get_new_tattoo (GimpImage *);
gboolean gimp_image_set_tattoo_state (GimpImage *, Tattoo);
Tattoo gimp_image_get_tattoo_state (GimpImage *);
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);
void gimp_image_set_paths (GimpImage *, PathList *);
PathList * gimp_image_get_paths (GimpImage *);
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);
/* Temporary hack till colormap manipulation is encapsulated in functions.
Call this whenever you modify an image's colormap. The ncol argument
@ -182,115 +209,169 @@ PathList * gimp_image_get_paths (GimpImage *);
Currently, use this also when the image's base type is changed to/from
indexed. */
void gimp_image_colormap_changed (GimpImage * image,
gint ncol);
void gimp_image_colormap_changed (const GimpImage *image,
gint col);
/* layer/channel functions */
gint gimp_image_get_layer_index (GimpImage *, Layer *);
Layer * gimp_image_get_layer_by_index (GimpImage *, gint);
gint gimp_image_get_channel_index (GimpImage *, Channel *);
Layer * gimp_image_get_active_layer (GimpImage *);
Channel * gimp_image_get_active_channel (GimpImage *);
Layer * gimp_image_get_layer_by_tattoo (GimpImage *, Tattoo);
Channel * gimp_image_get_channel_by_tattoo (GimpImage *, Tattoo);
Channel * gimp_image_get_channel_by_name (GimpImage *, gchar *);
Channel * gimp_image_get_mask (GimpImage *);
gint gimp_image_get_component_active (GimpImage *, ChannelType);
gint gimp_image_get_component_visible (GimpImage *, ChannelType);
gboolean gimp_image_layer_boundary (GimpImage *, BoundSeg **,
gint *);
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,
gint);
void gimp_image_set_component_visible (GimpImage *, ChannelType,
gint);
Layer * gimp_image_pick_correlate_layer (GimpImage *, gint, gint);
void gimp_image_set_layer_mask_apply (GimpImage *, gint);
void gimp_image_set_layer_mask_edit (GimpImage *, Layer *, gint);
void gimp_image_set_layer_mask_show (GimpImage *, gint);
Layer * gimp_image_raise_layer (GimpImage *, Layer *);
Layer * gimp_image_lower_layer (GimpImage *, Layer *);
Layer * gimp_image_raise_layer_to_top (GimpImage *, Layer *);
Layer * gimp_image_lower_layer_to_bottom (GimpImage *, Layer *);
Layer * gimp_image_position_layer (GimpImage *, Layer *,
gint, gboolean);
Layer * gimp_image_merge_visible_layers (GimpImage *, MergeType);
Layer * gimp_image_merge_down (GimpImage *, Layer *,
MergeType);
Layer * gimp_image_flatten (GimpImage *);
Layer * gimp_image_merge_layers (GimpImage *, GSList *,
MergeType);
Layer * gimp_image_add_layer (GimpImage *, Layer *, gint);
Layer * gimp_image_remove_layer (GimpImage *, Layer *);
LayerMask * gimp_image_add_layer_mask (GimpImage *, Layer *,
LayerMask *);
Channel * gimp_image_remove_layer_mask (GimpImage *, Layer *,
MaskApplyMode);
Channel * gimp_image_raise_channel (GimpImage *, Channel *);
Channel * gimp_image_lower_channel (GimpImage *, Channel *);
Channel * gimp_image_position_channel (GimpImage *, Channel *, gint);
Channel * gimp_image_add_channel (GimpImage *, Channel *, gint);
Channel * gimp_image_remove_channel (GimpImage *, Channel *);
void gimp_image_construct (GimpImage *,
gint, gint, gint, gint,
gboolean);
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 *, gint, gint,
gint, gint, gint,
gint, gint, gint);
void gimp_image_invalidate (GimpImage *, gint, gint,
gint, gint, gint,
gint, gint, gint);
void gimp_image_validate (TileManager *, Tile *);
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);
/* Access functions */
gboolean gimp_image_is_empty (GimpImage *);
GimpDrawable * gimp_image_active_drawable (GimpImage *);
gboolean gimp_image_is_empty (const GimpImage *gimage);
GimpDrawable * gimp_image_active_drawable (const GimpImage *gimage);
GimpImageBaseType gimp_image_base_type (GimpImage *gimage);
GimpImageType gimp_image_base_type_with_alpha (GimpImage *gimage);
GimpImageBaseType gimp_image_base_type (const GimpImage *gimage);
GimpImageType gimp_image_base_type_with_alpha (const GimpImage *gimage);
gchar * gimp_image_filename (GimpImage *);
gboolean gimp_image_undo_is_enabled (GimpImage *);
gboolean gimp_image_undo_enable (GimpImage *);
gboolean gimp_image_undo_disable (GimpImage *);
gboolean gimp_image_undo_freeze (GimpImage *);
gboolean gimp_image_undo_thaw (GimpImage *);
void gimp_image_undo_event (GimpImage *, gint);
gint gimp_image_dirty (GimpImage *);
gint gimp_image_clean (GimpImage *);
void gimp_image_clean_all (GimpImage *);
Layer * gimp_image_floating_sel (GimpImage *);
guchar * gimp_image_cmap (GimpImage *);
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);
/* projection access functions */
TileManager * gimp_image_projection (GimpImage *);
GimpImageType gimp_image_projection_type (GimpImage *);
gint gimp_image_projection_bytes (GimpImage *);
gint gimp_image_projection_opacity (GimpImage *);
void gimp_image_projection_realloc (GimpImage *);
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);
/* composite access functions */
TileManager * gimp_image_composite (GimpImage *);
GimpImageType gimp_image_composite_type (GimpImage *);
gint gimp_image_composite_bytes (GimpImage *);
TempBuf * gimp_image_composite_preview (GimpImage *, ChannelType,
gint, gint);
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);
gint gimp_image_preview_valid (GimpImage *, ChannelType);
void gimp_image_invalidate_preview (GimpImage *);
gint gimp_image_preview_valid (const GimpImage *gimage,
ChannelType type);
void gimp_image_invalidate_preview (GimpImage *gimage);
void gimp_image_invalidate_previews (void);
void gimp_image_invalidate_previews (void);
TempBuf * gimp_image_construct_composite_preview (GimpImage *,
gint , gint);
TempBuf * gimp_image_construct_composite_preview (GimpImage *gimage,
gint width,
gint height);
#endif /* __GIMPIMAGE_H__ */

View File

@ -54,21 +54,21 @@ enum
LAST_SIGNAL
};
static void gimp_layer_class_init (GimpLayerClass *klass);
static void gimp_layer_init (GimpLayer *layer);
static void gimp_layer_destroy (GtkObject *object);
static void layer_invalidate_preview (GtkObject *object);
static void gimp_layer_class_init (GimpLayerClass *klass);
static void gimp_layer_init (GimpLayer *layer);
static void gimp_layer_destroy (GtkObject *object);
static void layer_invalidate_preview (GimpDrawable *object);
static void gimp_layer_mask_class_init (GimpLayerMaskClass *klass);
static void gimp_layer_mask_init (GimpLayerMask *layermask);
static void gimp_layer_mask_destroy (GtkObject *object);
static void gimp_layer_mask_class_init (GimpLayerMaskClass *klass);
static void gimp_layer_mask_init (GimpLayerMask *layermask);
static void gimp_layer_mask_destroy (GtkObject *object);
static TempBuf * layer_preview_private (Layer *layer,
gint width,
gint height);
static TempBuf * layer_mask_preview_private (Layer *layer,
gint width,
gint height);
static TempBuf * layer_preview_private (Layer *layer,
gint width,
gint height);
static TempBuf * layer_mask_preview_private (Layer *layer,
gint width,
gint height);
static guint layer_signals[LAST_SIGNAL] = { 0 };
@ -77,7 +77,7 @@ static guint layer_signals[LAST_SIGNAL] = { 0 };
static guint layer_mask_signals[LAST_SIGNAL] = { 0 };
*/
static GimpDrawableClass *layer_parent_class = NULL;
static GimpDrawableClass *layer_parent_class = NULL;
static GimpChannelClass *layer_mask_parent_class = NULL;
GtkType
@ -99,22 +99,22 @@ gimp_layer_get_type (void)
(GtkClassInitFunc) NULL,
};
layer_type = gtk_type_unique (gimp_drawable_get_type (), &layer_info);
layer_type = gtk_type_unique (GIMP_TYPE_DRAWABLE, &layer_info);
}
return layer_type;
}
static void
gimp_layer_class_init (GimpLayerClass *class)
gimp_layer_class_init (GimpLayerClass *klass)
{
GtkObjectClass *object_class;
GimpDrawableClass *drawable_class;
object_class = (GtkObjectClass*) class;
drawable_class = (GimpDrawableClass*) class;
object_class = (GtkObjectClass *) klass;
drawable_class = (GimpDrawableClass *) klass;
layer_parent_class = gtk_type_class (gimp_drawable_get_type ());
layer_parent_class = gtk_type_class (GIMP_TYPE_DRAWABLE);
layer_signals[REMOVED] =
gimp_signal_new ("removed",
@ -123,7 +123,10 @@ gimp_layer_class_init (GimpLayerClass *class)
gtk_object_class_add_signals (object_class, layer_signals, LAST_SIGNAL);
object_class->destroy = gimp_layer_destroy;
drawable_class->invalidate_preview = layer_invalidate_preview;
klass->removed = NULL;
}
static void
@ -201,14 +204,14 @@ gint layer_get_count = 0;
/********************************/
static void
layer_invalidate_preview (GtkObject *object)
layer_invalidate_preview (GimpDrawable *drawable)
{
GimpLayer *layer;
g_return_if_fail (object != NULL);
g_return_if_fail (GIMP_IS_LAYER (object));
g_return_if_fail (drawable != NULL);
g_return_if_fail (GIMP_IS_LAYER (drawable));
layer = GIMP_LAYER (object);
layer = GIMP_LAYER (drawable);
if (layer_is_floating_sel (layer))
floating_sel_invalidate (layer);
@ -261,7 +264,7 @@ layer_new (GimpImage *gimage,
gint width,
gint height,
GimpImageType type,
gchar *name,
const gchar *name,
gint opacity,
LayerModeEffects mode)
{
@ -301,21 +304,6 @@ layer_new (GimpImage *gimage,
return layer;
}
Layer *
layer_ref (Layer *layer)
{
gtk_object_ref (GTK_OBJECT (layer));
gtk_object_sink (GTK_OBJECT (layer));
return layer;
}
void
layer_unref (Layer *layer)
{
gtk_object_unref (GTK_OBJECT (layer));
}
Layer *
layer_copy (Layer *layer,
gboolean add_alpha)
@ -325,7 +313,7 @@ layer_copy (Layer *layer,
GimpImageType new_type;
gchar *ext;
gint number;
gchar *name;
const gchar *name;
gint len;
PixelRegion srcPR;
PixelRegion destPR;
@ -1281,14 +1269,14 @@ layer_pick_correlate (Layer *layer,
/**********************/
void
layer_set_name (Layer *layer,
gchar *name)
layer_set_name (Layer *layer,
const gchar *name)
{
gimp_drawable_set_name (GIMP_DRAWABLE (layer), name);
}
gchar *
layer_get_name (Layer *layer)
const gchar *
layer_get_name (const Layer *layer)
{
return gimp_drawable_get_name (GIMP_DRAWABLE (layer));
}
@ -1531,12 +1519,12 @@ layer_mask_preview_private (Layer *layer,
Tattoo
layer_get_tattoo (const Layer *layer)
{
return (gimp_drawable_get_tattoo (GIMP_DRAWABLE (layer)));
return gimp_drawable_get_tattoo (GIMP_DRAWABLE (layer));
}
void
layer_set_tattoo (const Layer *layer,
Tattoo value)
layer_set_tattoo (Layer *layer,
Tattoo value)
{
gimp_drawable_set_tattoo (GIMP_DRAWABLE (layer), value);
}

View File

@ -71,19 +71,17 @@ struct _fs_to_layer_undo
/* function declarations */
Layer * layer_new (GimpImage *gimage,
gint width,
gint height,
GimpImageType type,
gchar *name,
gint opacity,
LayerModeEffects mode);
Layer * layer_copy (Layer *layer,
gboolean add_alpha);
Layer * layer_ref (Layer *layer);
void layer_unref (Layer *layer);
Layer * layer_new (GimpImage *gimage,
gint width,
gint height,
GimpImageType type,
const gchar *name,
gint opacity,
LayerModeEffects mode);
Layer * layer_copy (Layer *layer,
gboolean add_alpha);
Layer * layer_new_from_tiles (GimpImage *gimage,
Layer * layer_new_from_tiles (GimpImage *gimage,
GimpImageType layer_type,
TileManager *tiles,
gchar *name,
@ -92,11 +90,11 @@ Layer * layer_new_from_tiles (GimpImage *gimage,
gboolean layer_check_scaling (Layer *layer,
gint new_width,
gint new_height);
LayerMask * layer_create_mask (Layer *layer,
LayerMask * layer_create_mask (Layer *layer,
AddMaskType add_mask_type);
LayerMask * layer_add_mask (Layer *layer,
LayerMask * layer_add_mask (Layer *layer,
LayerMask *mask);
Layer * layer_get_ID (gint ID);
Layer * layer_get_ID (gint ID);
void layer_delete (Layer *layer);
void layer_removed (Layer *layer,
gpointer data);
@ -119,49 +117,49 @@ void layer_resize (Layer *layer,
gint offx,
gint offy);
void layer_resize_to_image (Layer *layer);
BoundSeg * layer_boundary (Layer *layer,
BoundSeg * layer_boundary (Layer *layer,
gint *num_segs);
void layer_invalidate_boundary (Layer *layer);
gint layer_pick_correlate (Layer *layer,
gint x,
gint y);
LayerMask * layer_mask_new (GimpImage *gimage,
gint width,
gint height,
gchar *name,
gint opacity,
guchar *col);
LayerMask * layer_mask_copy (LayerMask *layer_mask);
void layer_mask_delete (LayerMask *layer_mask);
LayerMask * layer_mask_get_ID (gint ID);
LayerMask * layer_mask_ref (LayerMask *layer_mask);
void layer_mask_unref (LayerMask *layer_mask);
void layer_mask_set_layer (LayerMask *layer_mask,
Layer *layer);
Layer * layer_mask_get_layer (LayerMask *layer_mask);
LayerMask * layer_mask_new (GimpImage *gimage,
gint width,
gint height,
gchar *name,
gint opacity,
guchar *col);
LayerMask * layer_mask_copy (LayerMask *layer_mask);
void layer_mask_delete (LayerMask *layer_mask);
LayerMask * layer_mask_get_ID (gint ID);
LayerMask * layer_mask_ref (LayerMask *layer_mask);
void layer_mask_unref (LayerMask *layer_mask);
void layer_mask_set_layer (LayerMask *layer_mask,
Layer *layer);
Layer * layer_mask_get_layer (LayerMask *layer_mask);
/* access functions */
void layer_set_name (Layer *layer,
gchar *name);
gchar * layer_get_name (Layer *layer);
guchar * layer_data (Layer *layer);
LayerMask * layer_get_mask (Layer *layer);
gboolean layer_has_alpha (Layer *layer);
gboolean layer_is_floating_sel (Layer *layer);
gboolean layer_linked (Layer *layer);
TempBuf * layer_preview (Layer *layer,
gint width,
gint height);
TempBuf * layer_mask_preview (Layer *layer,
gint width,
gint height);
void layer_set_name (Layer *layer,
const gchar *name);
const gchar * layer_get_name (const Layer *layer);
guchar * layer_data (Layer *layer);
LayerMask * layer_get_mask (Layer *layer);
gboolean layer_has_alpha (Layer *layer);
gboolean layer_is_floating_sel (Layer *layer);
gboolean layer_linked (Layer *layer);
TempBuf * layer_preview (Layer *layer,
gint width,
gint height);
TempBuf * layer_mask_preview (Layer *layer,
gint width,
gint height);
void layer_invalidate_previews (GimpImage *gimage);
Tattoo layer_get_tattoo (const Layer *layer);
void layer_set_tattoo (const Layer *layer,
Tattoo value);
void layer_invalidate_previews (GimpImage *gimage);
Tattoo layer_get_tattoo (const Layer *layer);
void layer_set_tattoo (Layer *layer,
Tattoo value);
#define drawable_layer GIMP_IS_LAYER
#define drawable_layer_mask GIMP_IS_LAYER_MASK

View File

@ -59,28 +59,58 @@
/* Local function declarations */
static void gimp_image_destroy (GtkObject *object);
static void gimp_image_free_projection (GimpImage *);
static void gimp_image_allocate_shadow (GimpImage *, gint, gint, gint);
static void gimp_image_allocate_projection (GimpImage *);
static void gimp_image_free_layers (GimpImage *);
static void gimp_image_free_channels (GimpImage *);
static void gimp_image_construct_layers (GimpImage *, gint, gint, gint, gint);
static void gimp_image_construct_channels (GimpImage *, gint, gint, gint, gint);
static void gimp_image_initialize_projection (GimpImage *, gint, gint, gint, gint);
static void gimp_image_get_active_channels (GimpImage *, GimpDrawable *, gint *);
static void gimp_image_destroy (GtkObject *object);
static void gimp_image_free_projection (GimpImage *gimage);
static void gimp_image_allocate_shadow (GimpImage *gimage,
gint width,
gint height,
gint bpp);
static void gimp_image_allocate_projection (GimpImage *gimage);
static void gimp_image_free_layers (GimpImage *gimage);
static void gimp_image_free_channels (GimpImage *gimage);
static void gimp_image_construct_layers (GimpImage *gimage,
gint x,
gint y,
gint w,
gint h);
static void gimp_image_construct_channels (GimpImage *gimage,
gint x,
gint y,
gint w,
gint h);
static void gimp_image_initialize_projection (GimpImage *gimage,
gint x,
gint y,
gint w,
gint h);
static void gimp_image_get_active_channels (GimpImage *gimage,
GimpDrawable *drawable,
gint *active);
/* projection functions */
static void project_intensity (GimpImage *, Layer *,
PixelRegion *, PixelRegion *,
PixelRegion *);
static void project_intensity_alpha (GimpImage *, Layer *,
PixelRegion *, PixelRegion *,
PixelRegion *);
static void project_indexed (GimpImage *, Layer *,
PixelRegion *, PixelRegion *);
static void project_channel (GimpImage *, Channel *,
PixelRegion *, PixelRegion *);
static void project_intensity (GimpImage *gimage,
Layer *layer,
PixelRegion *src,
PixelRegion *dest,
PixelRegion *mask);
static void project_intensity_alpha (GimpImage *gimage,
Layer *layer,
PixelRegion *src,
PixelRegion *dest,
PixelRegion *mask);
static void project_indexed (GimpImage *gimage,
Layer *layer,
PixelRegion *src,
PixelRegion *dest);
static void project_indexed_alpha (GimpImage *gimage,
Layer *layer,
PixelRegion *src,
PixelRegion *dest,
PixelRegion *mask);
static void project_channel (GimpImage *gimage,
Channel *layer,
PixelRegion *src,
PixelRegion *src2);
/*
* Global variables
@ -108,7 +138,8 @@ guint32 next_guide_id = 1; /* For generating guide_ID handles for PDB stuff */
* Static variables
*/
enum {
enum
{
CLEAN,
DIRTY,
REPAINT,
@ -120,8 +151,9 @@ enum {
LAST_SIGNAL
};
static guint gimp_image_signals[LAST_SIGNAL];
static GimpObjectClass *parent_class;
static guint gimp_image_signals[LAST_SIGNAL] = { 0 };
static GimpObjectClass *parent_class = NULL;
static void
@ -129,13 +161,11 @@ gimp_image_class_init (GimpImageClass *klass)
{
GtkObjectClass *object_class;
GtkType type;
object_class = GTK_OBJECT_CLASS(klass);
parent_class = gtk_type_class (gimp_object_get_type ());
type=object_class->type;
object_class->destroy = gimp_image_destroy;
object_class = GTK_OBJECT_CLASS (klass);
parent_class = gtk_type_class (gimp_object_get_type ());
type = object_class->type;
gimp_image_signals[CLEAN] =
gimp_signal_new ("clean", GTK_RUN_FIRST, type, 0,
@ -163,6 +193,17 @@ gimp_image_class_init (GimpImageClass *klass)
gimp_sigtype_int);
gtk_object_class_add_signals (object_class, gimp_image_signals, LAST_SIGNAL);
object_class->destroy = gimp_image_destroy;
klass->clean = NULL;
klass->dirty = NULL;
klass->repaint = NULL;
klass->rename = NULL;
klass->resize = NULL;
klass->restructure = NULL;
klass->colormap_changed = NULL;
klass->undo_event = NULL;
}
@ -384,9 +425,9 @@ gimp_image_set_resolution (GimpImage *gimage,
}
void
gimp_image_get_resolution (GimpImage *gimage,
gdouble *xresolution,
gdouble *yresolution)
gimp_image_get_resolution (const GimpImage *gimage,
gdouble *xresolution,
gdouble *yresolution)
{
g_return_if_fail (xresolution && yresolution);
@ -404,7 +445,7 @@ gimp_image_set_unit (GimpImage *gimage,
}
GimpUnit
gimp_image_get_unit (GimpImage *gimage)
gimp_image_get_unit (const GimpImage *gimage)
{
return gimage->unit;
}
@ -417,11 +458,23 @@ gimp_image_set_save_proc (GimpImage *gimage,
}
PlugInProcDef *
gimp_image_get_save_proc (GimpImage *gimage)
gimp_image_get_save_proc (const GimpImage *gimage)
{
return gimage->save_proc;
}
gint
gimp_image_get_width (const GimpImage *gimage)
{
return gimage->width;
}
gint
gimp_image_get_height (const GimpImage *gimage)
{
return gimage->height;
}
void
gimp_image_resize (GimpImage *gimage,
gint new_width,
@ -518,18 +571,6 @@ gimp_image_resize (GimpImage *gimage,
gimp_remove_busy_cursors (NULL);
}
gint
gimp_image_get_width (const GimpImage *gimage)
{
return gimage->width;
}
gint
gimp_image_get_height (const GimpImage *gimage)
{
return gimage->height;
}
void
gimp_image_scale (GimpImage *gimage,
gint new_width,
@ -696,7 +737,8 @@ gimp_image_destroy (GtkObject *object)
gimp_image_free_layers (gimage);
gimp_image_free_channels (gimage);
channel_delete (gimage->selection_mask);
gtk_object_unref (GTK_OBJECT (gimage->selection_mask));
if (gimage->comp_preview)
temp_buf_free (gimage->comp_preview);
@ -941,9 +983,9 @@ gimp_image_replace_image (GimpImage *gimage,
/* Get rid of these! A "foreground" is an UI concept.. */
void
gimp_image_get_foreground (GimpImage *gimage,
GimpDrawable *drawable,
guchar *fg)
gimp_image_get_foreground (const GimpImage *gimage,
const GimpDrawable *drawable,
guchar *fg)
{
guchar pfg[3];
@ -954,9 +996,9 @@ gimp_image_get_foreground (GimpImage *gimage,
}
void
gimp_image_get_background (GimpImage *gimage,
GimpDrawable *drawable,
guchar *bg)
gimp_image_get_background (const GimpImage *gimage,
const GimpDrawable *drawable,
guchar *bg)
{
guchar pbg[3];
@ -980,7 +1022,7 @@ gimp_image_get_color_at (GimpImage *gimage,
if (x < 0 || y < 0 || x >= gimage->width || y >= gimage->height)
return NULL;
dest = g_new (unsigned char, 5);
dest = g_new (guchar, 5);
tile = tile_manager_get_tile (gimp_image_composite (gimage), x, y,
TRUE, FALSE);
src = tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT);
@ -998,10 +1040,10 @@ gimp_image_get_color_at (GimpImage *gimage,
}
void
gimp_image_get_color (GimpImage *gimage,
GimpImageType d_type,
guchar *rgb,
guchar *src)
gimp_image_get_color (const GimpImage *gimage,
GimpImageType d_type,
guchar *rgb,
guchar *src)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
@ -1020,17 +1062,17 @@ gimp_image_get_color (GimpImage *gimage,
}
void
gimp_image_transform_color (GimpImage *gimage,
GimpDrawable *drawable,
guchar *src,
guchar *dest,
GimpImageBaseType type)
gimp_image_transform_color (const GimpImage *gimage,
const GimpDrawable *drawable,
guchar *src,
guchar *dest,
GimpImageBaseType type)
{
GimpImageType d_type;
g_return_if_fail (GIMP_IS_IMAGE (gimage));
d_type = (drawable != NULL) ? drawable_type (drawable) :
d_type = (drawable != NULL) ? gimp_drawable_type (drawable) :
gimp_image_base_type_with_alpha (gimage);
switch (type)
@ -1090,7 +1132,7 @@ gimp_image_transform_color (GimpImage *gimage,
}
}
Guide*
Guide *
gimp_image_add_hguide (GimpImage *gimage)
{
Guide *guide;
@ -1108,7 +1150,7 @@ gimp_image_add_hguide (GimpImage *gimage)
return guide;
}
Guide*
Guide *
gimp_image_add_vguide (GimpImage *gimage)
{
Guide *guide;
@ -1178,8 +1220,8 @@ list_func (gchar *key,
}
gchar **
gimp_image_parasite_list (GimpImage *gimage,
gint *count)
gimp_image_parasite_list (const GimpImage *gimage,
gint *count)
{
gchar **list;
gchar **cur;
@ -1242,9 +1284,11 @@ Tattoo
gimp_image_get_new_tattoo (GimpImage *image)
{
image->tattoo_state++;
if (image->tattoo_state <= 0)
g_warning ("Tattoo state has become corrupt (2.1 billion operation limit exceded)");
return (image->tattoo_state);
return image->tattoo_state;
}
Tattoo
@ -1334,18 +1378,6 @@ gimp_image_set_tattoo_state (GimpImage *gimage,
return retval;
}
void
gimp_image_colormap_changed (GimpImage *gimage,
gint col)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (col < gimage->num_cols);
gtk_signal_emit (GTK_OBJECT (gimage),
gimp_image_signals[COLORMAP_CHANGED],
col);
}
void
gimp_image_set_paths (GimpImage *gimage,
PathList *paths)
@ -1356,13 +1388,25 @@ gimp_image_set_paths (GimpImage *gimage,
}
PathList *
gimp_image_get_paths (GimpImage *gimage)
gimp_image_get_paths (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
return gimage->paths;
}
void
gimp_image_colormap_changed (const GimpImage *gimage,
gint col)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (col < gimage->num_cols);
gtk_signal_emit (GTK_OBJECT (gimage),
gimp_image_signals[COLORMAP_CHANGED],
col);
}
/************************************************************/
/* Projection functions */
/************************************************************/
@ -1478,8 +1522,10 @@ gimp_image_free_channels (GimpImage *gimage)
for (list = gimage->channels; list; list = g_slist_next (list))
{
channel = (Channel *) list->data;
channel_delete (channel);
gtk_object_unref (GTK_OBJECT (channel));
}
g_slist_free (gimage->channels);
}
@ -1748,8 +1794,7 @@ gimp_image_construct (GimpImage *gimage,
gint x,
gint y,
gint w,
gint h,
gboolean can_use_cowproject)
gint h)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
@ -1950,8 +1995,7 @@ gimp_image_invalidate (GimpImage *gimage,
if ((endx - startx) > 0 && (endy - starty) > 0)
gimp_image_construct (gimage,
startx, starty,
(endx - startx), (endy - starty),
TRUE);
(endx - startx), (endy - starty));
}
void
@ -1972,12 +2016,12 @@ gimp_image_validate (TileManager *tm,
w = tile_ewidth (tile);
h = tile_eheight (tile);
gimp_image_construct (gimage, x, y, w, h, FALSE);
gimp_image_construct (gimage, x, y, w, h);
}
gint
gimp_image_get_layer_index (GimpImage *gimage,
Layer *layer_arg)
gimp_image_get_layer_index (const GimpImage *gimage,
const Layer *layer_arg)
{
Layer *layer;
GSList *layers;
@ -1990,6 +2034,7 @@ gimp_image_get_layer_index (GimpImage *gimage,
layers = g_slist_next (layers), index++)
{
layer = (Layer *) layers->data;
if (layer == layer_arg)
return index;
}
@ -1998,23 +2043,22 @@ gimp_image_get_layer_index (GimpImage *gimage,
}
Layer *
gimp_image_get_layer_by_index (GimpImage *gimage,
gint layer_index)
gimp_image_get_layer_by_index (const GimpImage *gimage,
gint layer_index)
{
Layer *layer;
g_return_val_if_fail (gimage != NULL, NULL);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
layer =
(Layer *) g_slist_nth_data (gimage->layers, layer_index);
layer = (Layer *) g_slist_nth_data (gimage->layers, layer_index);
return layer;
}
gint
gimp_image_get_channel_index (GimpImage *gimage,
Channel *channel_ID)
gimp_image_get_channel_index (const GimpImage *gimage,
const Channel *channel_arg)
{
Channel *channel;
GSList *channels;
@ -2028,7 +2072,8 @@ gimp_image_get_channel_index (GimpImage *gimage,
channels = g_slist_next (channels), index++)
{
channel = (Channel *) channels->data;
if (channel == channel_ID)
if (channel == channel_arg)
return index;
}
@ -2036,7 +2081,7 @@ gimp_image_get_channel_index (GimpImage *gimage,
}
Layer *
gimp_image_get_active_layer (GimpImage *gimage)
gimp_image_get_active_layer (const GimpImage *gimage)
{
g_return_val_if_fail (gimage != NULL, NULL);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
@ -2045,7 +2090,7 @@ gimp_image_get_active_layer (GimpImage *gimage)
}
Channel *
gimp_image_get_active_channel (GimpImage *gimage)
gimp_image_get_active_channel (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
@ -2053,8 +2098,8 @@ gimp_image_get_active_channel (GimpImage *gimage)
}
Layer *
gimp_image_get_layer_by_tattoo (GimpImage *gimage,
Tattoo tattoo)
gimp_image_get_layer_by_tattoo (const GimpImage *gimage,
Tattoo tattoo)
{
Layer *layer;
GSList *layers;
@ -2066,6 +2111,7 @@ gimp_image_get_layer_by_tattoo (GimpImage *gimage,
layers = g_slist_next (layers))
{
layer = (Layer *) layers->data;
if (layer_get_tattoo (layer) == tattoo)
return layer;
}
@ -2074,8 +2120,8 @@ gimp_image_get_layer_by_tattoo (GimpImage *gimage,
}
Channel *
gimp_image_get_channel_by_tattoo (GimpImage *gimage,
Tattoo tattoo)
gimp_image_get_channel_by_tattoo (const GimpImage *gimage,
Tattoo tattoo)
{
Channel *channel;
GSList *channels;
@ -2087,6 +2133,7 @@ gimp_image_get_channel_by_tattoo (GimpImage *gimage,
channels = g_slist_next (channels))
{
channel = (Channel *) channels->data;
if (channel_get_tattoo (channel) == tattoo)
return channel;
}
@ -2095,8 +2142,8 @@ gimp_image_get_channel_by_tattoo (GimpImage *gimage,
}
Channel *
gimp_image_get_channel_by_name (GimpImage *gimage,
char *name)
gimp_image_get_channel_by_name (const GimpImage *gimage,
const gchar *name)
{
Channel *channel;
GSList *channels;
@ -2108,16 +2155,24 @@ gimp_image_get_channel_by_name (GimpImage *gimage,
channels = g_slist_next (channels))
{
channel = (Channel *) channels->data;
if (! strcmp(channel_get_name (channel),name) )
if (! strcmp (drawable_get_name (GIMP_DRAWABLE (channel)), name))
return channel;
}
return NULL;
}
gint
gimp_image_get_component_active (GimpImage *gimage,
ChannelType type)
Channel *
gimp_image_get_mask (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
return gimage->selection_mask;
}
gboolean
gimp_image_get_component_active (const GimpImage *gimage,
ChannelType type)
{
/* No sanity checking here... */
switch (type)
@ -2131,9 +2186,9 @@ gimp_image_get_component_active (GimpImage *gimage,
}
}
gint
gimp_image_get_component_visible (GimpImage *gimage,
ChannelType type)
gboolean
gimp_image_get_component_visible (const GimpImage *gimage,
ChannelType type)
{
/* No sanity checking here... */
switch (type)
@ -2147,35 +2202,29 @@ gimp_image_get_component_visible (GimpImage *gimage,
}
}
Channel *
gimp_image_get_mask (GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
return gimage->selection_mask;
}
gboolean
gimp_image_layer_boundary (GimpImage *gimage,
BoundSeg **segs,
int *num_segs)
gimp_image_layer_boundary (const GimpImage *gimage,
BoundSeg **segs,
gint *n_segs)
{
Layer *layer;
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
g_return_val_if_fail (segs != NULL, FALSE);
g_return_val_if_fail (n_segs != NULL, FALSE);
/* The second boundary corresponds to the active layer's
* perimeter...
*/
if ((layer = gimage->active_layer))
{
*segs = layer_boundary (layer, num_segs);
*segs = layer_boundary (layer, n_segs);
return TRUE;
}
else
{
*segs = NULL;
*num_segs = 0;
*n_segs = 0;
return FALSE;
}
}
@ -2185,6 +2234,7 @@ gimp_image_set_active_layer (GimpImage *gimage,
Layer *layer)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
g_return_val_if_fail (GIMP_IS_LAYER (layer), NULL);
/* First, find the layer in the gimage
* If it isn't valid, find the first layer that is
@ -2264,16 +2314,16 @@ gimp_image_unset_active_channel (GimpImage *gimage)
void
gimp_image_set_component_active (GimpImage *gimage,
ChannelType type,
gint value)
gboolean active)
{
/* No sanity checking here... */
switch (type)
{
case RED_CHANNEL: gimage->active[RED_PIX] = value; break;
case GREEN_CHANNEL: gimage->active[GREEN_PIX] = value; break;
case BLUE_CHANNEL: gimage->active[BLUE_PIX] = value; break;
case GRAY_CHANNEL: gimage->active[GRAY_PIX] = value; break;
case INDEXED_CHANNEL: gimage->active[INDEXED_PIX] = value; break;
case RED_CHANNEL: gimage->active[RED_PIX] = active; break;
case GREEN_CHANNEL: gimage->active[GREEN_PIX] = active; break;
case BLUE_CHANNEL: gimage->active[BLUE_PIX] = active; break;
case GRAY_CHANNEL: gimage->active[GRAY_PIX] = active; break;
case INDEXED_CHANNEL: gimage->active[INDEXED_PIX] = active; break;
case AUXILLARY_CHANNEL: break;
}
@ -2287,24 +2337,24 @@ gimp_image_set_component_active (GimpImage *gimage,
void
gimp_image_set_component_visible (GimpImage *gimage,
ChannelType type,
gint value)
gboolean visible)
{
/* No sanity checking here... */
switch (type)
{
case RED_CHANNEL: gimage->visible[RED_PIX] = value; break;
case GREEN_CHANNEL: gimage->visible[GREEN_PIX] = value; break;
case BLUE_CHANNEL: gimage->visible[BLUE_PIX] = value; break;
case GRAY_CHANNEL: gimage->visible[GRAY_PIX] = value; break;
case INDEXED_CHANNEL: gimage->visible[INDEXED_PIX] = value; break;
case RED_CHANNEL: gimage->visible[RED_PIX] = visible; break;
case GREEN_CHANNEL: gimage->visible[GREEN_PIX] = visible; break;
case BLUE_CHANNEL: gimage->visible[BLUE_PIX] = visible; break;
case GRAY_CHANNEL: gimage->visible[GRAY_PIX] = visible; break;
case INDEXED_CHANNEL: gimage->visible[INDEXED_PIX] = visible; break;
default: break;
}
}
Layer *
gimp_image_pick_correlate_layer (GimpImage *gimage,
gint x,
gint y)
gimp_image_pick_correlate_layer (const GimpImage *gimage,
gint x,
gint y)
{
Layer *layer;
GSList *list;
@ -2322,8 +2372,6 @@ gimp_image_pick_correlate_layer (GimpImage *gimage,
return NULL;
}
Layer *
gimp_image_raise_layer (GimpImage *gimage,
Layer *layer_arg)
@ -2763,7 +2811,7 @@ gimp_image_merge_layers (GimpImage *gimage,
}
merge_layer = layer_new (gimage, (x2 - x1), (y2 - y1),
type, drawable_get_name (GIMP_DRAWABLE(layer)),
type, drawable_get_name (GIMP_DRAWABLE (layer)),
OPAQUE_OPACITY, NORMAL_MODE);
if (!merge_layer)
{
@ -3009,12 +3057,18 @@ gimp_image_add_layer (GimpImage *gimage,
position = 1;
gimage->layers =
g_slist_insert (gimage->layers, layer_ref (float_layer), position);
g_slist_insert (gimage->layers, float_layer, position);
gtk_object_ref (GTK_OBJECT (float_layer));
gtk_object_sink (GTK_OBJECT (float_layer));
}
else
{
gimage->layers =
g_slist_prepend (gimage->layers, layer_ref (float_layer));
g_slist_prepend (gimage->layers, float_layer);
gtk_object_ref (GTK_OBJECT (float_layer));
gtk_object_sink (GTK_OBJECT (float_layer));
}
gimage->layer_stack = g_slist_prepend (gimage->layer_stack, float_layer);
@ -3374,7 +3428,10 @@ gimp_image_add_channel (GimpImage *gimage,
undo_push_channel (gimage, CHANNEL_ADD_UNDO, cu);
/* add the channel to the list */
gimage->channels = g_slist_prepend (gimage->channels, channel_ref (channel));
gimage->channels = g_slist_prepend (gimage->channels, channel);
gtk_object_ref (GTK_OBJECT (channel));
gtk_object_sink (GTK_OBJECT (channel));
/* notify this gimage of the currently active channel */
gimp_image_set_active_channel (gimage, channel);
@ -3419,9 +3476,9 @@ gimp_image_remove_channel (GimpImage *gimage,
0, 0,
drawable_width (GIMP_DRAWABLE(channel)),
drawable_height (GIMP_DRAWABLE(channel)));
/* Send out REMOVED signal from channel */
channel_removed (channel, gimage);
channel_removed (channel);
/* Important to push the undo here in case the push fails */
undo_push_channel (gimage, CHANNEL_REMOVE_UNDO, cu);
@ -3434,48 +3491,55 @@ gimp_image_remove_channel (GimpImage *gimage,
/************************************************************/
gboolean
gimp_image_is_empty (GimpImage *gimage)
gimp_image_is_empty (const GimpImage *gimage)
{
g_return_val_if_fail (gimage != NULL, TRUE);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), TRUE);
return (! gimage->layers);
return ! gimage->layers;
}
GimpDrawable *
gimp_image_active_drawable (GimpImage *gimage)
gimp_image_active_drawable (const GimpImage *gimage)
{
Layer *layer;
g_return_val_if_fail (gimage != NULL, NULL);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
/* If there is an active channel (a saved selection, etc.),
* we ignore the active layer
*/
if (gimage->active_channel != NULL)
return GIMP_DRAWABLE (gimage->active_channel);
{
return GIMP_DRAWABLE (gimage->active_channel);
}
else if (gimage->active_layer != NULL)
{
layer = gimage->active_layer;
if (layer->mask && layer->edit_mask)
return GIMP_DRAWABLE(layer->mask);
return GIMP_DRAWABLE (layer->mask);
else
return GIMP_DRAWABLE(layer);
return GIMP_DRAWABLE (layer);
}
else
return NULL;
return NULL;
}
GimpImageBaseType
gimp_image_base_type (GimpImage *gimage)
{
gimp_image_base_type (const GimpImage *gimage)
{
g_return_val_if_fail (gimage != NULL, -1);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), -1);
return gimage->base_type;
}
GimpImageType
gimp_image_base_type_with_alpha (GimpImage *gimage)
gimp_image_base_type_with_alpha (const GimpImage *gimage)
{
g_return_val_if_fail (gimage != NULL, -1);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), -1);
switch (gimage->base_type)
@ -3490,9 +3554,10 @@ gimp_image_base_type_with_alpha (GimpImage *gimage)
return RGB_GIMAGE;
}
gchar *
gimp_image_filename (GimpImage *gimage)
const gchar *
gimp_image_filename (const GimpImage *gimage)
{
g_return_val_if_fail (gimage != NULL, NULL);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
if (gimage->has_filename)
@ -3502,7 +3567,7 @@ gimp_image_filename (GimpImage *gimage)
}
gboolean
gimp_image_undo_is_enabled (GimpImage *gimage)
gimp_image_undo_is_enabled (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
@ -3550,7 +3615,7 @@ gimp_image_undo_enable (GimpImage *gimage)
void
gimp_image_undo_event (GimpImage *gimage,
int event)
gint event)
{
gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[UNDO_EVENT], event);
}
@ -3592,10 +3657,10 @@ gimp_image_dirty (GimpImage *gimage)
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
gimage->dirty++;
gtk_signal_emit(GTK_OBJECT(gimage), gimp_image_signals[DIRTY]);
gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[DIRTY]);
TRC (("dirty %d -> %d\n", gimage->dirty-1, gimage->dirty));
return gimage->dirty;
}
@ -3605,7 +3670,7 @@ gimp_image_clean (GimpImage *gimage)
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
gimage->dirty--;
gtk_signal_emit(GTK_OBJECT(gimage), gimp_image_signals[CLEAN]);
gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[CLEAN]);
TRC (("clean %d -> %d\n", gimage->dirty+1, gimage->dirty));
@ -3619,11 +3684,11 @@ gimp_image_clean_all (GimpImage *gimage)
gimage->dirty = 0;
gtk_signal_emit (GTK_OBJECT(gimage), gimp_image_signals[CLEAN]);
gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[CLEAN]);
}
Layer *
gimp_image_floating_sel (GimpImage *gimage)
gimp_image_floating_sel (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
@ -3634,7 +3699,7 @@ gimp_image_floating_sel (GimpImage *gimage)
}
guchar *
gimp_image_cmap (GimpImage *gimage)
gimp_image_cmap (const GimpImage *gimage)
{
return drawable_cmap (gimp_image_active_drawable (gimage));
}
@ -3651,13 +3716,15 @@ gimp_image_projection (GimpImage *gimage)
if ((gimage->projection == NULL) ||
(tile_manager_level_width (gimage->projection) != gimage->width) ||
(tile_manager_level_height (gimage->projection) != gimage->height))
gimp_image_allocate_projection (gimage);
{
gimp_image_allocate_projection (gimage);
}
return gimage->projection;
}
GimpImageType
gimp_image_projection_type (GimpImage *gimage)
gimp_image_projection_type (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), -1);
@ -3665,7 +3732,7 @@ gimp_image_projection_type (GimpImage *gimage)
}
gint
gimp_image_projection_bytes (GimpImage *gimage)
gimp_image_projection_bytes (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), -1);
@ -3673,7 +3740,7 @@ gimp_image_projection_bytes (GimpImage *gimage)
}
gint
gimp_image_projection_opacity (GimpImage *gimage)
gimp_image_projection_opacity (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), -1);
@ -3697,13 +3764,13 @@ gimp_image_composite (GimpImage *gimage)
}
GimpImageType
gimp_image_composite_type (GimpImage *gimage)
gimp_image_composite_type (const GimpImage *gimage)
{
return gimp_image_projection_type (gimage);
}
gint
gimp_image_composite_bytes (GimpImage *gimage)
gimp_image_composite_bytes (const GimpImage *gimage)
{
return gimp_image_projection_bytes (gimage);
}
@ -3913,8 +3980,8 @@ gimp_image_composite_preview (GimpImage *gimage,
}
gboolean
gimp_image_preview_valid (GimpImage *gimage,
ChannelType type)
gimp_image_preview_valid (const GimpImage *gimage,
ChannelType type)
{
switch (type)
{

View File

@ -88,10 +88,10 @@ typedef enum
struct _Guide
{
int ref_count;
int position;
int orientation;
guint32 guide_ID;
gint ref_count;
gint position;
InternalOrientationType orientation;
guint32 guide_ID;
};
@ -105,76 +105,103 @@ typedef struct _GimpImageRepaintArg
} GimpImageRepaintArg;
GtkType gimp_image_get_type (void);
/* function declarations */
GimpImage * gimp_image_new (gint, gint,
GimpImageBaseType);
void gimp_image_set_filename (GimpImage *, gchar *);
void gimp_image_set_resolution (GimpImage *,
gdouble, gdouble);
void gimp_image_get_resolution (GimpImage *,
gdouble *, gdouble *);
void gimp_image_set_unit (GimpImage *, GimpUnit);
GimpUnit gimp_image_get_unit (GimpImage *);
void gimp_image_set_save_proc (GimpImage *,
PlugInProcDef *);
PlugInProcDef * gimp_image_get_save_proc (GimpImage *);
gint gimp_image_get_width (const GimpImage *);
gint gimp_image_get_height (const GimpImage *);
void gimp_image_resize (GimpImage *,
gint, gint, gint, gint);
void gimp_image_scale (GimpImage *, gint, gint);
GimpImage * gimp_image_get_named (gchar *);
GimpImage * gimp_image_get_ID (gint);
TileManager * gimp_image_shadow (GimpImage *,
gint, gint, gint);
void gimp_image_free_shadow (GimpImage *);
void gimp_image_apply_image (GimpImage *, GimpDrawable *,
PixelRegion *, gint,
gint,
LayerModeEffects,
TileManager *, gint, gint);
void gimp_image_replace_image (GimpImage *, GimpDrawable *,
PixelRegion *, gint, gint,
PixelRegion *, gint, gint);
void gimp_image_get_foreground (GimpImage *, GimpDrawable *,
guchar *);
void gimp_image_get_background (GimpImage *, GimpDrawable *,
guchar *);
guchar * gimp_image_get_color_at (GimpImage *, gint, gint);
void gimp_image_get_color (GimpImage *,
GimpImageType,
guchar *,
guchar *);
void gimp_image_transform_color (GimpImage *,
GimpDrawable *,
guchar *,
guchar *,
GimpImageBaseType);
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 *);
GtkType gimp_image_get_type (void);
GimpParasite * gimp_image_parasite_find (const GimpImage *,
const gchar *name);
gchar ** gimp_image_parasite_list (GimpImage *gimage,
gint *count);
void gimp_image_parasite_attach (GimpImage *,
GimpParasite *);
void gimp_image_parasite_detach (GimpImage *, const gchar *);
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);
Tattoo gimp_image_get_new_tattoo (GimpImage *);
gboolean gimp_image_set_tattoo_state (GimpImage *, Tattoo);
Tattoo gimp_image_get_tattoo_state (GimpImage *);
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);
void gimp_image_set_paths (GimpImage *, PathList *);
PathList * gimp_image_get_paths (GimpImage *);
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);
/* Temporary hack till colormap manipulation is encapsulated in functions.
Call this whenever you modify an image's colormap. The ncol argument
@ -182,115 +209,169 @@ PathList * gimp_image_get_paths (GimpImage *);
Currently, use this also when the image's base type is changed to/from
indexed. */
void gimp_image_colormap_changed (GimpImage * image,
gint ncol);
void gimp_image_colormap_changed (const GimpImage *image,
gint col);
/* layer/channel functions */
gint gimp_image_get_layer_index (GimpImage *, Layer *);
Layer * gimp_image_get_layer_by_index (GimpImage *, gint);
gint gimp_image_get_channel_index (GimpImage *, Channel *);
Layer * gimp_image_get_active_layer (GimpImage *);
Channel * gimp_image_get_active_channel (GimpImage *);
Layer * gimp_image_get_layer_by_tattoo (GimpImage *, Tattoo);
Channel * gimp_image_get_channel_by_tattoo (GimpImage *, Tattoo);
Channel * gimp_image_get_channel_by_name (GimpImage *, gchar *);
Channel * gimp_image_get_mask (GimpImage *);
gint gimp_image_get_component_active (GimpImage *, ChannelType);
gint gimp_image_get_component_visible (GimpImage *, ChannelType);
gboolean gimp_image_layer_boundary (GimpImage *, BoundSeg **,
gint *);
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,
gint);
void gimp_image_set_component_visible (GimpImage *, ChannelType,
gint);
Layer * gimp_image_pick_correlate_layer (GimpImage *, gint, gint);
void gimp_image_set_layer_mask_apply (GimpImage *, gint);
void gimp_image_set_layer_mask_edit (GimpImage *, Layer *, gint);
void gimp_image_set_layer_mask_show (GimpImage *, gint);
Layer * gimp_image_raise_layer (GimpImage *, Layer *);
Layer * gimp_image_lower_layer (GimpImage *, Layer *);
Layer * gimp_image_raise_layer_to_top (GimpImage *, Layer *);
Layer * gimp_image_lower_layer_to_bottom (GimpImage *, Layer *);
Layer * gimp_image_position_layer (GimpImage *, Layer *,
gint, gboolean);
Layer * gimp_image_merge_visible_layers (GimpImage *, MergeType);
Layer * gimp_image_merge_down (GimpImage *, Layer *,
MergeType);
Layer * gimp_image_flatten (GimpImage *);
Layer * gimp_image_merge_layers (GimpImage *, GSList *,
MergeType);
Layer * gimp_image_add_layer (GimpImage *, Layer *, gint);
Layer * gimp_image_remove_layer (GimpImage *, Layer *);
LayerMask * gimp_image_add_layer_mask (GimpImage *, Layer *,
LayerMask *);
Channel * gimp_image_remove_layer_mask (GimpImage *, Layer *,
MaskApplyMode);
Channel * gimp_image_raise_channel (GimpImage *, Channel *);
Channel * gimp_image_lower_channel (GimpImage *, Channel *);
Channel * gimp_image_position_channel (GimpImage *, Channel *, gint);
Channel * gimp_image_add_channel (GimpImage *, Channel *, gint);
Channel * gimp_image_remove_channel (GimpImage *, Channel *);
void gimp_image_construct (GimpImage *,
gint, gint, gint, gint,
gboolean);
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 *, gint, gint,
gint, gint, gint,
gint, gint, gint);
void gimp_image_invalidate (GimpImage *, gint, gint,
gint, gint, gint,
gint, gint, gint);
void gimp_image_validate (TileManager *, Tile *);
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);
/* Access functions */
gboolean gimp_image_is_empty (GimpImage *);
GimpDrawable * gimp_image_active_drawable (GimpImage *);
gboolean gimp_image_is_empty (const GimpImage *gimage);
GimpDrawable * gimp_image_active_drawable (const GimpImage *gimage);
GimpImageBaseType gimp_image_base_type (GimpImage *gimage);
GimpImageType gimp_image_base_type_with_alpha (GimpImage *gimage);
GimpImageBaseType gimp_image_base_type (const GimpImage *gimage);
GimpImageType gimp_image_base_type_with_alpha (const GimpImage *gimage);
gchar * gimp_image_filename (GimpImage *);
gboolean gimp_image_undo_is_enabled (GimpImage *);
gboolean gimp_image_undo_enable (GimpImage *);
gboolean gimp_image_undo_disable (GimpImage *);
gboolean gimp_image_undo_freeze (GimpImage *);
gboolean gimp_image_undo_thaw (GimpImage *);
void gimp_image_undo_event (GimpImage *, gint);
gint gimp_image_dirty (GimpImage *);
gint gimp_image_clean (GimpImage *);
void gimp_image_clean_all (GimpImage *);
Layer * gimp_image_floating_sel (GimpImage *);
guchar * gimp_image_cmap (GimpImage *);
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);
/* projection access functions */
TileManager * gimp_image_projection (GimpImage *);
GimpImageType gimp_image_projection_type (GimpImage *);
gint gimp_image_projection_bytes (GimpImage *);
gint gimp_image_projection_opacity (GimpImage *);
void gimp_image_projection_realloc (GimpImage *);
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);
/* composite access functions */
TileManager * gimp_image_composite (GimpImage *);
GimpImageType gimp_image_composite_type (GimpImage *);
gint gimp_image_composite_bytes (GimpImage *);
TempBuf * gimp_image_composite_preview (GimpImage *, ChannelType,
gint, gint);
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);
gint gimp_image_preview_valid (GimpImage *, ChannelType);
void gimp_image_invalidate_preview (GimpImage *);
gint gimp_image_preview_valid (const GimpImage *gimage,
ChannelType type);
void gimp_image_invalidate_preview (GimpImage *gimage);
void gimp_image_invalidate_previews (void);
void gimp_image_invalidate_previews (void);
TempBuf * gimp_image_construct_composite_preview (GimpImage *,
gint , gint);
TempBuf * gimp_image_construct_composite_preview (GimpImage *gimage,
gint width,
gint height);
#endif /* __GIMPIMAGE_H__ */

View File

@ -906,6 +906,7 @@ gdisplay_find_guide (GDisplay *gdisp,
(pos < (y + EPSILON)))
return guide;
break;
case ORIENTATION_VERTICAL:
pos = scalex * guide->position - offset_x;
if ((guide->position != -1) &&
@ -913,6 +914,9 @@ gdisplay_find_guide (GDisplay *gdisp,
(pos < (x + EPSILON)))
return guide;
break;
default:
break;
}
}
}
@ -976,6 +980,7 @@ gdisplay_snap_point (GDisplay *gdisp,
}
}
break;
case ORIENTATION_VERTICAL:
pos = scalex * guide->position - offset_x;
@ -993,6 +998,9 @@ gdisplay_snap_point (GDisplay *gdisp,
}
}
break;
default:
break;
}
}
}
@ -1888,9 +1896,13 @@ gdisplay_expose_guide (GDisplay *gdisp,
case ORIENTATION_HORIZONTAL:
gdisplay_expose_area (gdisp, 0, y, gdisp->disp_width, 1);
break;
case ORIENTATION_VERTICAL:
gdisplay_expose_area (gdisp, x, 0, 1, gdisp->disp_height);
break;
default:
break;
}
}

View File

@ -349,9 +349,9 @@ crop_adjust_guides (GImage *gimage,
int x2, int y2)
{
GList * glist;
Guide * guide;
gint remove_guide;
GList * glist;
Guide * guide;
gboolean remove_guide;
for (glist = gimage->guides; glist; glist = g_list_next (glist))
{
@ -361,14 +361,17 @@ crop_adjust_guides (GImage *gimage,
switch (guide->orientation)
{
case ORIENTATION_HORIZONTAL:
if ((guide->position < y1) ||(guide->position > y2))
if ((guide->position < y1) || (guide->position > y2))
remove_guide = TRUE;
break;
case ORIENTATION_VERTICAL:
if ((guide->position < x1) ||(guide->position > x2))
if ((guide->position < x1) || (guide->position > x2))
remove_guide = TRUE;
break;
default:
break;
}
/* edit the guide */
@ -393,7 +396,6 @@ crop_adjust_guides (GImage *gimage,
}
}
}
static void
crop_motion (Tool *tool,

View File

@ -906,6 +906,7 @@ gdisplay_find_guide (GDisplay *gdisp,
(pos < (y + EPSILON)))
return guide;
break;
case ORIENTATION_VERTICAL:
pos = scalex * guide->position - offset_x;
if ((guide->position != -1) &&
@ -913,6 +914,9 @@ gdisplay_find_guide (GDisplay *gdisp,
(pos < (x + EPSILON)))
return guide;
break;
default:
break;
}
}
}
@ -976,6 +980,7 @@ gdisplay_snap_point (GDisplay *gdisp,
}
}
break;
case ORIENTATION_VERTICAL:
pos = scalex * guide->position - offset_x;
@ -993,6 +998,9 @@ gdisplay_snap_point (GDisplay *gdisp,
}
}
break;
default:
break;
}
}
}
@ -1888,9 +1896,13 @@ gdisplay_expose_guide (GDisplay *gdisp,
case ORIENTATION_HORIZONTAL:
gdisplay_expose_area (gdisp, 0, y, gdisp->disp_width, 1);
break;
case ORIENTATION_VERTICAL:
gdisplay_expose_area (gdisp, x, 0, 1, gdisp->disp_height);
break;
default:
break;
}
}

View File

@ -228,7 +228,7 @@ qmask_activate (GtkWidget *widget,
gmask = channel_copy (gimage_get_mask (gimg));
gimp_image_add_channel (gimg, gmask, 0);
channel_set_color (gmask, color);
channel_set_name (gmask, "Qmask");
drawable_set_name (GIMP_DRAWABLE (gmask), "Qmask");
channel_set_opacity (gmask, opacity);
gimage_mask_none (gimg); /* Clear the selection */
}

View File

@ -15,12 +15,13 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __DRAWABLE_H__
#define __DRAWABLE_H__
#include "gimpdrawable.h"
int drawable_ID (GimpDrawable *);
gint drawable_ID (GimpDrawable *);
void drawable_fill (GimpDrawable *drawable, GimpFillType fill_type);
void drawable_update (GimpDrawable *drawable,
gint x, gint y, gint w, gint h);
@ -31,8 +32,6 @@ void drawable_apply_image (GimpDrawable *, gint, gint, gint, gint,
#define drawable_merge_shadow gimp_drawable_merge_shadow
#define drawable_mask_bounds gimp_drawable_mask_bounds
#define drawable_invalidate_preview gimp_drawable_invalidate_preview
#define drawable_dirty gimp_drawable_dirty
#define drawable_clean gimp_drawable_clean
#define drawable_type gimp_drawable_type
#define drawable_has_alpha gimp_drawable_has_alpha
#define drawable_type_with_alpha gimp_drawable_type_with_alpha

View File

@ -107,9 +107,9 @@ static void file_revert_confirm_callback (GtkWidget *widget,
gboolean revert,
gpointer data);
static GimpImage * file_open_image (gchar *filename,
gchar *raw_filename,
gchar *open_mode,
static GimpImage * file_open_image (const gchar *filename,
const gchar *raw_filename,
const gchar *open_mode,
RunModeType run_mode,
gint *status);
@ -710,9 +710,9 @@ file_save_type_callback (GtkWidget *widget,
}
static GimpImage *
file_open_image (gchar *filename,
gchar *raw_filename,
gchar *open_mode,
file_open_image (const gchar *filename,
const gchar *raw_filename,
const gchar *open_mode,
RunModeType run_mode,
gint *status)
{
@ -789,8 +789,8 @@ file_open_image (gchar *filename,
args[i].arg_type = proc->args[i].arg_type;
args[0].value.pdb_int = run_mode;
args[1].value.pdb_pointer = filename;
args[2].value.pdb_pointer = raw_filename;
args[1].value.pdb_pointer = (gchar *) filename;
args[2].value.pdb_pointer = (gchar *) raw_filename;
return_vals = procedural_db_execute (proc->name, args);
@ -1947,9 +1947,9 @@ file_revert_confirm_callback (GtkWidget *widget,
if (revert)
{
GimpImage *new_gimage;
gchar *filename;
gint status;
GimpImage *new_gimage;
const gchar *filename;
gint status;
filename = gimage_filename (old_gimage);
@ -1970,9 +1970,9 @@ file_revert_confirm_callback (GtkWidget *widget,
}
static PlugInProcDef *
file_proc_find_by_name (GSList *procs,
gchar *filename,
gboolean skip_magic)
file_proc_find_by_name (GSList *procs,
const gchar *filename,
gboolean skip_magic)
{
GSList *p;
gchar *ext = strrchr (filename, '.');
@ -2030,8 +2030,8 @@ file_proc_find_by_name (GSList *procs,
}
PlugInProcDef *
file_proc_find (GSList *procs,
gchar *filename)
file_proc_find (GSList *procs,
const gchar *filename)
{
PlugInProcDef *file_proc;
PlugInProcDef *size_matched_proc;

View File

@ -26,6 +26,10 @@
#include "plug_in.h"
extern GSList *load_procs;
extern GSList *save_procs;
void file_ops_pre_init (void);
void file_ops_post_init (void);
@ -49,9 +53,6 @@ gint file_open (gchar *filename,
gchar *raw_filename);
PlugInProcDef * file_proc_find (GSList *procs,
gchar *filename);
extern GSList *load_procs;
extern GSList *save_procs;
const gchar *filename);
#endif /* __FILEOPS_H__ */

View File

@ -546,8 +546,12 @@ fuzzy_select_calculate (Tool *tool,
fuzzy_options->sample_merged);
if (fuzzy_mask)
channel_delete (fuzzy_mask);
fuzzy_mask = channel_ref (new);
gtk_object_unref (GTK_OBJECT (fuzzy_mask));
fuzzy_mask = new;
gtk_object_ref (GTK_OBJECT (fuzzy_mask));
gtk_object_sink (GTK_OBJECT (fuzzy_mask));
/* calculate and allocate a new XSegment array which represents the boundary
* of the color-contiguous region

View File

@ -906,6 +906,7 @@ gdisplay_find_guide (GDisplay *gdisp,
(pos < (y + EPSILON)))
return guide;
break;
case ORIENTATION_VERTICAL:
pos = scalex * guide->position - offset_x;
if ((guide->position != -1) &&
@ -913,6 +914,9 @@ gdisplay_find_guide (GDisplay *gdisp,
(pos < (x + EPSILON)))
return guide;
break;
default:
break;
}
}
}
@ -976,6 +980,7 @@ gdisplay_snap_point (GDisplay *gdisp,
}
}
break;
case ORIENTATION_VERTICAL:
pos = scalex * guide->position - offset_x;
@ -993,6 +998,9 @@ gdisplay_snap_point (GDisplay *gdisp,
}
}
break;
default:
break;
}
}
}
@ -1888,9 +1896,13 @@ gdisplay_expose_guide (GDisplay *gdisp,
case ORIENTATION_HORIZONTAL:
gdisplay_expose_area (gdisp, 0, y, gdisp->disp_width, 1);
break;
case ORIENTATION_VERTICAL:
gdisplay_expose_area (gdisp, x, 0, 1, gdisp->disp_height);
break;
default:
break;
}
}

View File

@ -49,14 +49,15 @@
#include "libgimp/gimpintl.h"
enum {
enum
{
REMOVED,
LAST_SIGNAL
};
static void gimp_channel_class_init (GimpChannelClass *klass);
static void gimp_channel_init (GimpChannel *channel);
static void gimp_channel_destroy (GtkObject *object);
static void gimp_channel_class_init (GimpChannelClass *klass);
static void gimp_channel_init (GimpChannel *channel);
static void gimp_channel_destroy (GtkObject *object);
static TempBuf * channel_preview_private (Channel *channel,
gint width,
@ -67,7 +68,7 @@ static guint channel_signals[LAST_SIGNAL] = { 0 };
static GimpDrawableClass *parent_class = NULL;
GtkType
gimp_channel_get_type ()
gimp_channel_get_type (void)
{
static GtkType channel_type = 0;
@ -85,7 +86,7 @@ gimp_channel_get_type ()
(GtkClassInitFunc) NULL,
};
channel_type = gtk_type_unique (gimp_drawable_get_type (), &channel_info);
channel_type = gtk_type_unique (GIMP_TYPE_DRAWABLE, &channel_info);
}
return channel_type;
@ -127,12 +128,12 @@ channel_validate (TileManager *tm,
}
Channel *
channel_new (GimpImage *gimage,
gint width,
gint height,
gchar *name,
gint opacity,
guchar *col)
channel_new (GimpImage *gimage,
gint width,
gint height,
const gchar *name,
gint opacity,
const guchar *col)
{
Channel * channel;
gint i;
@ -166,33 +167,18 @@ channel_new (GimpImage *gimage,
}
Channel *
channel_ref (Channel *channel)
channel_copy (const Channel *channel)
{
gtk_object_ref (GTK_OBJECT (channel));
gtk_object_sink (GTK_OBJECT (channel));
return channel;
}
void
channel_unref (Channel *channel)
{
gtk_object_unref (GTK_OBJECT (channel));
}
Channel *
channel_copy (Channel *channel)
{
gchar *channel_name;
Channel *new_channel;
PixelRegion srcPR, destPR;
gchar *ext;
gint number;
gchar *name;
gint len;
gchar *channel_name;
Channel *new_channel;
PixelRegion srcPR, destPR;
gchar *ext;
gint number;
const gchar *name;
gint len;
/* formulate the new channel name */
name = channel_get_name (channel);
name = drawable_get_name (GIMP_DRAWABLE (channel));
ext = strrchr (name, '#');
len = strlen (_("copy"));
if ((strlen (name) >= len &&
@ -223,8 +209,8 @@ channel_copy (Channel *channel)
copy_region (&srcPR, &destPR);
/* copy the parasites */
GIMP_DRAWABLE (new_channel)->parasites
= parasite_list_copy (GIMP_DRAWABLE (channel)->parasites);
GIMP_DRAWABLE (new_channel)->parasites =
parasite_list_copy (GIMP_DRAWABLE (channel)->parasites);
/* free up the channel_name memory */
g_free (channel_name);
@ -233,39 +219,39 @@ channel_copy (Channel *channel)
}
void
channel_set_name (Channel *channel,
gchar *name)
channel_set_name (Channel *channel,
const gchar *name)
{
gimp_drawable_set_name (GIMP_DRAWABLE (channel), name);
}
gchar *
channel_get_name (Channel *channel)
const gchar *
channel_get_name (const Channel *channel)
{
return gimp_drawable_get_name (GIMP_DRAWABLE (channel));
}
void
channel_set_color (Channel *channel,
guchar *color)
channel_set_color (Channel *channel,
const guchar *color)
{
gint i;
if (color)
{
{
for (i = 0; i < 3; i++)
channel->col[i] = color[i];
}
}
guchar *
channel_get_color (Channel *channel)
const guchar *
channel_get_color (const Channel *channel)
{
return (GIMP_CHANNEL (channel)->col);
return GIMP_CHANNEL (channel)->col;
}
int
channel_get_opacity (Channel *channel)
gint
channel_get_opacity (const Channel *channel)
{
return channel->opacity;
}
@ -284,6 +270,7 @@ channel_get_ID (gint ID)
GimpDrawable *drawable;
drawable = drawable_get_ID (ID);
if (drawable && GIMP_IS_CHANNEL (drawable))
return GIMP_CHANNEL (drawable);
else
@ -313,8 +300,7 @@ gimp_channel_destroy (GtkObject *object)
g_free (channel->segs_out);
if (GTK_OBJECT_CLASS (parent_class)->destroy)
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
/* The removed signal is sent out when the channel is no longer
@ -323,8 +309,7 @@ gimp_channel_destroy (GtkObject *object)
* to the removed signal to update bits of UI that are tied to a
* particular layer. */
void
channel_removed (Channel *channel,
gpointer data)
channel_removed (Channel *channel)
{
g_return_if_fail (channel != NULL);
g_return_if_fail (GIMP_IS_CHANNEL (channel));
@ -332,13 +317,12 @@ channel_removed (Channel *channel,
gtk_signal_emit (GTK_OBJECT (channel), channel_signals[REMOVED]);
}
void
channel_scale (Channel *channel,
gint new_width,
gint new_height)
{
PixelRegion srcPR, destPR;
PixelRegion srcPR, destPR;
TileManager *new_tiles;
if (new_width == 0 || new_height == 0)
@ -388,12 +372,12 @@ channel_resize (Channel *channel,
gint offx,
gint offy)
{
PixelRegion srcPR, destPR;
PixelRegion srcPR, destPR;
TileManager *new_tiles;
guchar bg = 0;
gint clear;
gint w, h;
gint x1, y1, x2, y2;
guchar bg = 0;
gint clear;
gint w, h;
gint x1, y1, x2, y2;
if (!new_width || !new_height)
return;
@ -507,8 +491,8 @@ channel_preview (Channel *channel,
{
/* Ok prime the cache with a large preview if the cache is invalid */
if (! GIMP_DRAWABLE (channel)->preview_valid &&
width <= PREVIEW_CACHE_PRIME_WIDTH &&
height <= PREVIEW_CACHE_PRIME_HEIGHT &&
width <= PREVIEW_CACHE_PRIME_WIDTH &&
height <= PREVIEW_CACHE_PRIME_HEIGHT &&
GIMP_DRAWABLE (channel)->gimage &&
GIMP_DRAWABLE (channel)->gimage->width > PREVIEW_CACHE_PRIME_WIDTH &&
GIMP_DRAWABLE (channel)->gimage->height > PREVIEW_CACHE_PRIME_HEIGHT)
@ -523,7 +507,7 @@ channel_preview (Channel *channel,
return tb;
}
/* Second call - should NOT visit the tile cache...*/
/* Second call - should NOT visit the tile cache... */
return channel_preview_private (channel, width, height);
}
@ -546,7 +530,9 @@ channel_preview_private (Channel *channel,
(ret_buf =
gimp_preview_cache_get (& (GIMP_DRAWABLE (channel)->preview_cache),
width, height)))
return ret_buf;
{
return ret_buf;
}
/* The hard way */
else
{
@ -585,10 +571,10 @@ channel_preview_private (Channel *channel,
}
void
channel_invalidate_previews (GimpImage* gimage)
channel_invalidate_previews (GimpImage *gimage)
{
GSList * tmp;
Channel * channel;
GSList *tmp;
Channel *channel;
g_return_if_fail (gimage != NULL);
@ -605,12 +591,12 @@ channel_invalidate_previews (GimpImage* gimage)
Tattoo
channel_get_tattoo (const Channel *channel)
{
return (gimp_drawable_get_tattoo (GIMP_DRAWABLE (channel)));
return gimp_drawable_get_tattoo (GIMP_DRAWABLE (channel));
}
void
channel_set_tattoo (const Channel *channel,
Tattoo value)
channel_set_tattoo (Channel *channel,
Tattoo value)
{
gimp_drawable_set_tattoo (GIMP_DRAWABLE (channel), value);
}
@ -624,7 +610,7 @@ channel_new_mask (GimpImage *gimage,
gint width,
gint height)
{
guchar black[3] = {0, 0, 0};
guchar black[3] = { 0, 0, 0 };
Channel *new_channel;
/* Create the new channel */
@ -649,7 +635,7 @@ channel_boundary (Channel *mask,
gint x2,
gint y2)
{
gint x3, y3, x4, y4;
gint x3, y3, x4, y4;
PixelRegion bPR;
if (! mask->boundary_known)
@ -714,7 +700,7 @@ channel_value (Channel *mask,
gint y)
{
Tile *tile;
gint val;
gint val;
/* Some checks to cut back on unnecessary work */
if (mask->bounds_known)
@ -745,13 +731,13 @@ channel_bounds (Channel *mask,
gint *x2,
gint *y2)
{
PixelRegion maskPR;
guchar *data, *data1;
gint x, y;
gint ex, ey;
gint tx1, tx2, ty1, ty2;
gint minx, maxx;
gpointer pr;
PixelRegion maskPR;
guchar *data, *data1;
gint x, y;
gint ex, ey;
gint tx1, tx2, ty1, ty2;
gint minx, maxx;
gpointer pr;
/* if the mask's bounds have already been reliably calculated... */
if (mask->bounds_known)
@ -855,10 +841,10 @@ channel_bounds (Channel *mask,
gboolean
channel_is_empty (Channel *mask)
{
PixelRegion maskPR;
guchar * data;
gint x, y;
gpointer pr;
PixelRegion maskPR;
guchar *data;
gint x, y;
gpointer pr;
if (mask->bounds_known)
return mask->empty;
@ -910,11 +896,11 @@ channel_add_segment (Channel *mask,
gint width,
gint value)
{
PixelRegion maskPR;
guchar *data;
gint val;
gint x2;
gpointer pr;
PixelRegion maskPR;
guchar *data;
gint val;
gint x2;
gpointer pr;
/* check horizontal extents... */
x2 = x + width;
@ -953,11 +939,11 @@ channel_sub_segment (Channel *mask,
gint width,
gint value)
{
PixelRegion maskPR;
guchar *data;
gint val;
gint x2;
gpointer pr;
PixelRegion maskPR;
guchar *data;
gint val;
gint x2;
gpointer pr;
/* check horizontal extents... */
x2 = x + width;
@ -996,9 +982,9 @@ channel_combine_rect (Channel *mask,
gint w,
gint h)
{
gint x2, y2;
gint x2, y2;
PixelRegion maskPR;
guchar color;
guchar color;
y2 = y + h;
x2 = x + w;
@ -1057,9 +1043,9 @@ channel_combine_ellipse (Channel *mask,
gint h,
gboolean antialias)
{
gint i, j;
gint x0, x1, x2;
gint val, last;
gint i, j;
gint x0, x1, x2;
gint val, last;
gfloat a_sqr, b_sqr, aob_sqr;
gfloat w_sqr, h_sqr;
gfloat y_sqr;
@ -1208,7 +1194,7 @@ channel_combine_sub_region_add (void *unused,
PixelRegion *destPR)
{
guchar *src, *dest;
gint x, y, val;
gint x, y, val;
src = srcPR->data;
dest = destPR->data;
@ -1234,7 +1220,7 @@ channel_combine_sub_region_sub (void *unused,
PixelRegion *destPR)
{
guchar *src, *dest;
gint x, y;
gint x, y;
src = srcPR->data;
dest = destPR->data;
@ -1259,7 +1245,7 @@ channel_combine_sub_region_intersect (void *unused,
PixelRegion *destPR)
{
guchar *src, *dest;
gint x, y;
gint x, y;
src = srcPR->data;
dest = destPR->data;
@ -1283,8 +1269,8 @@ channel_combine_mask (Channel *mask,
gint off_y)
{
PixelRegion srcPR, destPR;
gint x1, y1, x2, y2;
gint w, h;
gint x1, y1, x2, y2;
gint w, h;
x1 = CLAMP (off_x, 0, GIMP_DRAWABLE (mask)->width);
y1 = CLAMP (off_y, 0, GIMP_DRAWABLE (mask)->height);
@ -1493,7 +1479,7 @@ channel_border (Channel *mask,
gint radius_y)
{
PixelRegion bPR;
gint x1, y1, x2, y2;
gint x1, y1, x2, y2;
if (radius_x < 0 || radius_y < 0)
return;
@ -1537,7 +1523,7 @@ channel_grow (Channel *mask,
gint radius_y)
{
PixelRegion bPR;
gint x1, y1, x2, y2;
gint x1, y1, x2, y2;
if (radius_x == 0 && radius_y == 0)
return;
@ -1592,7 +1578,7 @@ channel_shrink (Channel *mask,
gboolean edge_lock)
{
PixelRegion bPR;
gint x1, y1, x2, y2;
gint x1, y1, x2, y2;
if (radius_x == 0 && radius_y == 0)
return;
@ -1636,11 +1622,11 @@ channel_translate (Channel *mask,
gint off_x,
gint off_y)
{
gint width, height;
Channel *tmp_mask;
PixelRegion srcPR, destPR;
guchar empty = 0;
gint x1, y1, x2, y2;
gint width, height;
Channel *tmp_mask;
PixelRegion srcPR, destPR;
guchar empty = 0;
gint x1, y1, x2, y2;
tmp_mask = NULL;
@ -1713,8 +1699,8 @@ channel_layer_alpha (Channel *mask,
Layer *layer)
{
PixelRegion srcPR, destPR;
guchar empty = 0;
gint x1, y1, x2, y2;
guchar empty = 0;
gint x1, y1, x2, y2;
/* push the current mask onto the undo stack */
channel_push_undo (mask);
@ -1772,4 +1758,3 @@ channel_invalidate_bounds (Channel *channel)
{
channel->bounds_known = FALSE;
}

View File

@ -65,145 +65,142 @@ typedef struct _MaskUndo MaskUndo;
struct _MaskUndo
{
TileManager *tiles; /* the actual mask */
gint x, y; /* offsets */
TileManager *tiles; /* the actual mask */
gint x, y; /* offsets */
};
/* function declarations */
Channel * channel_new (GimpImage *gimage,
gint width,
gint height,
gchar *name,
gint opacity,
guchar *col);
Channel * channel_copy (Channel *channel);
Channel * channel_ref (Channel *channel);
void channel_unref (Channel *channel);
Channel * channel_new (GimpImage *gimage,
gint width,
gint height,
const gchar *name,
gint opacity,
const guchar *col);
Channel * channel_copy (const Channel *channel);
gchar * channel_get_name (Channel *channel);
void channel_set_name (Channel *channel,
gchar *name);
const gchar * channel_get_name (const Channel *channel);
void channel_set_name (Channel *channel,
const gchar *name);
gint channel_get_opacity (Channel *channel);
void channel_set_opacity (Channel *channel,
gint opacity);
gint channel_get_opacity (const Channel *channel);
void channel_set_opacity (Channel *channel,
gint opacity);
guchar * channel_get_color (Channel *channel);
void channel_set_color (Channel *channel,
guchar *color);
const guchar * channel_get_color (const Channel *channel);
void channel_set_color (Channel *channel,
const guchar *color);
Channel * channel_get_ID (gint ID);
void channel_delete (Channel *channel);
void channel_removed (Channel *channel,
gpointer data);
void channel_scale (Channel *channel,
gint new_width,
gint new_height);
void channel_resize (Channel *channel,
gint new_width,
gint new_height,
gint offx,
gint offy);
void channel_update (Channel *channel);
Channel * channel_get_ID (gint ID);
void channel_delete (Channel *channel);
void channel_removed (Channel *channel);
void channel_scale (Channel *channel,
gint new_width,
gint new_height);
void channel_resize (Channel *channel,
gint new_width,
gint new_height,
gint offx,
gint offy);
void channel_update (Channel *channel);
/* access functions */
gboolean channel_toggle_visibility (Channel *channel);
TempBuf * channel_preview (Channel *channel,
gint width,
gint height);
gboolean channel_toggle_visibility (Channel *channel);
TempBuf * channel_preview (Channel *channel,
gint width,
gint height);
void channel_invalidate_previews (GimpImage *gimage);
void channel_invalidate_previews (GimpImage *gimage);
Tattoo channel_get_tattoo (const Channel *channel);
void channel_set_tattoo (const Channel *channel,
void channel_set_tattoo (Channel *channel,
Tattoo value);
/* selection mask functions */
Channel * channel_new_mask (GimpImage *gimage,
gint width,
gint height);
gboolean channel_boundary (Channel *mask,
BoundSeg **segs_in,
BoundSeg **segs_out,
gint *num_segs_in,
gint *num_segs_out,
gint x1,
gint y1,
gint x2,
gint y2);
gboolean channel_bounds (Channel *mask,
gint *x1,
gint *y1,
gint *x2,
gint *y2);
gint channel_value (Channel *mask,
gint x,
gint y);
gboolean channel_is_empty (Channel *mask);
void channel_add_segment (Channel *mask,
gint x,
gint y,
gint width,
gint value);
void channel_sub_segment (Channel *mask,
gint x,
gint y,
gint width,
gint value);
void channel_combine_rect (Channel *mask,
ChannelOps op,
gint x,
gint y,
gint w,
gint h);
void channel_combine_ellipse (Channel *mask,
ChannelOps op,
gint x,
gint y,
gint w,
gint h,
gboolean antialias);
void channel_combine_mask (Channel *mask,
Channel *add_on,
ChannelOps op,
gint off_x,
gint off_y);
void channel_feather (Channel *input,
Channel *output,
gdouble radius_x,
gdouble radius_y,
ChannelOps op,
gint off_x,
gint off_y);
Channel * channel_new_mask (GimpImage *gimage,
gint width,
gint height);
gboolean channel_boundary (Channel *mask,
BoundSeg **segs_in,
BoundSeg **segs_out,
gint *num_segs_in,
gint *num_segs_out,
gint x1,
gint y1,
gint x2,
gint y2);
gboolean channel_bounds (Channel *mask,
gint *x1,
gint *y1,
gint *x2,
gint *y2);
gint channel_value (Channel *mask,
gint x,
gint y);
gboolean channel_is_empty (Channel *mask);
void channel_add_segment (Channel *mask,
gint x,
gint y,
gint width,
gint value);
void channel_sub_segment (Channel *mask,
gint x,
gint y,
gint width,
gint value);
void channel_combine_rect (Channel *mask,
ChannelOps op,
gint x,
gint y,
gint w,
gint h);
void channel_combine_ellipse (Channel *mask,
ChannelOps op,
gint x,
gint y,
gint w,
gint h,
gboolean antialias);
void channel_combine_mask (Channel *mask,
Channel *add_on,
ChannelOps op,
gint off_x,
gint off_y);
void channel_feather (Channel *input,
Channel *output,
gdouble radius_x,
gdouble radius_y,
ChannelOps op,
gint off_x,
gint off_y);
void channel_push_undo (Channel *mask);
void channel_clear (Channel *mask);
void channel_invert (Channel *mask);
void channel_sharpen (Channel *mask);
void channel_all (Channel *mask);
void channel_push_undo (Channel *mask);
void channel_clear (Channel *mask);
void channel_invert (Channel *mask);
void channel_sharpen (Channel *mask);
void channel_all (Channel *mask);
void channel_border (Channel *mask,
gint radius_x,
gint radius_y);
void channel_grow (Channel *mask,
gint radius_x,
gint radius_y);
void channel_shrink (Channel *mask,
gint radius_x,
gint radius_y,
gboolean edge_lock);
void channel_border (Channel *mask,
gint radius_x,
gint radius_y);
void channel_grow (Channel *mask,
gint radius_x,
gint radius_y);
void channel_shrink (Channel *mask,
gint radius_x,
gint radius_y,
gboolean edge_lock);
void channel_translate (Channel *mask,
gint off_x,
gint off_y);
void channel_load (Channel *mask,
Channel *channel);
void channel_translate (Channel *mask,
gint off_x,
gint off_y);
void channel_load (Channel *mask,
Channel *channel);
void channel_invalidate_bounds (Channel *channel);
void channel_invalidate_bounds (Channel *channel);
#define drawable_channel GIMP_IS_CHANNEL

View File

@ -57,34 +57,49 @@ static GimpDrawableClass *parent_class = NULL;
GtkType
gimp_drawable_get_type (void)
{
static GtkType type;
GIMP_TYPE_INIT (type,
GimpDrawable,
GimpDrawableClass,
gimp_drawable_init,
gimp_drawable_class_init,
GIMP_TYPE_OBJECT);
return type;
static GtkType drawable_type = 0;
if (! drawable_type)
{
GtkTypeInfo drawable_info =
{
"GimpDrawable",
sizeof (GimpDrawable),
sizeof (GimpDrawableClass),
(GtkClassInitFunc) gimp_drawable_class_init,
(GtkObjectInitFunc) gimp_drawable_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL,
};
drawable_type = gtk_type_unique (GIMP_TYPE_OBJECT, &drawable_info);
}
return drawable_type;
}
static void
gimp_drawable_class_init (GimpDrawableClass *class)
gimp_drawable_class_init (GimpDrawableClass *klass)
{
GtkObjectClass *object_class;
GtkType type = GIMP_TYPE_DRAWABLE;
object_class = GTK_OBJECT_CLASS (class);
object_class = GTK_OBJECT_CLASS (klass);
parent_class = gtk_type_class (GIMP_TYPE_OBJECT);
gimp_drawable_signals[INVALIDATE_PREVIEW] =
gimp_signal_new ("invalidate_pr", GTK_RUN_LAST, type,
GTK_SIGNAL_OFFSET(GimpDrawableClass,
invalidate_preview),
gimp_sigtype_void);
gtk_object_class_add_signals (object_class, gimp_drawable_signals, LAST_SIGNAL);
gimp_drawable_signals[INVALIDATE_PREVIEW] =
gimp_signal_new ("invalidate_pr", GTK_RUN_LAST, type,
GTK_SIGNAL_OFFSET (GimpDrawableClass,
invalidate_preview),
gimp_sigtype_void);
gtk_object_class_add_signals (object_class, gimp_drawable_signals,
LAST_SIGNAL);
object_class->destroy = gimp_drawable_destroy;
klass->invalidate_preview = NULL;
}
@ -97,27 +112,29 @@ static GHashTable *gimp_drawable_table = NULL;
/**************************/
/* Function definitions */
GimpDrawable*
GimpDrawable *
gimp_drawable_get_ID (gint drawable_id)
{
if (gimp_drawable_table == NULL)
return NULL;
return (GimpDrawable*) g_hash_table_lookup (gimp_drawable_table,
(gpointer) drawable_id);
return (GimpDrawable *) g_hash_table_lookup (gimp_drawable_table,
(gpointer) drawable_id);
}
void
gimp_drawable_merge_shadow (GimpDrawable *drawable,
gint undo)
{
GImage *gimage;
PixelRegion shadowPR;
int x1, y1, x2, y2;
GImage *gimage;
PixelRegion shadowPR;
gint x1, y1, x2, y2;
g_return_if_fail (drawable != NULL);
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
gimage = gimp_drawable_gimage (drawable);
g_return_if_fail (gimage != NULL);
g_return_if_fail (gimage->shadow != NULL);
@ -139,39 +156,44 @@ gimp_drawable_fill (GimpDrawable *drawable,
guchar b,
guchar a)
{
GImage *gimage;
PixelRegion destPR;
guchar c[MAX_CHANNELS];
guchar i;
GImage *gimage;
PixelRegion destPR;
guchar c[MAX_CHANNELS];
guchar i;
g_return_if_fail (drawable != NULL);
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
gimage = gimp_drawable_gimage (drawable);
g_return_if_fail (gimage != NULL);
switch (gimp_drawable_type (drawable))
{
case RGB_GIMAGE: case RGBA_GIMAGE:
c[RED_PIX] = r;
c[RED_PIX] = r;
c[GREEN_PIX] = g;
c[BLUE_PIX] = b;
c[BLUE_PIX] = b;
if (gimp_drawable_type (drawable) == RGBA_GIMAGE)
c[ALPHA_PIX] = a;
break;
case GRAY_GIMAGE: case GRAYA_GIMAGE:
c[GRAY_PIX] = r;
if (gimp_drawable_type (drawable) == GRAYA_GIMAGE)
c[ALPHA_G_PIX] = a;
break;
case INDEXED_GIMAGE: case INDEXEDA_GIMAGE:
c[RED_PIX] = r;
c[RED_PIX] = r;
c[GREEN_PIX] = g;
c[BLUE_PIX] = b;
c[BLUE_PIX] = b;
gimage_transform_color (gimage, drawable, c, &i, RGB);
c[INDEXED_PIX] = i;
if (gimp_drawable_type (drawable) == INDEXEDA_GIMAGE)
c[ALPHA_I_PIX] = a;
break;
default:
g_message (_("Can't fill unknown image type."));
break;
@ -184,7 +206,6 @@ gimp_drawable_fill (GimpDrawable *drawable,
gimp_drawable_height (drawable),
TRUE);
color_region (&destPR, c);
}
gboolean
@ -197,9 +218,11 @@ gimp_drawable_mask_bounds (GimpDrawable *drawable,
GimpImage *gimage;
gint off_x, off_y;
g_return_val_if_fail (drawable != NULL, FALSE);
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
gimage = gimp_drawable_gimage (drawable);
g_return_val_if_fail (gimage != NULL, FALSE);
if (gimage_mask_bounds (gimage, x1, y1, x2, y2))
@ -225,6 +248,7 @@ gimp_drawable_invalidate_preview (GimpDrawable *drawable,
{
GimpImage *gimage;
g_return_if_fail (drawable != NULL);
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
drawable->preview_valid = FALSE;
@ -244,7 +268,7 @@ gimp_drawable_invalidate_preview (GimpDrawable *drawable,
GimpImage *
gimp_drawable_gimage (GimpDrawable *drawable)
gimp_drawable_gimage (const GimpDrawable *drawable)
{
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
@ -266,7 +290,7 @@ gimp_drawable_set_gimage (GimpDrawable *drawable,
}
gboolean
gimp_drawable_has_alpha (GimpDrawable *drawable)
gimp_drawable_has_alpha (const GimpDrawable *drawable)
{
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
@ -274,7 +298,7 @@ gimp_drawable_has_alpha (GimpDrawable *drawable)
}
GimpImageType
gimp_drawable_type (GimpDrawable *drawable)
gimp_drawable_type (const GimpDrawable *drawable)
{
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), -1);
@ -282,44 +306,49 @@ gimp_drawable_type (GimpDrawable *drawable)
}
GimpImageType
gimp_drawable_type_with_alpha (GimpDrawable *drawable)
gimp_drawable_type_with_alpha (const GimpDrawable *drawable)
{
GimpImageType type;
gboolean has_alpha;
gboolean has_alpha;
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), -1);
type = gimp_drawable_type (drawable);
has_alpha = gimp_drawable_has_alpha (drawable);
if (has_alpha)
return type;
{
return type;
}
else
switch (type)
{
case RGB_GIMAGE:
return RGBA_GIMAGE; break;
case GRAY_GIMAGE:
return GRAYA_GIMAGE; break;
case INDEXED_GIMAGE:
return INDEXEDA_GIMAGE; break;
default:
{
switch (type)
{
case RGB_GIMAGE:
return RGBA_GIMAGE; break;
case GRAY_GIMAGE:
return GRAYA_GIMAGE; break;
case INDEXED_GIMAGE:
return INDEXEDA_GIMAGE; break;
default:
g_assert_not_reached ();
break;
}
}
}
return 0;
}
gboolean
gimp_drawable_visible (GimpDrawable *drawable)
gimp_drawable_visible (const GimpDrawable *drawable)
{
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
return drawable->visible;
}
gchar *
gimp_drawable_get_name (GimpDrawable *drawable)
const gchar *
gimp_drawable_get_name (const GimpDrawable *drawable)
{
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
@ -328,7 +357,7 @@ gimp_drawable_get_name (GimpDrawable *drawable)
void
gimp_drawable_set_name (GimpDrawable *drawable,
gchar *name)
const gchar *name)
{
GSList *list, *listb, *base_list;
GimpDrawable *drawableb;
@ -471,19 +500,21 @@ list_func (gchar *key,
}
gchar **
gimp_drawable_parasite_list (GimpDrawable *drawable,
gint *count)
gimp_drawable_parasite_list (const GimpDrawable *drawable,
gint *count)
{
gchar **list;
gchar **cur;
g_return_val_if_fail (drawable != NULL, NULL);
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
g_return_val_if_fail (count != NULL, NULL);
*count = parasite_list_length (drawable->parasites);
cur = list = g_new (gchar *, *count);
parasite_list_foreach (drawable->parasites, (GHFunc) list_func, &cur);
return list;
}
@ -503,12 +534,15 @@ gimp_drawable_parasite_attach (GimpDrawable *drawable,
undo_push_drawable_parasite (drawable->gimage, drawable, parasite);
}
else if (gimp_parasite_is_persistent (parasite) &&
!gimp_parasite_compare (parasite,
gimp_drawable_parasite_find
(drawable, gimp_parasite_name (parasite))))
undo_push_cantundo (drawable->gimage, _("parasite attach to drawable"));
! gimp_parasite_compare (parasite,
gimp_drawable_parasite_find
(drawable, gimp_parasite_name (parasite))))
{
undo_push_cantundo (drawable->gimage, _("parasite attach to drawable"));
}
parasite_list_add (drawable->parasites, parasite);
if (gimp_parasite_has_flag (parasite, GIMP_PARASITE_ATTACH_PARENT))
{
parasite_shift_parent (parasite);
@ -520,6 +554,7 @@ gimp_drawable_parasite_attach (GimpDrawable *drawable,
parasite_shift_parent (parasite);
gimp_parasite_attach (parasite);
}
if (gimp_parasite_is_undoable (parasite))
{
undo_push_group_end (drawable->gimage);
@ -534,7 +569,7 @@ gimp_drawable_parasite_detach (GimpDrawable *drawable,
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
if (!(p = parasite_list_find (drawable->parasites, parasite)))
if (! (p = parasite_list_find (drawable->parasites, parasite)))
return;
if (gimp_parasite_is_undoable (p))
@ -564,7 +599,7 @@ gimp_drawable_set_tattoo (GimpDrawable *drawable,
}
gboolean
gimp_drawable_is_rgb (GimpDrawable *drawable)
gimp_drawable_is_rgb (const GimpDrawable *drawable)
{
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
@ -576,7 +611,7 @@ gimp_drawable_is_rgb (GimpDrawable *drawable)
}
gboolean
gimp_drawable_is_gray (GimpDrawable *drawable)
gimp_drawable_is_gray (const GimpDrawable *drawable)
{
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
@ -588,7 +623,7 @@ gimp_drawable_is_gray (GimpDrawable *drawable)
}
gboolean
gimp_drawable_is_indexed (GimpDrawable *drawable)
gimp_drawable_is_indexed (const GimpDrawable *drawable)
{
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
@ -600,7 +635,7 @@ gimp_drawable_is_indexed (GimpDrawable *drawable)
}
TileManager *
gimp_drawable_data (GimpDrawable *drawable)
gimp_drawable_data (const GimpDrawable *drawable)
{
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
@ -657,7 +692,7 @@ gimp_drawable_offsets (GimpDrawable *drawable,
}
guchar *
gimp_drawable_cmap (GimpDrawable *drawable)
gimp_drawable_cmap (const GimpDrawable *drawable)
{
GimpImage *gimage;
@ -741,7 +776,7 @@ gimp_drawable_configure (GimpDrawable *drawable,
gint width,
gint height,
GimpImageType type,
gchar *name)
const gchar *name)
{
gint bpp;
gboolean alpha;
@ -781,7 +816,8 @@ gimp_drawable_configure (GimpDrawable *drawable,
if (drawable->tiles)
tile_manager_destroy (drawable->tiles);
drawable->tiles = tile_manager_new (width, height, bpp);
drawable->tiles = tile_manager_new (width, height, bpp);
drawable->visible = TRUE;
if (gimage)

View File

@ -31,59 +31,67 @@
#define GIMP_DRAWABLE(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_DRAWABLE, GimpDrawable))
#define GIMP_IS_DRAWABLE(obj) (GTK_CHECK_TYPE ((obj), GIMP_TYPE_DRAWABLE))
GtkType gimp_drawable_get_type (void);
/* drawable access functions */
void gimp_drawable_merge_shadow (GimpDrawable *, gint);
void gimp_drawable_fill (GimpDrawable *drawable,
guchar r, guchar g,
guchar b, guchar a);
GtkType gimp_drawable_get_type (void);
gboolean gimp_drawable_mask_bounds (GimpDrawable *,
gint *, gint *,
gint *, gint *);
void gimp_drawable_merge_shadow (GimpDrawable *drawable,
gint undo);
void gimp_drawable_fill (GimpDrawable *drawable,
guchar r,
guchar g,
guchar b,
guchar a);
void gimp_drawable_invalidate_preview (GimpDrawable *drawable,
gboolean emit_signal);
gint gimp_drawable_dirty (GimpDrawable *);
gint gimp_drawable_clean (GimpDrawable *);
gboolean gimp_drawable_has_alpha (GimpDrawable *);
GimpImageType gimp_drawable_type (GimpDrawable *);
GimpImageType gimp_drawable_type_with_alpha (GimpDrawable *);
gboolean gimp_drawable_is_rgb (GimpDrawable *);
gboolean gimp_drawable_is_gray (GimpDrawable *);
gboolean gimp_drawable_is_indexed (GimpDrawable *);
TileManager * gimp_drawable_data (GimpDrawable *);
TileManager * gimp_drawable_shadow (GimpDrawable *);
gint gimp_drawable_bytes (GimpDrawable *);
gint gimp_drawable_width (GimpDrawable *);
gint gimp_drawable_height (GimpDrawable *);
gboolean gimp_drawable_visible (GimpDrawable *);
void gimp_drawable_offsets (GimpDrawable *,
gint *, gint *);
gboolean gimp_drawable_mask_bounds (GimpDrawable *drawable,
gint *x1,
gint *y1,
gint *x2,
gint *y2);
guchar * gimp_drawable_cmap (GimpDrawable *);
gchar * gimp_drawable_get_name (GimpDrawable *);
void gimp_drawable_set_name (GimpDrawable *, gchar *);
void gimp_drawable_invalidate_preview (GimpDrawable *drawable,
gboolean emit_signal);
gboolean gimp_drawable_has_alpha (const GimpDrawable *drawable);
GimpImageType gimp_drawable_type (const GimpDrawable *drawable);
GimpImageType gimp_drawable_type_with_alpha (const GimpDrawable *drawable);
gboolean gimp_drawable_is_rgb (const GimpDrawable *drawable);
gboolean gimp_drawable_is_gray (const GimpDrawable *drawable);
gboolean gimp_drawable_is_indexed (const GimpDrawable *drawable);
TileManager * gimp_drawable_data (const GimpDrawable *drawable);
TileManager * gimp_drawable_shadow (GimpDrawable *);
gint gimp_drawable_bytes (GimpDrawable *);
gint gimp_drawable_width (GimpDrawable *);
gint gimp_drawable_height (GimpDrawable *);
gboolean gimp_drawable_visible (const GimpDrawable *drawable);
void gimp_drawable_offsets (GimpDrawable *,
gint *, gint *);
guchar * gimp_drawable_get_color_at (GimpDrawable *,
gint x, gint y);
guchar * gimp_drawable_cmap (const GimpDrawable *drawable);
const gchar * gimp_drawable_get_name (const GimpDrawable *drawable);
void gimp_drawable_set_name (GimpDrawable *drawable,
const gchar *name);
void gimp_drawable_parasite_attach (GimpDrawable *,
GimpParasite *);
void gimp_drawable_parasite_detach (GimpDrawable *,
const gchar *);
GimpParasite * gimp_drawable_parasite_find (const GimpDrawable *,
const gchar *);
gchar ** gimp_drawable_parasite_list (GimpDrawable *drawable,
gint *count);
Tattoo gimp_drawable_get_tattoo (const GimpDrawable *);
void gimp_drawable_set_tattoo (GimpDrawable *, Tattoo);
guchar * gimp_drawable_get_color_at (GimpDrawable *drawable,
gint x,
gint y);
GimpDrawable * gimp_drawable_get_ID (gint);
void gimp_drawable_deallocate (GimpDrawable *);
GimpImage * gimp_drawable_gimage (GimpDrawable*);
void gimp_drawable_set_gimage (GimpDrawable*, GimpImage *);
void gimp_drawable_parasite_attach (GimpDrawable *drawable,
GimpParasite *parasite);
void gimp_drawable_parasite_detach (GimpDrawable *drawable,
const gchar *parasite);
GimpParasite * gimp_drawable_parasite_find (const GimpDrawable *drawable,
const gchar *name);
gchar ** gimp_drawable_parasite_list (const GimpDrawable *drawable,
gint *count);
Tattoo gimp_drawable_get_tattoo (const GimpDrawable *drawable);
void gimp_drawable_set_tattoo (GimpDrawable *drawable,
Tattoo tattoo);
GimpDrawable * gimp_drawable_get_ID (gint);
void gimp_drawable_deallocate (GimpDrawable *);
GimpImage * gimp_drawable_gimage (const GimpDrawable *drawable);
void gimp_drawable_set_gimage (GimpDrawable *drawable,
GimpImage *gimage);
#endif /* __GIMP_DRAWABLE_H__ */

View File

@ -16,13 +16,20 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __GIMPDRAWABLEP_H__
#define __GIMPDRAWABLEP_H__
#ifndef __GIMP_DRAWABLE_P_H__
#define __GIMP_DRAWABLE_P_H__
#include "gimpobject.h"
#include "gimpdrawable.h"
#define GIMP_DRAWABLE_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GIMP_TYPE_DRAWABLE, GimpDrawableClass))
#define GIMP_IS_DRAWABLE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_DRAWABLE))
typedef struct _GimpDrawableClass GimpDrawableClass;
struct _GimpDrawable
{
GimpObject data;
@ -51,17 +58,15 @@ struct _GimpDrawableClass
{
GimpObjectClass parent_class;
void (* invalidate_preview) (GtkObject *);
void (* invalidate_preview) (GimpDrawable *drawable);
};
typedef struct _GimpDrawableClass GimpDrawableClass;
#define GIMP_DRAWABLE_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GIMP_TYPE_DRAWABLE, GimpDrawableClass))
#define GIMP_IS_DRAWABLE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_DRAWABLE))
void gimp_drawable_configure (GimpDrawable *, GimpImage *,
gint, gint, GimpImageType, gchar *);
#endif /* __GIMPDRAWABLEP_H__ */
void gimp_drawable_configure (GimpDrawable *drawable,
GimpImage *gimage,
gint width,
gint height,
GimpImageType type,
const gchar *name);
#endif /* __GIMP_DRAWABLE_P_H__ */

View File

@ -59,28 +59,58 @@
/* Local function declarations */
static void gimp_image_destroy (GtkObject *object);
static void gimp_image_free_projection (GimpImage *);
static void gimp_image_allocate_shadow (GimpImage *, gint, gint, gint);
static void gimp_image_allocate_projection (GimpImage *);
static void gimp_image_free_layers (GimpImage *);
static void gimp_image_free_channels (GimpImage *);
static void gimp_image_construct_layers (GimpImage *, gint, gint, gint, gint);
static void gimp_image_construct_channels (GimpImage *, gint, gint, gint, gint);
static void gimp_image_initialize_projection (GimpImage *, gint, gint, gint, gint);
static void gimp_image_get_active_channels (GimpImage *, GimpDrawable *, gint *);
static void gimp_image_destroy (GtkObject *object);
static void gimp_image_free_projection (GimpImage *gimage);
static void gimp_image_allocate_shadow (GimpImage *gimage,
gint width,
gint height,
gint bpp);
static void gimp_image_allocate_projection (GimpImage *gimage);
static void gimp_image_free_layers (GimpImage *gimage);
static void gimp_image_free_channels (GimpImage *gimage);
static void gimp_image_construct_layers (GimpImage *gimage,
gint x,
gint y,
gint w,
gint h);
static void gimp_image_construct_channels (GimpImage *gimage,
gint x,
gint y,
gint w,
gint h);
static void gimp_image_initialize_projection (GimpImage *gimage,
gint x,
gint y,
gint w,
gint h);
static void gimp_image_get_active_channels (GimpImage *gimage,
GimpDrawable *drawable,
gint *active);
/* projection functions */
static void project_intensity (GimpImage *, Layer *,
PixelRegion *, PixelRegion *,
PixelRegion *);
static void project_intensity_alpha (GimpImage *, Layer *,
PixelRegion *, PixelRegion *,
PixelRegion *);
static void project_indexed (GimpImage *, Layer *,
PixelRegion *, PixelRegion *);
static void project_channel (GimpImage *, Channel *,
PixelRegion *, PixelRegion *);
static void project_intensity (GimpImage *gimage,
Layer *layer,
PixelRegion *src,
PixelRegion *dest,
PixelRegion *mask);
static void project_intensity_alpha (GimpImage *gimage,
Layer *layer,
PixelRegion *src,
PixelRegion *dest,
PixelRegion *mask);
static void project_indexed (GimpImage *gimage,
Layer *layer,
PixelRegion *src,
PixelRegion *dest);
static void project_indexed_alpha (GimpImage *gimage,
Layer *layer,
PixelRegion *src,
PixelRegion *dest,
PixelRegion *mask);
static void project_channel (GimpImage *gimage,
Channel *layer,
PixelRegion *src,
PixelRegion *src2);
/*
* Global variables
@ -108,7 +138,8 @@ guint32 next_guide_id = 1; /* For generating guide_ID handles for PDB stuff */
* Static variables
*/
enum {
enum
{
CLEAN,
DIRTY,
REPAINT,
@ -120,8 +151,9 @@ enum {
LAST_SIGNAL
};
static guint gimp_image_signals[LAST_SIGNAL];
static GimpObjectClass *parent_class;
static guint gimp_image_signals[LAST_SIGNAL] = { 0 };
static GimpObjectClass *parent_class = NULL;
static void
@ -129,13 +161,11 @@ gimp_image_class_init (GimpImageClass *klass)
{
GtkObjectClass *object_class;
GtkType type;
object_class = GTK_OBJECT_CLASS(klass);
parent_class = gtk_type_class (gimp_object_get_type ());
type=object_class->type;
object_class->destroy = gimp_image_destroy;
object_class = GTK_OBJECT_CLASS (klass);
parent_class = gtk_type_class (gimp_object_get_type ());
type = object_class->type;
gimp_image_signals[CLEAN] =
gimp_signal_new ("clean", GTK_RUN_FIRST, type, 0,
@ -163,6 +193,17 @@ gimp_image_class_init (GimpImageClass *klass)
gimp_sigtype_int);
gtk_object_class_add_signals (object_class, gimp_image_signals, LAST_SIGNAL);
object_class->destroy = gimp_image_destroy;
klass->clean = NULL;
klass->dirty = NULL;
klass->repaint = NULL;
klass->rename = NULL;
klass->resize = NULL;
klass->restructure = NULL;
klass->colormap_changed = NULL;
klass->undo_event = NULL;
}
@ -384,9 +425,9 @@ gimp_image_set_resolution (GimpImage *gimage,
}
void
gimp_image_get_resolution (GimpImage *gimage,
gdouble *xresolution,
gdouble *yresolution)
gimp_image_get_resolution (const GimpImage *gimage,
gdouble *xresolution,
gdouble *yresolution)
{
g_return_if_fail (xresolution && yresolution);
@ -404,7 +445,7 @@ gimp_image_set_unit (GimpImage *gimage,
}
GimpUnit
gimp_image_get_unit (GimpImage *gimage)
gimp_image_get_unit (const GimpImage *gimage)
{
return gimage->unit;
}
@ -417,11 +458,23 @@ gimp_image_set_save_proc (GimpImage *gimage,
}
PlugInProcDef *
gimp_image_get_save_proc (GimpImage *gimage)
gimp_image_get_save_proc (const GimpImage *gimage)
{
return gimage->save_proc;
}
gint
gimp_image_get_width (const GimpImage *gimage)
{
return gimage->width;
}
gint
gimp_image_get_height (const GimpImage *gimage)
{
return gimage->height;
}
void
gimp_image_resize (GimpImage *gimage,
gint new_width,
@ -518,18 +571,6 @@ gimp_image_resize (GimpImage *gimage,
gimp_remove_busy_cursors (NULL);
}
gint
gimp_image_get_width (const GimpImage *gimage)
{
return gimage->width;
}
gint
gimp_image_get_height (const GimpImage *gimage)
{
return gimage->height;
}
void
gimp_image_scale (GimpImage *gimage,
gint new_width,
@ -696,7 +737,8 @@ gimp_image_destroy (GtkObject *object)
gimp_image_free_layers (gimage);
gimp_image_free_channels (gimage);
channel_delete (gimage->selection_mask);
gtk_object_unref (GTK_OBJECT (gimage->selection_mask));
if (gimage->comp_preview)
temp_buf_free (gimage->comp_preview);
@ -941,9 +983,9 @@ gimp_image_replace_image (GimpImage *gimage,
/* Get rid of these! A "foreground" is an UI concept.. */
void
gimp_image_get_foreground (GimpImage *gimage,
GimpDrawable *drawable,
guchar *fg)
gimp_image_get_foreground (const GimpImage *gimage,
const GimpDrawable *drawable,
guchar *fg)
{
guchar pfg[3];
@ -954,9 +996,9 @@ gimp_image_get_foreground (GimpImage *gimage,
}
void
gimp_image_get_background (GimpImage *gimage,
GimpDrawable *drawable,
guchar *bg)
gimp_image_get_background (const GimpImage *gimage,
const GimpDrawable *drawable,
guchar *bg)
{
guchar pbg[3];
@ -980,7 +1022,7 @@ gimp_image_get_color_at (GimpImage *gimage,
if (x < 0 || y < 0 || x >= gimage->width || y >= gimage->height)
return NULL;
dest = g_new (unsigned char, 5);
dest = g_new (guchar, 5);
tile = tile_manager_get_tile (gimp_image_composite (gimage), x, y,
TRUE, FALSE);
src = tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT);
@ -998,10 +1040,10 @@ gimp_image_get_color_at (GimpImage *gimage,
}
void
gimp_image_get_color (GimpImage *gimage,
GimpImageType d_type,
guchar *rgb,
guchar *src)
gimp_image_get_color (const GimpImage *gimage,
GimpImageType d_type,
guchar *rgb,
guchar *src)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
@ -1020,17 +1062,17 @@ gimp_image_get_color (GimpImage *gimage,
}
void
gimp_image_transform_color (GimpImage *gimage,
GimpDrawable *drawable,
guchar *src,
guchar *dest,
GimpImageBaseType type)
gimp_image_transform_color (const GimpImage *gimage,
const GimpDrawable *drawable,
guchar *src,
guchar *dest,
GimpImageBaseType type)
{
GimpImageType d_type;
g_return_if_fail (GIMP_IS_IMAGE (gimage));
d_type = (drawable != NULL) ? drawable_type (drawable) :
d_type = (drawable != NULL) ? gimp_drawable_type (drawable) :
gimp_image_base_type_with_alpha (gimage);
switch (type)
@ -1090,7 +1132,7 @@ gimp_image_transform_color (GimpImage *gimage,
}
}
Guide*
Guide *
gimp_image_add_hguide (GimpImage *gimage)
{
Guide *guide;
@ -1108,7 +1150,7 @@ gimp_image_add_hguide (GimpImage *gimage)
return guide;
}
Guide*
Guide *
gimp_image_add_vguide (GimpImage *gimage)
{
Guide *guide;
@ -1178,8 +1220,8 @@ list_func (gchar *key,
}
gchar **
gimp_image_parasite_list (GimpImage *gimage,
gint *count)
gimp_image_parasite_list (const GimpImage *gimage,
gint *count)
{
gchar **list;
gchar **cur;
@ -1242,9 +1284,11 @@ Tattoo
gimp_image_get_new_tattoo (GimpImage *image)
{
image->tattoo_state++;
if (image->tattoo_state <= 0)
g_warning ("Tattoo state has become corrupt (2.1 billion operation limit exceded)");
return (image->tattoo_state);
return image->tattoo_state;
}
Tattoo
@ -1334,18 +1378,6 @@ gimp_image_set_tattoo_state (GimpImage *gimage,
return retval;
}
void
gimp_image_colormap_changed (GimpImage *gimage,
gint col)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (col < gimage->num_cols);
gtk_signal_emit (GTK_OBJECT (gimage),
gimp_image_signals[COLORMAP_CHANGED],
col);
}
void
gimp_image_set_paths (GimpImage *gimage,
PathList *paths)
@ -1356,13 +1388,25 @@ gimp_image_set_paths (GimpImage *gimage,
}
PathList *
gimp_image_get_paths (GimpImage *gimage)
gimp_image_get_paths (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
return gimage->paths;
}
void
gimp_image_colormap_changed (const GimpImage *gimage,
gint col)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (col < gimage->num_cols);
gtk_signal_emit (GTK_OBJECT (gimage),
gimp_image_signals[COLORMAP_CHANGED],
col);
}
/************************************************************/
/* Projection functions */
/************************************************************/
@ -1478,8 +1522,10 @@ gimp_image_free_channels (GimpImage *gimage)
for (list = gimage->channels; list; list = g_slist_next (list))
{
channel = (Channel *) list->data;
channel_delete (channel);
gtk_object_unref (GTK_OBJECT (channel));
}
g_slist_free (gimage->channels);
}
@ -1748,8 +1794,7 @@ gimp_image_construct (GimpImage *gimage,
gint x,
gint y,
gint w,
gint h,
gboolean can_use_cowproject)
gint h)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
@ -1950,8 +1995,7 @@ gimp_image_invalidate (GimpImage *gimage,
if ((endx - startx) > 0 && (endy - starty) > 0)
gimp_image_construct (gimage,
startx, starty,
(endx - startx), (endy - starty),
TRUE);
(endx - startx), (endy - starty));
}
void
@ -1972,12 +2016,12 @@ gimp_image_validate (TileManager *tm,
w = tile_ewidth (tile);
h = tile_eheight (tile);
gimp_image_construct (gimage, x, y, w, h, FALSE);
gimp_image_construct (gimage, x, y, w, h);
}
gint
gimp_image_get_layer_index (GimpImage *gimage,
Layer *layer_arg)
gimp_image_get_layer_index (const GimpImage *gimage,
const Layer *layer_arg)
{
Layer *layer;
GSList *layers;
@ -1990,6 +2034,7 @@ gimp_image_get_layer_index (GimpImage *gimage,
layers = g_slist_next (layers), index++)
{
layer = (Layer *) layers->data;
if (layer == layer_arg)
return index;
}
@ -1998,23 +2043,22 @@ gimp_image_get_layer_index (GimpImage *gimage,
}
Layer *
gimp_image_get_layer_by_index (GimpImage *gimage,
gint layer_index)
gimp_image_get_layer_by_index (const GimpImage *gimage,
gint layer_index)
{
Layer *layer;
g_return_val_if_fail (gimage != NULL, NULL);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
layer =
(Layer *) g_slist_nth_data (gimage->layers, layer_index);
layer = (Layer *) g_slist_nth_data (gimage->layers, layer_index);
return layer;
}
gint
gimp_image_get_channel_index (GimpImage *gimage,
Channel *channel_ID)
gimp_image_get_channel_index (const GimpImage *gimage,
const Channel *channel_arg)
{
Channel *channel;
GSList *channels;
@ -2028,7 +2072,8 @@ gimp_image_get_channel_index (GimpImage *gimage,
channels = g_slist_next (channels), index++)
{
channel = (Channel *) channels->data;
if (channel == channel_ID)
if (channel == channel_arg)
return index;
}
@ -2036,7 +2081,7 @@ gimp_image_get_channel_index (GimpImage *gimage,
}
Layer *
gimp_image_get_active_layer (GimpImage *gimage)
gimp_image_get_active_layer (const GimpImage *gimage)
{
g_return_val_if_fail (gimage != NULL, NULL);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
@ -2045,7 +2090,7 @@ gimp_image_get_active_layer (GimpImage *gimage)
}
Channel *
gimp_image_get_active_channel (GimpImage *gimage)
gimp_image_get_active_channel (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
@ -2053,8 +2098,8 @@ gimp_image_get_active_channel (GimpImage *gimage)
}
Layer *
gimp_image_get_layer_by_tattoo (GimpImage *gimage,
Tattoo tattoo)
gimp_image_get_layer_by_tattoo (const GimpImage *gimage,
Tattoo tattoo)
{
Layer *layer;
GSList *layers;
@ -2066,6 +2111,7 @@ gimp_image_get_layer_by_tattoo (GimpImage *gimage,
layers = g_slist_next (layers))
{
layer = (Layer *) layers->data;
if (layer_get_tattoo (layer) == tattoo)
return layer;
}
@ -2074,8 +2120,8 @@ gimp_image_get_layer_by_tattoo (GimpImage *gimage,
}
Channel *
gimp_image_get_channel_by_tattoo (GimpImage *gimage,
Tattoo tattoo)
gimp_image_get_channel_by_tattoo (const GimpImage *gimage,
Tattoo tattoo)
{
Channel *channel;
GSList *channels;
@ -2087,6 +2133,7 @@ gimp_image_get_channel_by_tattoo (GimpImage *gimage,
channels = g_slist_next (channels))
{
channel = (Channel *) channels->data;
if (channel_get_tattoo (channel) == tattoo)
return channel;
}
@ -2095,8 +2142,8 @@ gimp_image_get_channel_by_tattoo (GimpImage *gimage,
}
Channel *
gimp_image_get_channel_by_name (GimpImage *gimage,
char *name)
gimp_image_get_channel_by_name (const GimpImage *gimage,
const gchar *name)
{
Channel *channel;
GSList *channels;
@ -2108,16 +2155,24 @@ gimp_image_get_channel_by_name (GimpImage *gimage,
channels = g_slist_next (channels))
{
channel = (Channel *) channels->data;
if (! strcmp(channel_get_name (channel),name) )
if (! strcmp (drawable_get_name (GIMP_DRAWABLE (channel)), name))
return channel;
}
return NULL;
}
gint
gimp_image_get_component_active (GimpImage *gimage,
ChannelType type)
Channel *
gimp_image_get_mask (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
return gimage->selection_mask;
}
gboolean
gimp_image_get_component_active (const GimpImage *gimage,
ChannelType type)
{
/* No sanity checking here... */
switch (type)
@ -2131,9 +2186,9 @@ gimp_image_get_component_active (GimpImage *gimage,
}
}
gint
gimp_image_get_component_visible (GimpImage *gimage,
ChannelType type)
gboolean
gimp_image_get_component_visible (const GimpImage *gimage,
ChannelType type)
{
/* No sanity checking here... */
switch (type)
@ -2147,35 +2202,29 @@ gimp_image_get_component_visible (GimpImage *gimage,
}
}
Channel *
gimp_image_get_mask (GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
return gimage->selection_mask;
}
gboolean
gimp_image_layer_boundary (GimpImage *gimage,
BoundSeg **segs,
int *num_segs)
gimp_image_layer_boundary (const GimpImage *gimage,
BoundSeg **segs,
gint *n_segs)
{
Layer *layer;
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
g_return_val_if_fail (segs != NULL, FALSE);
g_return_val_if_fail (n_segs != NULL, FALSE);
/* The second boundary corresponds to the active layer's
* perimeter...
*/
if ((layer = gimage->active_layer))
{
*segs = layer_boundary (layer, num_segs);
*segs = layer_boundary (layer, n_segs);
return TRUE;
}
else
{
*segs = NULL;
*num_segs = 0;
*n_segs = 0;
return FALSE;
}
}
@ -2185,6 +2234,7 @@ gimp_image_set_active_layer (GimpImage *gimage,
Layer *layer)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
g_return_val_if_fail (GIMP_IS_LAYER (layer), NULL);
/* First, find the layer in the gimage
* If it isn't valid, find the first layer that is
@ -2264,16 +2314,16 @@ gimp_image_unset_active_channel (GimpImage *gimage)
void
gimp_image_set_component_active (GimpImage *gimage,
ChannelType type,
gint value)
gboolean active)
{
/* No sanity checking here... */
switch (type)
{
case RED_CHANNEL: gimage->active[RED_PIX] = value; break;
case GREEN_CHANNEL: gimage->active[GREEN_PIX] = value; break;
case BLUE_CHANNEL: gimage->active[BLUE_PIX] = value; break;
case GRAY_CHANNEL: gimage->active[GRAY_PIX] = value; break;
case INDEXED_CHANNEL: gimage->active[INDEXED_PIX] = value; break;
case RED_CHANNEL: gimage->active[RED_PIX] = active; break;
case GREEN_CHANNEL: gimage->active[GREEN_PIX] = active; break;
case BLUE_CHANNEL: gimage->active[BLUE_PIX] = active; break;
case GRAY_CHANNEL: gimage->active[GRAY_PIX] = active; break;
case INDEXED_CHANNEL: gimage->active[INDEXED_PIX] = active; break;
case AUXILLARY_CHANNEL: break;
}
@ -2287,24 +2337,24 @@ gimp_image_set_component_active (GimpImage *gimage,
void
gimp_image_set_component_visible (GimpImage *gimage,
ChannelType type,
gint value)
gboolean visible)
{
/* No sanity checking here... */
switch (type)
{
case RED_CHANNEL: gimage->visible[RED_PIX] = value; break;
case GREEN_CHANNEL: gimage->visible[GREEN_PIX] = value; break;
case BLUE_CHANNEL: gimage->visible[BLUE_PIX] = value; break;
case GRAY_CHANNEL: gimage->visible[GRAY_PIX] = value; break;
case INDEXED_CHANNEL: gimage->visible[INDEXED_PIX] = value; break;
case RED_CHANNEL: gimage->visible[RED_PIX] = visible; break;
case GREEN_CHANNEL: gimage->visible[GREEN_PIX] = visible; break;
case BLUE_CHANNEL: gimage->visible[BLUE_PIX] = visible; break;
case GRAY_CHANNEL: gimage->visible[GRAY_PIX] = visible; break;
case INDEXED_CHANNEL: gimage->visible[INDEXED_PIX] = visible; break;
default: break;
}
}
Layer *
gimp_image_pick_correlate_layer (GimpImage *gimage,
gint x,
gint y)
gimp_image_pick_correlate_layer (const GimpImage *gimage,
gint x,
gint y)
{
Layer *layer;
GSList *list;
@ -2322,8 +2372,6 @@ gimp_image_pick_correlate_layer (GimpImage *gimage,
return NULL;
}
Layer *
gimp_image_raise_layer (GimpImage *gimage,
Layer *layer_arg)
@ -2763,7 +2811,7 @@ gimp_image_merge_layers (GimpImage *gimage,
}
merge_layer = layer_new (gimage, (x2 - x1), (y2 - y1),
type, drawable_get_name (GIMP_DRAWABLE(layer)),
type, drawable_get_name (GIMP_DRAWABLE (layer)),
OPAQUE_OPACITY, NORMAL_MODE);
if (!merge_layer)
{
@ -3009,12 +3057,18 @@ gimp_image_add_layer (GimpImage *gimage,
position = 1;
gimage->layers =
g_slist_insert (gimage->layers, layer_ref (float_layer), position);
g_slist_insert (gimage->layers, float_layer, position);
gtk_object_ref (GTK_OBJECT (float_layer));
gtk_object_sink (GTK_OBJECT (float_layer));
}
else
{
gimage->layers =
g_slist_prepend (gimage->layers, layer_ref (float_layer));
g_slist_prepend (gimage->layers, float_layer);
gtk_object_ref (GTK_OBJECT (float_layer));
gtk_object_sink (GTK_OBJECT (float_layer));
}
gimage->layer_stack = g_slist_prepend (gimage->layer_stack, float_layer);
@ -3374,7 +3428,10 @@ gimp_image_add_channel (GimpImage *gimage,
undo_push_channel (gimage, CHANNEL_ADD_UNDO, cu);
/* add the channel to the list */
gimage->channels = g_slist_prepend (gimage->channels, channel_ref (channel));
gimage->channels = g_slist_prepend (gimage->channels, channel);
gtk_object_ref (GTK_OBJECT (channel));
gtk_object_sink (GTK_OBJECT (channel));
/* notify this gimage of the currently active channel */
gimp_image_set_active_channel (gimage, channel);
@ -3419,9 +3476,9 @@ gimp_image_remove_channel (GimpImage *gimage,
0, 0,
drawable_width (GIMP_DRAWABLE(channel)),
drawable_height (GIMP_DRAWABLE(channel)));
/* Send out REMOVED signal from channel */
channel_removed (channel, gimage);
channel_removed (channel);
/* Important to push the undo here in case the push fails */
undo_push_channel (gimage, CHANNEL_REMOVE_UNDO, cu);
@ -3434,48 +3491,55 @@ gimp_image_remove_channel (GimpImage *gimage,
/************************************************************/
gboolean
gimp_image_is_empty (GimpImage *gimage)
gimp_image_is_empty (const GimpImage *gimage)
{
g_return_val_if_fail (gimage != NULL, TRUE);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), TRUE);
return (! gimage->layers);
return ! gimage->layers;
}
GimpDrawable *
gimp_image_active_drawable (GimpImage *gimage)
gimp_image_active_drawable (const GimpImage *gimage)
{
Layer *layer;
g_return_val_if_fail (gimage != NULL, NULL);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
/* If there is an active channel (a saved selection, etc.),
* we ignore the active layer
*/
if (gimage->active_channel != NULL)
return GIMP_DRAWABLE (gimage->active_channel);
{
return GIMP_DRAWABLE (gimage->active_channel);
}
else if (gimage->active_layer != NULL)
{
layer = gimage->active_layer;
if (layer->mask && layer->edit_mask)
return GIMP_DRAWABLE(layer->mask);
return GIMP_DRAWABLE (layer->mask);
else
return GIMP_DRAWABLE(layer);
return GIMP_DRAWABLE (layer);
}
else
return NULL;
return NULL;
}
GimpImageBaseType
gimp_image_base_type (GimpImage *gimage)
{
gimp_image_base_type (const GimpImage *gimage)
{
g_return_val_if_fail (gimage != NULL, -1);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), -1);
return gimage->base_type;
}
GimpImageType
gimp_image_base_type_with_alpha (GimpImage *gimage)
gimp_image_base_type_with_alpha (const GimpImage *gimage)
{
g_return_val_if_fail (gimage != NULL, -1);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), -1);
switch (gimage->base_type)
@ -3490,9 +3554,10 @@ gimp_image_base_type_with_alpha (GimpImage *gimage)
return RGB_GIMAGE;
}
gchar *
gimp_image_filename (GimpImage *gimage)
const gchar *
gimp_image_filename (const GimpImage *gimage)
{
g_return_val_if_fail (gimage != NULL, NULL);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
if (gimage->has_filename)
@ -3502,7 +3567,7 @@ gimp_image_filename (GimpImage *gimage)
}
gboolean
gimp_image_undo_is_enabled (GimpImage *gimage)
gimp_image_undo_is_enabled (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
@ -3550,7 +3615,7 @@ gimp_image_undo_enable (GimpImage *gimage)
void
gimp_image_undo_event (GimpImage *gimage,
int event)
gint event)
{
gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[UNDO_EVENT], event);
}
@ -3592,10 +3657,10 @@ gimp_image_dirty (GimpImage *gimage)
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
gimage->dirty++;
gtk_signal_emit(GTK_OBJECT(gimage), gimp_image_signals[DIRTY]);
gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[DIRTY]);
TRC (("dirty %d -> %d\n", gimage->dirty-1, gimage->dirty));
return gimage->dirty;
}
@ -3605,7 +3670,7 @@ gimp_image_clean (GimpImage *gimage)
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
gimage->dirty--;
gtk_signal_emit(GTK_OBJECT(gimage), gimp_image_signals[CLEAN]);
gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[CLEAN]);
TRC (("clean %d -> %d\n", gimage->dirty+1, gimage->dirty));
@ -3619,11 +3684,11 @@ gimp_image_clean_all (GimpImage *gimage)
gimage->dirty = 0;
gtk_signal_emit (GTK_OBJECT(gimage), gimp_image_signals[CLEAN]);
gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[CLEAN]);
}
Layer *
gimp_image_floating_sel (GimpImage *gimage)
gimp_image_floating_sel (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
@ -3634,7 +3699,7 @@ gimp_image_floating_sel (GimpImage *gimage)
}
guchar *
gimp_image_cmap (GimpImage *gimage)
gimp_image_cmap (const GimpImage *gimage)
{
return drawable_cmap (gimp_image_active_drawable (gimage));
}
@ -3651,13 +3716,15 @@ gimp_image_projection (GimpImage *gimage)
if ((gimage->projection == NULL) ||
(tile_manager_level_width (gimage->projection) != gimage->width) ||
(tile_manager_level_height (gimage->projection) != gimage->height))
gimp_image_allocate_projection (gimage);
{
gimp_image_allocate_projection (gimage);
}
return gimage->projection;
}
GimpImageType
gimp_image_projection_type (GimpImage *gimage)
gimp_image_projection_type (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), -1);
@ -3665,7 +3732,7 @@ gimp_image_projection_type (GimpImage *gimage)
}
gint
gimp_image_projection_bytes (GimpImage *gimage)
gimp_image_projection_bytes (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), -1);
@ -3673,7 +3740,7 @@ gimp_image_projection_bytes (GimpImage *gimage)
}
gint
gimp_image_projection_opacity (GimpImage *gimage)
gimp_image_projection_opacity (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), -1);
@ -3697,13 +3764,13 @@ gimp_image_composite (GimpImage *gimage)
}
GimpImageType
gimp_image_composite_type (GimpImage *gimage)
gimp_image_composite_type (const GimpImage *gimage)
{
return gimp_image_projection_type (gimage);
}
gint
gimp_image_composite_bytes (GimpImage *gimage)
gimp_image_composite_bytes (const GimpImage *gimage)
{
return gimp_image_projection_bytes (gimage);
}
@ -3913,8 +3980,8 @@ gimp_image_composite_preview (GimpImage *gimage,
}
gboolean
gimp_image_preview_valid (GimpImage *gimage,
ChannelType type)
gimp_image_preview_valid (const GimpImage *gimage,
ChannelType type)
{
switch (type)
{

View File

@ -88,10 +88,10 @@ typedef enum
struct _Guide
{
int ref_count;
int position;
int orientation;
guint32 guide_ID;
gint ref_count;
gint position;
InternalOrientationType orientation;
guint32 guide_ID;
};
@ -105,76 +105,103 @@ typedef struct _GimpImageRepaintArg
} GimpImageRepaintArg;
GtkType gimp_image_get_type (void);
/* function declarations */
GimpImage * gimp_image_new (gint, gint,
GimpImageBaseType);
void gimp_image_set_filename (GimpImage *, gchar *);
void gimp_image_set_resolution (GimpImage *,
gdouble, gdouble);
void gimp_image_get_resolution (GimpImage *,
gdouble *, gdouble *);
void gimp_image_set_unit (GimpImage *, GimpUnit);
GimpUnit gimp_image_get_unit (GimpImage *);
void gimp_image_set_save_proc (GimpImage *,
PlugInProcDef *);
PlugInProcDef * gimp_image_get_save_proc (GimpImage *);
gint gimp_image_get_width (const GimpImage *);
gint gimp_image_get_height (const GimpImage *);
void gimp_image_resize (GimpImage *,
gint, gint, gint, gint);
void gimp_image_scale (GimpImage *, gint, gint);
GimpImage * gimp_image_get_named (gchar *);
GimpImage * gimp_image_get_ID (gint);
TileManager * gimp_image_shadow (GimpImage *,
gint, gint, gint);
void gimp_image_free_shadow (GimpImage *);
void gimp_image_apply_image (GimpImage *, GimpDrawable *,
PixelRegion *, gint,
gint,
LayerModeEffects,
TileManager *, gint, gint);
void gimp_image_replace_image (GimpImage *, GimpDrawable *,
PixelRegion *, gint, gint,
PixelRegion *, gint, gint);
void gimp_image_get_foreground (GimpImage *, GimpDrawable *,
guchar *);
void gimp_image_get_background (GimpImage *, GimpDrawable *,
guchar *);
guchar * gimp_image_get_color_at (GimpImage *, gint, gint);
void gimp_image_get_color (GimpImage *,
GimpImageType,
guchar *,
guchar *);
void gimp_image_transform_color (GimpImage *,
GimpDrawable *,
guchar *,
guchar *,
GimpImageBaseType);
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 *);
GtkType gimp_image_get_type (void);
GimpParasite * gimp_image_parasite_find (const GimpImage *,
const gchar *name);
gchar ** gimp_image_parasite_list (GimpImage *gimage,
gint *count);
void gimp_image_parasite_attach (GimpImage *,
GimpParasite *);
void gimp_image_parasite_detach (GimpImage *, const gchar *);
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);
Tattoo gimp_image_get_new_tattoo (GimpImage *);
gboolean gimp_image_set_tattoo_state (GimpImage *, Tattoo);
Tattoo gimp_image_get_tattoo_state (GimpImage *);
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);
void gimp_image_set_paths (GimpImage *, PathList *);
PathList * gimp_image_get_paths (GimpImage *);
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);
/* Temporary hack till colormap manipulation is encapsulated in functions.
Call this whenever you modify an image's colormap. The ncol argument
@ -182,115 +209,169 @@ PathList * gimp_image_get_paths (GimpImage *);
Currently, use this also when the image's base type is changed to/from
indexed. */
void gimp_image_colormap_changed (GimpImage * image,
gint ncol);
void gimp_image_colormap_changed (const GimpImage *image,
gint col);
/* layer/channel functions */
gint gimp_image_get_layer_index (GimpImage *, Layer *);
Layer * gimp_image_get_layer_by_index (GimpImage *, gint);
gint gimp_image_get_channel_index (GimpImage *, Channel *);
Layer * gimp_image_get_active_layer (GimpImage *);
Channel * gimp_image_get_active_channel (GimpImage *);
Layer * gimp_image_get_layer_by_tattoo (GimpImage *, Tattoo);
Channel * gimp_image_get_channel_by_tattoo (GimpImage *, Tattoo);
Channel * gimp_image_get_channel_by_name (GimpImage *, gchar *);
Channel * gimp_image_get_mask (GimpImage *);
gint gimp_image_get_component_active (GimpImage *, ChannelType);
gint gimp_image_get_component_visible (GimpImage *, ChannelType);
gboolean gimp_image_layer_boundary (GimpImage *, BoundSeg **,
gint *);
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,
gint);
void gimp_image_set_component_visible (GimpImage *, ChannelType,
gint);
Layer * gimp_image_pick_correlate_layer (GimpImage *, gint, gint);
void gimp_image_set_layer_mask_apply (GimpImage *, gint);
void gimp_image_set_layer_mask_edit (GimpImage *, Layer *, gint);
void gimp_image_set_layer_mask_show (GimpImage *, gint);
Layer * gimp_image_raise_layer (GimpImage *, Layer *);
Layer * gimp_image_lower_layer (GimpImage *, Layer *);
Layer * gimp_image_raise_layer_to_top (GimpImage *, Layer *);
Layer * gimp_image_lower_layer_to_bottom (GimpImage *, Layer *);
Layer * gimp_image_position_layer (GimpImage *, Layer *,
gint, gboolean);
Layer * gimp_image_merge_visible_layers (GimpImage *, MergeType);
Layer * gimp_image_merge_down (GimpImage *, Layer *,
MergeType);
Layer * gimp_image_flatten (GimpImage *);
Layer * gimp_image_merge_layers (GimpImage *, GSList *,
MergeType);
Layer * gimp_image_add_layer (GimpImage *, Layer *, gint);
Layer * gimp_image_remove_layer (GimpImage *, Layer *);
LayerMask * gimp_image_add_layer_mask (GimpImage *, Layer *,
LayerMask *);
Channel * gimp_image_remove_layer_mask (GimpImage *, Layer *,
MaskApplyMode);
Channel * gimp_image_raise_channel (GimpImage *, Channel *);
Channel * gimp_image_lower_channel (GimpImage *, Channel *);
Channel * gimp_image_position_channel (GimpImage *, Channel *, gint);
Channel * gimp_image_add_channel (GimpImage *, Channel *, gint);
Channel * gimp_image_remove_channel (GimpImage *, Channel *);
void gimp_image_construct (GimpImage *,
gint, gint, gint, gint,
gboolean);
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 *, gint, gint,
gint, gint, gint,
gint, gint, gint);
void gimp_image_invalidate (GimpImage *, gint, gint,
gint, gint, gint,
gint, gint, gint);
void gimp_image_validate (TileManager *, Tile *);
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);
/* Access functions */
gboolean gimp_image_is_empty (GimpImage *);
GimpDrawable * gimp_image_active_drawable (GimpImage *);
gboolean gimp_image_is_empty (const GimpImage *gimage);
GimpDrawable * gimp_image_active_drawable (const GimpImage *gimage);
GimpImageBaseType gimp_image_base_type (GimpImage *gimage);
GimpImageType gimp_image_base_type_with_alpha (GimpImage *gimage);
GimpImageBaseType gimp_image_base_type (const GimpImage *gimage);
GimpImageType gimp_image_base_type_with_alpha (const GimpImage *gimage);
gchar * gimp_image_filename (GimpImage *);
gboolean gimp_image_undo_is_enabled (GimpImage *);
gboolean gimp_image_undo_enable (GimpImage *);
gboolean gimp_image_undo_disable (GimpImage *);
gboolean gimp_image_undo_freeze (GimpImage *);
gboolean gimp_image_undo_thaw (GimpImage *);
void gimp_image_undo_event (GimpImage *, gint);
gint gimp_image_dirty (GimpImage *);
gint gimp_image_clean (GimpImage *);
void gimp_image_clean_all (GimpImage *);
Layer * gimp_image_floating_sel (GimpImage *);
guchar * gimp_image_cmap (GimpImage *);
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);
/* projection access functions */
TileManager * gimp_image_projection (GimpImage *);
GimpImageType gimp_image_projection_type (GimpImage *);
gint gimp_image_projection_bytes (GimpImage *);
gint gimp_image_projection_opacity (GimpImage *);
void gimp_image_projection_realloc (GimpImage *);
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);
/* composite access functions */
TileManager * gimp_image_composite (GimpImage *);
GimpImageType gimp_image_composite_type (GimpImage *);
gint gimp_image_composite_bytes (GimpImage *);
TempBuf * gimp_image_composite_preview (GimpImage *, ChannelType,
gint, gint);
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);
gint gimp_image_preview_valid (GimpImage *, ChannelType);
void gimp_image_invalidate_preview (GimpImage *);
gint gimp_image_preview_valid (const GimpImage *gimage,
ChannelType type);
void gimp_image_invalidate_preview (GimpImage *gimage);
void gimp_image_invalidate_previews (void);
void gimp_image_invalidate_previews (void);
TempBuf * gimp_image_construct_composite_preview (GimpImage *,
gint , gint);
TempBuf * gimp_image_construct_composite_preview (GimpImage *gimage,
gint width,
gint height);
#endif /* __GIMPIMAGE_H__ */

View File

@ -16,8 +16,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __GIMPIMAGEP_H__
#define __GIMPIMAGEP_H__
#ifndef __GIMP_IMAGE_P_H__
#define __GIMP_IMAGE_P_H__
#include <gtk/gtk.h> /* eeeek */
@ -35,90 +35,97 @@
#define MAX_CHANNELS 4
#define GIMP_IMAGE_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, GIMP_TYPE_IMAGE, GimpImageClass)
typedef struct _GimpImageClass GimpImageClass;
struct _GimpImage
{
GimpObject gobject;
GimpObject gobject;
gchar *filename; /* original filename */
gboolean has_filename; /* has a valid filename */
PlugInProcDef *save_proc; /* last PDB save proc used */
gchar *filename; /* original filename */
gboolean has_filename; /* has a valid filename */
PlugInProcDef *save_proc; /* last PDB save proc used */
gint width, height; /* width and height attributes */
gdouble xresolution; /* image x-res, in dpi */
gdouble yresolution; /* image y-res, in dpi */
GimpUnit unit; /* image unit */
GimpImageBaseType base_type; /* base gimp_image type */
gint width, height; /* width and height attributes */
gdouble xresolution; /* image x-res, in dpi */
gdouble yresolution; /* image y-res, in dpi */
GimpUnit unit; /* image unit */
GimpImageBaseType base_type; /* base gimp_image type */
guchar *cmap; /* colormap--for indexed */
gint num_cols; /* number of cols--for indexed */
guchar *cmap; /* colormap--for indexed */
gint num_cols; /* number of cols--for indexed */
gint dirty; /* dirty flag -- # of ops */
gboolean undo_on; /* Is undo enabled? */
gint dirty; /* dirty flag -- # of ops */
gboolean undo_on; /* Is undo enabled? */
gint instance_count; /* number of instances */
gint disp_count; /* number of displays */
gint instance_count; /* number of instances */
gint disp_count; /* number of displays */
Tattoo tattoo_state; /* the next unique tattoo to use*/
Tattoo tattoo_state; /* the next unique tattoo to use*/
TileManager *shadow; /* shadow buffer tiles */
TileManager *shadow; /* shadow buffer tiles */
/* Projection attributes */
gint construct_flag; /* flag for construction */
GimpImageType proj_type; /* type of the projection image */
gint proj_bytes; /* bpp in projection image */
gint proj_level; /* projection level */
TileManager *projection; /* The projection--layers & */
/* channels */
/* Projection attributes */
gint construct_flag; /* flag for construction */
GimpImageType proj_type; /* type of the projection image */
gint proj_bytes; /* bpp in projection image */
gint proj_level; /* projection level */
TileManager *projection; /* The projection--layers & */
/* channels */
GList *guides; /* guides */
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/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 */
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 */
ParasiteList *parasites; /* Plug-in parasite data */
ParasiteList *parasites; /* Plug-in parasite data */
PathList *paths; /* Paths data for this image */
PathList *paths; /* Paths data for this image */
gint visible [MAX_CHANNELS]; /* visible channels */
gint active [MAX_CHANNELS]; /* active channels */
gboolean visible[MAX_CHANNELS]; /* visible channels */
gboolean active[MAX_CHANNELS]; /* active channels */
gboolean by_color_select; /* TRUE if there's an active */
/* "by color" selection dialog */
gboolean by_color_select; /* TRUE if there's an active */
/* "by color" selection dialog */
gboolean qmask_state; /* TRUE if qmask is on */
gdouble qmask_opacity; /* opacity of the qmask channel */
guchar qmask_color[3]; /* rgb triplet of the color */
gboolean qmask_state; /* TRUE if qmask is on */
gdouble qmask_opacity; /* opacity of the qmask channel */
guchar qmask_color[3]; /* rgb triplet of the color */
/* Undo apparatus */
GSList *undo_stack; /* stack for undo operations */
GSList *redo_stack; /* stack for redo operations */
gint undo_bytes; /* bytes in undo stack */
gint undo_levels; /* levels in undo stack */
gint group_count; /* nested undo groups */
UndoType pushing_undo_group; /* undo group status flag */
GtkWidget *undo_history; /* history viewer, or NULL */
/* Undo apparatus */
GSList *undo_stack; /* stack for undo operations */
GSList *redo_stack; /* stack for redo operations */
gint undo_bytes; /* bytes in undo stack */
gint undo_levels; /* levels in undo stack */
gint group_count; /* nested undo groups */
UndoType pushing_undo_group; /* undo group status flag */
GtkWidget *undo_history; /* history viewer, or NULL */
/* Composite preview */
TempBuf *comp_preview; /* the composite preview */
gboolean comp_preview_valid[3]; /* preview valid-1/channel */
/* Composite preview */
TempBuf *comp_preview; /* the composite preview */
gboolean comp_preview_valid[3]; /* preview valid-1/channel */
};
struct _GimpImageClass
{
GimpObjectClass parent_class;
void (*dirty) (GtkObject*);
void (*repaint) (GtkObject*);
void (*rename) (GtkObject*);
void (* clean) (GimpImage *gimage);
void (* dirty) (GimpImage *gimage);
void (* repaint) (GimpImage *gimage);
void (* rename) (GimpImage *gimage);
void (* resize) (GimpImage *gimage);
void (* restructure) (GimpImage *gimage);
void (* colormap_changed) (GimpImage *gimage);
void (* undo_event) (GimpImage *gimage);
};
typedef struct _GimpImageClass GimpImageClass;
#define GIMP_IMAGE_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, GIMP_TYPE_IMAGE, GimpImageClass)
#endif /* __GIMPIMAGEP_H__ */
#endif /* __GIMP_IMAGE_P_H__ */

View File

@ -54,21 +54,21 @@ enum
LAST_SIGNAL
};
static void gimp_layer_class_init (GimpLayerClass *klass);
static void gimp_layer_init (GimpLayer *layer);
static void gimp_layer_destroy (GtkObject *object);
static void layer_invalidate_preview (GtkObject *object);
static void gimp_layer_class_init (GimpLayerClass *klass);
static void gimp_layer_init (GimpLayer *layer);
static void gimp_layer_destroy (GtkObject *object);
static void layer_invalidate_preview (GimpDrawable *object);
static void gimp_layer_mask_class_init (GimpLayerMaskClass *klass);
static void gimp_layer_mask_init (GimpLayerMask *layermask);
static void gimp_layer_mask_destroy (GtkObject *object);
static void gimp_layer_mask_class_init (GimpLayerMaskClass *klass);
static void gimp_layer_mask_init (GimpLayerMask *layermask);
static void gimp_layer_mask_destroy (GtkObject *object);
static TempBuf * layer_preview_private (Layer *layer,
gint width,
gint height);
static TempBuf * layer_mask_preview_private (Layer *layer,
gint width,
gint height);
static TempBuf * layer_preview_private (Layer *layer,
gint width,
gint height);
static TempBuf * layer_mask_preview_private (Layer *layer,
gint width,
gint height);
static guint layer_signals[LAST_SIGNAL] = { 0 };
@ -77,7 +77,7 @@ static guint layer_signals[LAST_SIGNAL] = { 0 };
static guint layer_mask_signals[LAST_SIGNAL] = { 0 };
*/
static GimpDrawableClass *layer_parent_class = NULL;
static GimpDrawableClass *layer_parent_class = NULL;
static GimpChannelClass *layer_mask_parent_class = NULL;
GtkType
@ -99,22 +99,22 @@ gimp_layer_get_type (void)
(GtkClassInitFunc) NULL,
};
layer_type = gtk_type_unique (gimp_drawable_get_type (), &layer_info);
layer_type = gtk_type_unique (GIMP_TYPE_DRAWABLE, &layer_info);
}
return layer_type;
}
static void
gimp_layer_class_init (GimpLayerClass *class)
gimp_layer_class_init (GimpLayerClass *klass)
{
GtkObjectClass *object_class;
GimpDrawableClass *drawable_class;
object_class = (GtkObjectClass*) class;
drawable_class = (GimpDrawableClass*) class;
object_class = (GtkObjectClass *) klass;
drawable_class = (GimpDrawableClass *) klass;
layer_parent_class = gtk_type_class (gimp_drawable_get_type ());
layer_parent_class = gtk_type_class (GIMP_TYPE_DRAWABLE);
layer_signals[REMOVED] =
gimp_signal_new ("removed",
@ -123,7 +123,10 @@ gimp_layer_class_init (GimpLayerClass *class)
gtk_object_class_add_signals (object_class, layer_signals, LAST_SIGNAL);
object_class->destroy = gimp_layer_destroy;
drawable_class->invalidate_preview = layer_invalidate_preview;
klass->removed = NULL;
}
static void
@ -201,14 +204,14 @@ gint layer_get_count = 0;
/********************************/
static void
layer_invalidate_preview (GtkObject *object)
layer_invalidate_preview (GimpDrawable *drawable)
{
GimpLayer *layer;
g_return_if_fail (object != NULL);
g_return_if_fail (GIMP_IS_LAYER (object));
g_return_if_fail (drawable != NULL);
g_return_if_fail (GIMP_IS_LAYER (drawable));
layer = GIMP_LAYER (object);
layer = GIMP_LAYER (drawable);
if (layer_is_floating_sel (layer))
floating_sel_invalidate (layer);
@ -261,7 +264,7 @@ layer_new (GimpImage *gimage,
gint width,
gint height,
GimpImageType type,
gchar *name,
const gchar *name,
gint opacity,
LayerModeEffects mode)
{
@ -301,21 +304,6 @@ layer_new (GimpImage *gimage,
return layer;
}
Layer *
layer_ref (Layer *layer)
{
gtk_object_ref (GTK_OBJECT (layer));
gtk_object_sink (GTK_OBJECT (layer));
return layer;
}
void
layer_unref (Layer *layer)
{
gtk_object_unref (GTK_OBJECT (layer));
}
Layer *
layer_copy (Layer *layer,
gboolean add_alpha)
@ -325,7 +313,7 @@ layer_copy (Layer *layer,
GimpImageType new_type;
gchar *ext;
gint number;
gchar *name;
const gchar *name;
gint len;
PixelRegion srcPR;
PixelRegion destPR;
@ -1281,14 +1269,14 @@ layer_pick_correlate (Layer *layer,
/**********************/
void
layer_set_name (Layer *layer,
gchar *name)
layer_set_name (Layer *layer,
const gchar *name)
{
gimp_drawable_set_name (GIMP_DRAWABLE (layer), name);
}
gchar *
layer_get_name (Layer *layer)
const gchar *
layer_get_name (const Layer *layer)
{
return gimp_drawable_get_name (GIMP_DRAWABLE (layer));
}
@ -1531,12 +1519,12 @@ layer_mask_preview_private (Layer *layer,
Tattoo
layer_get_tattoo (const Layer *layer)
{
return (gimp_drawable_get_tattoo (GIMP_DRAWABLE (layer)));
return gimp_drawable_get_tattoo (GIMP_DRAWABLE (layer));
}
void
layer_set_tattoo (const Layer *layer,
Tattoo value)
layer_set_tattoo (Layer *layer,
Tattoo value)
{
gimp_drawable_set_tattoo (GIMP_DRAWABLE (layer), value);
}

View File

@ -71,19 +71,17 @@ struct _fs_to_layer_undo
/* function declarations */
Layer * layer_new (GimpImage *gimage,
gint width,
gint height,
GimpImageType type,
gchar *name,
gint opacity,
LayerModeEffects mode);
Layer * layer_copy (Layer *layer,
gboolean add_alpha);
Layer * layer_ref (Layer *layer);
void layer_unref (Layer *layer);
Layer * layer_new (GimpImage *gimage,
gint width,
gint height,
GimpImageType type,
const gchar *name,
gint opacity,
LayerModeEffects mode);
Layer * layer_copy (Layer *layer,
gboolean add_alpha);
Layer * layer_new_from_tiles (GimpImage *gimage,
Layer * layer_new_from_tiles (GimpImage *gimage,
GimpImageType layer_type,
TileManager *tiles,
gchar *name,
@ -92,11 +90,11 @@ Layer * layer_new_from_tiles (GimpImage *gimage,
gboolean layer_check_scaling (Layer *layer,
gint new_width,
gint new_height);
LayerMask * layer_create_mask (Layer *layer,
LayerMask * layer_create_mask (Layer *layer,
AddMaskType add_mask_type);
LayerMask * layer_add_mask (Layer *layer,
LayerMask * layer_add_mask (Layer *layer,
LayerMask *mask);
Layer * layer_get_ID (gint ID);
Layer * layer_get_ID (gint ID);
void layer_delete (Layer *layer);
void layer_removed (Layer *layer,
gpointer data);
@ -119,49 +117,49 @@ void layer_resize (Layer *layer,
gint offx,
gint offy);
void layer_resize_to_image (Layer *layer);
BoundSeg * layer_boundary (Layer *layer,
BoundSeg * layer_boundary (Layer *layer,
gint *num_segs);
void layer_invalidate_boundary (Layer *layer);
gint layer_pick_correlate (Layer *layer,
gint x,
gint y);
LayerMask * layer_mask_new (GimpImage *gimage,
gint width,
gint height,
gchar *name,
gint opacity,
guchar *col);
LayerMask * layer_mask_copy (LayerMask *layer_mask);
void layer_mask_delete (LayerMask *layer_mask);
LayerMask * layer_mask_get_ID (gint ID);
LayerMask * layer_mask_ref (LayerMask *layer_mask);
void layer_mask_unref (LayerMask *layer_mask);
void layer_mask_set_layer (LayerMask *layer_mask,
Layer *layer);
Layer * layer_mask_get_layer (LayerMask *layer_mask);
LayerMask * layer_mask_new (GimpImage *gimage,
gint width,
gint height,
gchar *name,
gint opacity,
guchar *col);
LayerMask * layer_mask_copy (LayerMask *layer_mask);
void layer_mask_delete (LayerMask *layer_mask);
LayerMask * layer_mask_get_ID (gint ID);
LayerMask * layer_mask_ref (LayerMask *layer_mask);
void layer_mask_unref (LayerMask *layer_mask);
void layer_mask_set_layer (LayerMask *layer_mask,
Layer *layer);
Layer * layer_mask_get_layer (LayerMask *layer_mask);
/* access functions */
void layer_set_name (Layer *layer,
gchar *name);
gchar * layer_get_name (Layer *layer);
guchar * layer_data (Layer *layer);
LayerMask * layer_get_mask (Layer *layer);
gboolean layer_has_alpha (Layer *layer);
gboolean layer_is_floating_sel (Layer *layer);
gboolean layer_linked (Layer *layer);
TempBuf * layer_preview (Layer *layer,
gint width,
gint height);
TempBuf * layer_mask_preview (Layer *layer,
gint width,
gint height);
void layer_set_name (Layer *layer,
const gchar *name);
const gchar * layer_get_name (const Layer *layer);
guchar * layer_data (Layer *layer);
LayerMask * layer_get_mask (Layer *layer);
gboolean layer_has_alpha (Layer *layer);
gboolean layer_is_floating_sel (Layer *layer);
gboolean layer_linked (Layer *layer);
TempBuf * layer_preview (Layer *layer,
gint width,
gint height);
TempBuf * layer_mask_preview (Layer *layer,
gint width,
gint height);
void layer_invalidate_previews (GimpImage *gimage);
Tattoo layer_get_tattoo (const Layer *layer);
void layer_set_tattoo (const Layer *layer,
Tattoo value);
void layer_invalidate_previews (GimpImage *gimage);
Tattoo layer_get_tattoo (const Layer *layer);
void layer_set_tattoo (Layer *layer,
Tattoo value);
#define drawable_layer GIMP_IS_LAYER
#define drawable_layer_mask GIMP_IS_LAYER_MASK

View File

@ -1457,7 +1457,8 @@ channel_widget_create (GimpImage *gimage,
break;
case AUXILLARY_CHANNEL:
channel_widget->label = gtk_label_new (channel_get_name (channel));
channel_widget->label =
gtk_label_new (drawable_get_name (GIMP_DRAWABLE (channel)));
break;
}
@ -2640,10 +2641,10 @@ edit_channel_query_ok_callback (GtkWidget *widget,
if (options->gimage)
{
/* Set the new channel name */
channel_set_name (channel,
gtk_entry_get_text (GTK_ENTRY (options->name_entry)));
drawable_set_name (GIMP_DRAWABLE (channel),
gtk_entry_get_text (GTK_ENTRY (options->name_entry)));
gtk_label_set_text (GTK_LABEL (options->channel_widget->label),
channel_get_name (channel));
drawable_get_name (GIMP_DRAWABLE (channel)));
if (channel->opacity != opacity)
{
@ -2736,8 +2737,9 @@ channels_dialog_edit_channel_query (ChannelWidget *channel_widget)
gtk_widget_set_usize (options->name_entry, 150, 0);
gtk_table_attach_defaults (GTK_TABLE (table), options->name_entry,
1, 2, 0, 1);
gtk_entry_set_text (GTK_ENTRY (options->name_entry),
channel_get_name (channel_widget->channel));
gtk_entry_set_text
(GTK_ENTRY (options->name_entry),
drawable_get_name (GIMP_DRAWABLE (channel_widget->channel)));
gtk_widget_show (options->name_entry);
/* The opacity scale */

View File

@ -3338,7 +3338,7 @@ layer_widget_layer_flush (GtkWidget *widget,
{
LayerWidget *layer_widget;
Layer *layer;
gchar *name;
const gchar *name;
gchar *label_name;
gboolean update_layer_preview = FALSE;
gboolean update_mask_preview = FALSE;

View File

@ -228,7 +228,7 @@ qmask_activate (GtkWidget *widget,
gmask = channel_copy (gimage_get_mask (gimg));
gimp_image_add_channel (gimg, gmask, 0);
channel_set_color (gmask, color);
channel_set_name (gmask, "Qmask");
drawable_set_name (GIMP_DRAWABLE (gmask), "Qmask");
channel_set_opacity (gmask, opacity);
gimage_mask_none (gimg); /* Clear the selection */
}

View File

@ -54,21 +54,21 @@ enum
LAST_SIGNAL
};
static void gimp_layer_class_init (GimpLayerClass *klass);
static void gimp_layer_init (GimpLayer *layer);
static void gimp_layer_destroy (GtkObject *object);
static void layer_invalidate_preview (GtkObject *object);
static void gimp_layer_class_init (GimpLayerClass *klass);
static void gimp_layer_init (GimpLayer *layer);
static void gimp_layer_destroy (GtkObject *object);
static void layer_invalidate_preview (GimpDrawable *object);
static void gimp_layer_mask_class_init (GimpLayerMaskClass *klass);
static void gimp_layer_mask_init (GimpLayerMask *layermask);
static void gimp_layer_mask_destroy (GtkObject *object);
static void gimp_layer_mask_class_init (GimpLayerMaskClass *klass);
static void gimp_layer_mask_init (GimpLayerMask *layermask);
static void gimp_layer_mask_destroy (GtkObject *object);
static TempBuf * layer_preview_private (Layer *layer,
gint width,
gint height);
static TempBuf * layer_mask_preview_private (Layer *layer,
gint width,
gint height);
static TempBuf * layer_preview_private (Layer *layer,
gint width,
gint height);
static TempBuf * layer_mask_preview_private (Layer *layer,
gint width,
gint height);
static guint layer_signals[LAST_SIGNAL] = { 0 };
@ -77,7 +77,7 @@ static guint layer_signals[LAST_SIGNAL] = { 0 };
static guint layer_mask_signals[LAST_SIGNAL] = { 0 };
*/
static GimpDrawableClass *layer_parent_class = NULL;
static GimpDrawableClass *layer_parent_class = NULL;
static GimpChannelClass *layer_mask_parent_class = NULL;
GtkType
@ -99,22 +99,22 @@ gimp_layer_get_type (void)
(GtkClassInitFunc) NULL,
};
layer_type = gtk_type_unique (gimp_drawable_get_type (), &layer_info);
layer_type = gtk_type_unique (GIMP_TYPE_DRAWABLE, &layer_info);
}
return layer_type;
}
static void
gimp_layer_class_init (GimpLayerClass *class)
gimp_layer_class_init (GimpLayerClass *klass)
{
GtkObjectClass *object_class;
GimpDrawableClass *drawable_class;
object_class = (GtkObjectClass*) class;
drawable_class = (GimpDrawableClass*) class;
object_class = (GtkObjectClass *) klass;
drawable_class = (GimpDrawableClass *) klass;
layer_parent_class = gtk_type_class (gimp_drawable_get_type ());
layer_parent_class = gtk_type_class (GIMP_TYPE_DRAWABLE);
layer_signals[REMOVED] =
gimp_signal_new ("removed",
@ -123,7 +123,10 @@ gimp_layer_class_init (GimpLayerClass *class)
gtk_object_class_add_signals (object_class, layer_signals, LAST_SIGNAL);
object_class->destroy = gimp_layer_destroy;
drawable_class->invalidate_preview = layer_invalidate_preview;
klass->removed = NULL;
}
static void
@ -201,14 +204,14 @@ gint layer_get_count = 0;
/********************************/
static void
layer_invalidate_preview (GtkObject *object)
layer_invalidate_preview (GimpDrawable *drawable)
{
GimpLayer *layer;
g_return_if_fail (object != NULL);
g_return_if_fail (GIMP_IS_LAYER (object));
g_return_if_fail (drawable != NULL);
g_return_if_fail (GIMP_IS_LAYER (drawable));
layer = GIMP_LAYER (object);
layer = GIMP_LAYER (drawable);
if (layer_is_floating_sel (layer))
floating_sel_invalidate (layer);
@ -261,7 +264,7 @@ layer_new (GimpImage *gimage,
gint width,
gint height,
GimpImageType type,
gchar *name,
const gchar *name,
gint opacity,
LayerModeEffects mode)
{
@ -301,21 +304,6 @@ layer_new (GimpImage *gimage,
return layer;
}
Layer *
layer_ref (Layer *layer)
{
gtk_object_ref (GTK_OBJECT (layer));
gtk_object_sink (GTK_OBJECT (layer));
return layer;
}
void
layer_unref (Layer *layer)
{
gtk_object_unref (GTK_OBJECT (layer));
}
Layer *
layer_copy (Layer *layer,
gboolean add_alpha)
@ -325,7 +313,7 @@ layer_copy (Layer *layer,
GimpImageType new_type;
gchar *ext;
gint number;
gchar *name;
const gchar *name;
gint len;
PixelRegion srcPR;
PixelRegion destPR;
@ -1281,14 +1269,14 @@ layer_pick_correlate (Layer *layer,
/**********************/
void
layer_set_name (Layer *layer,
gchar *name)
layer_set_name (Layer *layer,
const gchar *name)
{
gimp_drawable_set_name (GIMP_DRAWABLE (layer), name);
}
gchar *
layer_get_name (Layer *layer)
const gchar *
layer_get_name (const Layer *layer)
{
return gimp_drawable_get_name (GIMP_DRAWABLE (layer));
}
@ -1531,12 +1519,12 @@ layer_mask_preview_private (Layer *layer,
Tattoo
layer_get_tattoo (const Layer *layer)
{
return (gimp_drawable_get_tattoo (GIMP_DRAWABLE (layer)));
return gimp_drawable_get_tattoo (GIMP_DRAWABLE (layer));
}
void
layer_set_tattoo (const Layer *layer,
Tattoo value)
layer_set_tattoo (Layer *layer,
Tattoo value)
{
gimp_drawable_set_tattoo (GIMP_DRAWABLE (layer), value);
}

View File

@ -71,19 +71,17 @@ struct _fs_to_layer_undo
/* function declarations */
Layer * layer_new (GimpImage *gimage,
gint width,
gint height,
GimpImageType type,
gchar *name,
gint opacity,
LayerModeEffects mode);
Layer * layer_copy (Layer *layer,
gboolean add_alpha);
Layer * layer_ref (Layer *layer);
void layer_unref (Layer *layer);
Layer * layer_new (GimpImage *gimage,
gint width,
gint height,
GimpImageType type,
const gchar *name,
gint opacity,
LayerModeEffects mode);
Layer * layer_copy (Layer *layer,
gboolean add_alpha);
Layer * layer_new_from_tiles (GimpImage *gimage,
Layer * layer_new_from_tiles (GimpImage *gimage,
GimpImageType layer_type,
TileManager *tiles,
gchar *name,
@ -92,11 +90,11 @@ Layer * layer_new_from_tiles (GimpImage *gimage,
gboolean layer_check_scaling (Layer *layer,
gint new_width,
gint new_height);
LayerMask * layer_create_mask (Layer *layer,
LayerMask * layer_create_mask (Layer *layer,
AddMaskType add_mask_type);
LayerMask * layer_add_mask (Layer *layer,
LayerMask * layer_add_mask (Layer *layer,
LayerMask *mask);
Layer * layer_get_ID (gint ID);
Layer * layer_get_ID (gint ID);
void layer_delete (Layer *layer);
void layer_removed (Layer *layer,
gpointer data);
@ -119,49 +117,49 @@ void layer_resize (Layer *layer,
gint offx,
gint offy);
void layer_resize_to_image (Layer *layer);
BoundSeg * layer_boundary (Layer *layer,
BoundSeg * layer_boundary (Layer *layer,
gint *num_segs);
void layer_invalidate_boundary (Layer *layer);
gint layer_pick_correlate (Layer *layer,
gint x,
gint y);
LayerMask * layer_mask_new (GimpImage *gimage,
gint width,
gint height,
gchar *name,
gint opacity,
guchar *col);
LayerMask * layer_mask_copy (LayerMask *layer_mask);
void layer_mask_delete (LayerMask *layer_mask);
LayerMask * layer_mask_get_ID (gint ID);
LayerMask * layer_mask_ref (LayerMask *layer_mask);
void layer_mask_unref (LayerMask *layer_mask);
void layer_mask_set_layer (LayerMask *layer_mask,
Layer *layer);
Layer * layer_mask_get_layer (LayerMask *layer_mask);
LayerMask * layer_mask_new (GimpImage *gimage,
gint width,
gint height,
gchar *name,
gint opacity,
guchar *col);
LayerMask * layer_mask_copy (LayerMask *layer_mask);
void layer_mask_delete (LayerMask *layer_mask);
LayerMask * layer_mask_get_ID (gint ID);
LayerMask * layer_mask_ref (LayerMask *layer_mask);
void layer_mask_unref (LayerMask *layer_mask);
void layer_mask_set_layer (LayerMask *layer_mask,
Layer *layer);
Layer * layer_mask_get_layer (LayerMask *layer_mask);
/* access functions */
void layer_set_name (Layer *layer,
gchar *name);
gchar * layer_get_name (Layer *layer);
guchar * layer_data (Layer *layer);
LayerMask * layer_get_mask (Layer *layer);
gboolean layer_has_alpha (Layer *layer);
gboolean layer_is_floating_sel (Layer *layer);
gboolean layer_linked (Layer *layer);
TempBuf * layer_preview (Layer *layer,
gint width,
gint height);
TempBuf * layer_mask_preview (Layer *layer,
gint width,
gint height);
void layer_set_name (Layer *layer,
const gchar *name);
const gchar * layer_get_name (const Layer *layer);
guchar * layer_data (Layer *layer);
LayerMask * layer_get_mask (Layer *layer);
gboolean layer_has_alpha (Layer *layer);
gboolean layer_is_floating_sel (Layer *layer);
gboolean layer_linked (Layer *layer);
TempBuf * layer_preview (Layer *layer,
gint width,
gint height);
TempBuf * layer_mask_preview (Layer *layer,
gint width,
gint height);
void layer_invalidate_previews (GimpImage *gimage);
Tattoo layer_get_tattoo (const Layer *layer);
void layer_set_tattoo (const Layer *layer,
Tattoo value);
void layer_invalidate_previews (GimpImage *gimage);
Tattoo layer_get_tattoo (const Layer *layer);
void layer_set_tattoo (Layer *layer,
Tattoo value);
#define drawable_layer GIMP_IS_LAYER
#define drawable_layer_mask GIMP_IS_LAYER_MASK

View File

@ -15,6 +15,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __LAYER_PVT_H__
#define __LAYER_PVT_H__
@ -60,13 +61,15 @@ struct _GimpLayer
struct _GimpLayerClass
{
GimpDrawableClass parent_class;
void (* removed) (GimpLayer *layer);
};
struct _GimpLayerMask
{
GimpChannel drawable;
Layer * layer; /* ID of layer */
Layer *layer;
};
struct _GimpLayerMaskClass

View File

@ -3338,7 +3338,7 @@ layer_widget_layer_flush (GtkWidget *widget,
{
LayerWidget *layer_widget;
Layer *layer;
gchar *name;
const gchar *name;
gchar *label_name;
gboolean update_layer_preview = FALSE;
gboolean update_mask_preview = FALSE;

View File

@ -190,6 +190,7 @@ move_draw_guide (GDisplay *gdisp,
default:
g_warning ("mdg / BAD FALLTHROUGH");
break;
}
}
@ -232,10 +233,14 @@ move_tool_button_release (Tool *tool,
if ((move->guide->position < y1) || (move->guide->position > y2))
delete_guide = TRUE;
break;
case ORIENTATION_VERTICAL:
if ((move->guide->position < x1) || (move->guide->position > x2))
delete_guide = TRUE;
break;
default:
break;
}
gdisplays_expose_guide (gdisp->gimage, move->guide);

File diff suppressed because it is too large Load Diff

View File

@ -446,9 +446,12 @@ map_to_color (int src_type,
* Hash table lookup speeds up the standard
* least squares method
*/
int map_rgb_to_indexed (const unsigned char *cmap,
int num_cols, GimpImage* gimage,
int r, int g, int b);
gint map_rgb_to_indexed (const guchar *cmap,
gint num_cols,
const GimpImage *gimage,
gint r,
gint g,
gint b);
/* Region functions */

File diff suppressed because it is too large Load Diff

View File

@ -446,9 +446,12 @@ map_to_color (int src_type,
* Hash table lookup speeds up the standard
* least squares method
*/
int map_rgb_to_indexed (const unsigned char *cmap,
int num_cols, GimpImage* gimage,
int r, int g, int b);
gint map_rgb_to_indexed (const guchar *cmap,
gint num_cols,
const GimpImage *gimage,
gint r,
gint g,
gint b);
/* Region functions */

View File

@ -228,7 +228,7 @@ qmask_activate (GtkWidget *widget,
gmask = channel_copy (gimage_get_mask (gimg));
gimp_image_add_channel (gimg, gmask, 0);
channel_set_color (gmask, color);
channel_set_name (gmask, "Qmask");
drawable_set_name (GIMP_DRAWABLE (gmask), "Qmask");
channel_set_opacity (gmask, opacity);
gimage_mask_none (gimg); /* Clear the selection */
}

View File

@ -467,7 +467,7 @@ bezier_select_reset (BezierSelect *bezier_sel)
}
if (bezier_sel->mask)
channel_delete (bezier_sel->mask);
gtk_object_unref (GTK_OBJECT (bezier_sel->mask));
bezier_sel->state = BEZIER_START; /* we are starting the curve */
bezier_sel->draw = BEZIER_DRAW_ALL; /* draw everything by default */
@ -2481,9 +2481,12 @@ bezier_convert (BezierSelect *bezier_sel,
}
/* create a new mask */
bezier_sel->mask = channel_ref (channel_new_mask (gdisp->gimage,
gdisp->gimage->width,
gdisp->gimage->height));
bezier_sel->mask = channel_new_mask (gdisp->gimage,
gdisp->gimage->width,
gdisp->gimage->height);
gtk_object_ref (GTK_OBJECT (bezier_sel->mask));
gtk_object_sink (GTK_OBJECT (bezier_sel->mask));
/* allocate room for the scanlines */
bezier_sel->scanlines = g_malloc (sizeof (GSList *) * height);

View File

@ -349,9 +349,9 @@ crop_adjust_guides (GImage *gimage,
int x2, int y2)
{
GList * glist;
Guide * guide;
gint remove_guide;
GList * glist;
Guide * guide;
gboolean remove_guide;
for (glist = gimage->guides; glist; glist = g_list_next (glist))
{
@ -361,14 +361,17 @@ crop_adjust_guides (GImage *gimage,
switch (guide->orientation)
{
case ORIENTATION_HORIZONTAL:
if ((guide->position < y1) ||(guide->position > y2))
if ((guide->position < y1) || (guide->position > y2))
remove_guide = TRUE;
break;
case ORIENTATION_VERTICAL:
if ((guide->position < x1) ||(guide->position > x2))
if ((guide->position < x1) || (guide->position > x2))
remove_guide = TRUE;
break;
default:
break;
}
/* edit the guide */
@ -393,7 +396,6 @@ crop_adjust_guides (GImage *gimage,
}
}
}
static void
crop_motion (Tool *tool,

View File

@ -546,8 +546,12 @@ fuzzy_select_calculate (Tool *tool,
fuzzy_options->sample_merged);
if (fuzzy_mask)
channel_delete (fuzzy_mask);
fuzzy_mask = channel_ref (new);
gtk_object_unref (GTK_OBJECT (fuzzy_mask));
fuzzy_mask = new;
gtk_object_ref (GTK_OBJECT (fuzzy_mask));
gtk_object_sink (GTK_OBJECT (fuzzy_mask));
/* calculate and allocate a new XSegment array which represents the boundary
* of the color-contiguous region

View File

@ -349,9 +349,9 @@ crop_adjust_guides (GImage *gimage,
int x2, int y2)
{
GList * glist;
Guide * guide;
gint remove_guide;
GList * glist;
Guide * guide;
gboolean remove_guide;
for (glist = gimage->guides; glist; glist = g_list_next (glist))
{
@ -361,14 +361,17 @@ crop_adjust_guides (GImage *gimage,
switch (guide->orientation)
{
case ORIENTATION_HORIZONTAL:
if ((guide->position < y1) ||(guide->position > y2))
if ((guide->position < y1) || (guide->position > y2))
remove_guide = TRUE;
break;
case ORIENTATION_VERTICAL:
if ((guide->position < x1) ||(guide->position > x2))
if ((guide->position < x1) || (guide->position > x2))
remove_guide = TRUE;
break;
default:
break;
}
/* edit the guide */
@ -393,7 +396,6 @@ crop_adjust_guides (GImage *gimage,
}
}
}
static void
crop_motion (Tool *tool,

View File

@ -546,8 +546,12 @@ fuzzy_select_calculate (Tool *tool,
fuzzy_options->sample_merged);
if (fuzzy_mask)
channel_delete (fuzzy_mask);
fuzzy_mask = channel_ref (new);
gtk_object_unref (GTK_OBJECT (fuzzy_mask));
fuzzy_mask = new;
gtk_object_ref (GTK_OBJECT (fuzzy_mask));
gtk_object_sink (GTK_OBJECT (fuzzy_mask));
/* calculate and allocate a new XSegment array which represents the boundary
* of the color-contiguous region

View File

@ -190,6 +190,7 @@ move_draw_guide (GDisplay *gdisp,
default:
g_warning ("mdg / BAD FALLTHROUGH");
break;
}
}
@ -232,10 +233,14 @@ move_tool_button_release (Tool *tool,
if ((move->guide->position < y1) || (move->guide->position > y2))
delete_guide = TRUE;
break;
case ORIENTATION_VERTICAL:
if ((move->guide->position < x1) || (move->guide->position > x2))
delete_guide = TRUE;
break;
default:
break;
}
gdisplays_expose_guide (gdisp->gimage, move->guide);

View File

@ -546,8 +546,12 @@ fuzzy_select_calculate (Tool *tool,
fuzzy_options->sample_merged);
if (fuzzy_mask)
channel_delete (fuzzy_mask);
fuzzy_mask = channel_ref (new);
gtk_object_unref (GTK_OBJECT (fuzzy_mask));
fuzzy_mask = new;
gtk_object_ref (GTK_OBJECT (fuzzy_mask));
gtk_object_sink (GTK_OBJECT (fuzzy_mask));
/* calculate and allocate a new XSegment array which represents the boundary
* of the color-contiguous region

View File

@ -190,6 +190,7 @@ move_draw_guide (GDisplay *gdisp,
default:
g_warning ("mdg / BAD FALLTHROUGH");
break;
}
}
@ -232,10 +233,14 @@ move_tool_button_release (Tool *tool,
if ((move->guide->position < y1) || (move->guide->position > y2))
delete_guide = TRUE;
break;
case ORIENTATION_VERTICAL:
if ((move->guide->position < x1) || (move->guide->position > x2))
delete_guide = TRUE;
break;
default:
break;
}
gdisplays_expose_guide (gdisp->gimage, move->guide);

View File

@ -1430,7 +1430,7 @@ undo_push_layer (GImage *gimage,
{
/* if this is a remove layer, delete the layer */
if (type == LAYER_REMOVE_UNDO)
layer_unref (lu->layer);
gtk_object_unref (GTK_OBJECT (lu->layer));
g_free (lu);
return FALSE;
}
@ -1516,7 +1516,7 @@ undo_free_layer (UndoState state,
*/
if ((state == REDO && type == LAYER_ADD_UNDO) ||
(state == UNDO && type == LAYER_REMOVE_UNDO))
layer_unref (lu->layer);
gtk_object_unref (GTK_OBJECT (lu->layer));
g_free (lu);
}