app/color_picker.c app/convert.c app/curves.c app/gimpdrawable.c

2000-12-13  Sven Neumann  <sven@gimp.org>

        * app/color_picker.c
        * app/convert.c
        * app/curves.c
        * app/gimpdrawable.c
        * app/gimpimage.c
        * app/gimpimage.h
        * app/image_map.c
        * app/info_window.c
        * app/layer.c
        * app/undo.c: couldn't resist: renamed TYPE_HAS_ALPHA() to
        GIMP_IMAGE_TYPE_HAS_ALPHA()

        * plug-ins/common/sunras.c
        * plug-ins/common/xwd.c: small cleanups
This commit is contained in:
Sven Neumann 2000-12-13 18:53:35 +00:00 committed by Sven Neumann
parent 16da87c016
commit 2458bfcbba
40 changed files with 436 additions and 391 deletions

View File

@ -1,3 +1,20 @@
2000-12-13 Sven Neumann <sven@gimp.org>
* app/color_picker.c
* app/convert.c
* app/curves.c
* app/gimpdrawable.c
* app/gimpimage.c
* app/gimpimage.h
* app/image_map.c
* app/info_window.c
* app/layer.c
* app/undo.c: couldn't resist: renamed TYPE_HAS_ALPHA() to
GIMP_IMAGE_TYPE_HAS_ALPHA()
* plug-ins/common/sunras.c
* plug-ins/common/xwd.c: small cleanups
2000-12-13 Vidar Madsen <vidar@gimp.org> 2000-12-13 Vidar Madsen <vidar@gimp.org>
* plug-ins/common/spheredesigner.c: Small algo improvements. * plug-ins/common/spheredesigner.c: Small algo improvements.

View File

@ -135,22 +135,24 @@ static void curves_write_to_file (FILE *f);
/* curves machinery */ /* curves machinery */
float gfloat
curves_lut_func (CurvesDialog *cd, curves_lut_func (CurvesDialog *cd,
gint nchannels, gint nchannels,
gint channel, gint channel,
gfloat value) gfloat value)
{ {
float f; gfloat f;
int index; gint index;
double inten; gdouble inten;
int j; gint j;
if (nchannels == 1) if (nchannels == 1)
j = 0; j = 0;
else else
j = channel + 1; j = channel + 1;
inten = value; inten = value;
/* For color images this runs through the loop with j = channel +1 /* For color images this runs through the loop with j = channel +1
the first time and j = 0 the second time */ the first time and j = 0 the second time */
/* For bw images this runs through the loop with j = 0 the first and /* For bw images this runs through the loop with j = 0 the first and
@ -184,12 +186,13 @@ curves_colour_update (Tool *tool,
gint x, gint x,
gint y) gint y)
{ {
unsigned char *color; guchar *color;
int offx, offy; gint offx;
int has_alpha; gint offy;
int is_indexed; gint maxval;
int sample_type; gboolean has_alpha;
int maxval; gboolean is_indexed;
GimpImageType sample_type;
if(!tool || tool->state != ACTIVE) if(!tool || tool->state != ACTIVE)
return; return;
@ -203,8 +206,8 @@ curves_colour_update (Tool *tool,
return; return;
sample_type = gimp_drawable_type (drawable); sample_type = gimp_drawable_type (drawable);
is_indexed = gimp_drawable_is_indexed (drawable); is_indexed = gimp_drawable_is_indexed (drawable);
has_alpha = TYPE_HAS_ALPHA (sample_type); has_alpha = GIMP_IMAGE_TYPE_HAS_ALPHA (sample_type);
curves_dialog->col_value[HISTOGRAM_RED] = color[RED_PIX]; curves_dialog->col_value[HISTOGRAM_RED] = color[RED_PIX];
curves_dialog->col_value[HISTOGRAM_GREEN] = color[GREEN_PIX]; curves_dialog->col_value[HISTOGRAM_GREEN] = color[GREEN_PIX];
@ -231,10 +234,10 @@ curves_add_point (GimpDrawable *drawable,
gint cchan) gint cchan)
{ {
/* Add point onto the curve */ /* Add point onto the curve */
int closest_point = 0; gint closest_point = 0;
int distance; gint distance;
int curvex; gint curvex;
int i; gint i;
switch (curves_dialog->curve_type[cchan]) switch (curves_dialog->curve_type[cchan])
{ {
@ -271,9 +274,9 @@ curves_button_press (Tool *tool,
GdkEventButton *bevent, GdkEventButton *bevent,
gpointer gdisp_ptr) gpointer gdisp_ptr)
{ {
GDisplay *gdisp;
gint x, y; gint x, y;
GimpDrawable * drawable; GDisplay *gdisp;
GimpDrawable *drawable;
gdisp = gdisp_ptr; gdisp = gdisp_ptr;
drawable = gimage_active_drawable (gdisp->gimage); drawable = gimage_active_drawable (gdisp->gimage);
@ -307,8 +310,8 @@ curves_button_release (Tool *tool,
gpointer gdisp_ptr) gpointer gdisp_ptr)
{ {
gint x, y; gint x, y;
GimpDrawable * drawable; GimpDrawable *drawable;
GDisplay *gdisp; GDisplay *gdisp;
gdisp = (GDisplay *) gdisp_ptr; gdisp = (GDisplay *) gdisp_ptr;
@ -343,9 +346,9 @@ curves_motion (Tool *tool,
GdkEventMotion *mevent, GdkEventMotion *mevent,
gpointer gdisp_ptr) gpointer gdisp_ptr)
{ {
GDisplay *gdisp;
gint x, y; gint x, y;
GimpDrawable * drawable; GDisplay *gdisp;
GimpDrawable *drawable;
gdisp = (GDisplay *) gdisp_ptr; gdisp = (GDisplay *) gdisp_ptr;
@ -384,8 +387,8 @@ curves_control (Tool *tool,
Tool * Tool *
tools_new_curves (void) tools_new_curves (void)
{ {
Tool * tool; Tool *tool;
Curves * private; Curves *private;
/* The tool options */ /* The tool options */
if (!curves_options) if (!curves_options)
@ -420,7 +423,7 @@ curves_dialog_hide (void)
void void
tools_free_curves (Tool *tool) tools_free_curves (Tool *tool)
{ {
Curves * private; Curves *private;
private = (Curves *) tool->private; private = (Curves *) tool->private;
@ -722,10 +725,10 @@ curve_print_loc (CurvesDialog *cd,
gint xpos, gint xpos,
gint ypos) gint ypos)
{ {
char buf[32]; gchar buf[32];
gint width; gint width;
gint ascent; gint ascent;
gint descent; gint descent;
if (cd->cursor_ind_width < 0) if (cd->cursor_ind_width < 0)
{ {
@ -771,12 +774,12 @@ curve_print_loc (CurvesDialog *cd,
/* TODO: preview alpha channel stuff correctly. -- austin, 20/May/99 */ /* TODO: preview alpha channel stuff correctly. -- austin, 20/May/99 */
static void static void
curves_update (CurvesDialog *cd, curves_update (CurvesDialog *cd,
int update) gint update)
{ {
GdkRectangle area; GdkRectangle area;
gint i, j; gint i, j;
gchar buf[32]; gchar buf[32];
gint offset; gint offset;
gint sel_channel; gint sel_channel;
if(cd->color) { if(cd->color) {
@ -1155,7 +1158,7 @@ curves_smooth_callback (GtkWidget *widget,
gpointer data) gpointer data)
{ {
CurvesDialog *cd; CurvesDialog *cd;
int i; gint i;
gint32 index; gint32 index;
cd = (CurvesDialog *) data; cd = (CurvesDialog *) data;
@ -1202,7 +1205,7 @@ curves_free_callback (GtkWidget *widget,
static void static void
curves_channel_reset (int i) curves_channel_reset (int i)
{ {
int j; gint j;
curves_dialog->grab_point = -1; curves_dialog->grab_point = -1;
@ -1223,7 +1226,7 @@ curves_reset_callback (GtkWidget *widget,
gpointer data) gpointer data)
{ {
CurvesDialog *cd; CurvesDialog *cd;
int i; gint i;
cd = (CurvesDialog *) data; cd = (CurvesDialog *) data;
@ -1356,12 +1359,12 @@ curves_graph_events (GtkWidget *widget,
GdkCursorType new_type; GdkCursorType new_type;
GdkEventButton *bevent; GdkEventButton *bevent;
GdkEventMotion *mevent; GdkEventMotion *mevent;
int i; gint i;
int tx, ty; gint tx, ty;
int x, y; gint x, y;
int closest_point; gint closest_point;
int distance; gint distance;
int x1, x2, y1, y2; gint x1, x2, y1, y2;
new_type = GDK_X_CURSOR; new_type = GDK_X_CURSOR;
closest_point = 0; closest_point = 0;
@ -1693,11 +1696,12 @@ file_dialog_cancel_callback (GtkWidget *widget,
static gboolean static gboolean
curves_read_from_file (FILE *f) curves_read_from_file (FILE *f)
{ {
gint i, j, fields; gint i, j;
gint fields;
gchar buf[50]; gchar buf[50];
gint index[5][17]; gint index[5][17];
gint value[5][17]; gint value[5][17];
gint current_channel; gint current_channel;
if (!fgets (buf, 50, f)) if (!fgets (buf, 50, f))
return FALSE; return FALSE;
@ -1750,7 +1754,7 @@ curves_read_from_file (FILE *f)
static void static void
curves_write_to_file (FILE *f) curves_write_to_file (FILE *f)
{ {
int i, j; gint i, j;
gint32 index; gint32 index;
for (i = 0; i < 5; i++) for (i = 0; i < 5; i++)

View File

@ -508,7 +508,7 @@ pick_color_do (GimpImage *gimage,
get_color_obj = GTK_OBJECT (gimage); get_color_obj = GTK_OBJECT (gimage);
} }
has_alpha = TYPE_HAS_ALPHA (sample_type); has_alpha = GIMP_IMAGE_TYPE_HAS_ALPHA (sample_type);
if (!(color = (*get_color_func) (get_color_obj, x, y))) if (!(color = (*get_color_func) (get_color_obj, x, y)))
return FALSE; return FALSE;

View File

@ -1362,10 +1362,10 @@ convert_image (GImage *gimage,
/* Push the layer on the undo stack */ /* Push the layer on the undo stack */
undo_push_layer_mod (gimage, layer); undo_push_layer_mod (gimage, layer);
GIMP_DRAWABLE(layer)->tiles = new_tiles; GIMP_DRAWABLE (layer)->tiles = new_tiles;
GIMP_DRAWABLE(layer)->bytes = new_layer_bytes; GIMP_DRAWABLE (layer)->bytes = new_layer_bytes;
GIMP_DRAWABLE(layer)->type = new_layer_type; GIMP_DRAWABLE (layer)->type = new_layer_type;
GIMP_DRAWABLE(layer)->has_alpha = TYPE_HAS_ALPHA(new_layer_type); GIMP_DRAWABLE (layer)->has_alpha = GIMP_IMAGE_TYPE_HAS_ALPHA (new_layer_type);
} }
/* colourmap stuff */ /* colourmap stuff */

View File

@ -433,7 +433,7 @@ gimp_drawable_get_color_at (GimpDrawable *drawable,
gimp_image_get_color (gimp_drawable_gimage (drawable), gimp_image_get_color (gimp_drawable_gimage (drawable),
gimp_drawable_type (drawable), dest, src); gimp_drawable_type (drawable), dest, src);
if (TYPE_HAS_ALPHA (gimp_drawable_type (drawable))) if (GIMP_IMAGE_TYPE_HAS_ALPHA (gimp_drawable_type (drawable)))
dest[3] = src[gimp_drawable_bytes (drawable) - 1]; dest[3] = src[gimp_drawable_bytes (drawable) - 1];
else else
dest[3] = 255; dest[3] = 255;

View File

@ -1362,10 +1362,10 @@ convert_image (GImage *gimage,
/* Push the layer on the undo stack */ /* Push the layer on the undo stack */
undo_push_layer_mod (gimage, layer); undo_push_layer_mod (gimage, layer);
GIMP_DRAWABLE(layer)->tiles = new_tiles; GIMP_DRAWABLE (layer)->tiles = new_tiles;
GIMP_DRAWABLE(layer)->bytes = new_layer_bytes; GIMP_DRAWABLE (layer)->bytes = new_layer_bytes;
GIMP_DRAWABLE(layer)->type = new_layer_type; GIMP_DRAWABLE (layer)->type = new_layer_type;
GIMP_DRAWABLE(layer)->has_alpha = TYPE_HAS_ALPHA(new_layer_type); GIMP_DRAWABLE (layer)->has_alpha = GIMP_IMAGE_TYPE_HAS_ALPHA (new_layer_type);
} }
/* colourmap stuff */ /* colourmap stuff */

View File

@ -960,16 +960,15 @@ gimp_image_get_color_at (GimpImage *gimage,
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL); g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
if (x < 0 || y < 0 || x >= gimage->width || y >= gimage->height) if (x < 0 || y < 0 || x >= gimage->width || y >= gimage->height)
{ return NULL;
return NULL;
}
dest = g_new (unsigned char, 5); dest = g_new (unsigned char, 5);
tile = tile_manager_get_tile (gimp_image_composite (gimage), x, y, tile = tile_manager_get_tile (gimp_image_composite (gimage), x, y,
TRUE, FALSE); TRUE, FALSE);
src = tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT); src = tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT);
gimp_image_get_color (gimage, gimp_image_composite_type (gimage), dest, src); gimp_image_get_color (gimage, gimp_image_composite_type (gimage), dest, src);
if (TYPE_HAS_ALPHA (gimp_image_composite_type (gimage))) if (GIMP_IMAGE_TYPE_HAS_ALPHA (gimp_image_composite_type (gimage)))
dest[3] = src[gimp_image_composite_bytes (gimage) - 1]; dest[3] = src[gimp_image_composite_bytes (gimage) - 1];
else else
dest[3] = 255; dest[3] = 255;
@ -3696,7 +3695,6 @@ gimp_image_construct_composite_preview (GimpImage *gimage,
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL); g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
list = gimage->layers;
ratio = (gdouble) width / (gdouble) gimage->width; ratio = (gdouble) width / (gdouble) gimage->width;
switch (gimp_image_base_type (gimage)) switch (gimp_image_base_type (gimage))
@ -3718,7 +3716,7 @@ gimp_image_construct_composite_preview (GimpImage *gimage,
memset (temp_buf_data (comp), 0, comp->width * comp->height * comp->bytes); memset (temp_buf_data (comp), 0, comp->width * comp->height * comp->bytes);
floating_sel = NULL; floating_sel = NULL;
while (list) for (list = gimage->layers; list; list = g_slist_next (list))
{ {
layer = (Layer *) list->data; layer = (Layer *) list->data;
@ -3738,8 +3736,6 @@ gimp_image_construct_composite_preview (GimpImage *gimage,
reverse_list = g_slist_prepend (reverse_list, layer); reverse_list = g_slist_prepend (reverse_list, layer);
} }
} }
list = g_slist_next (list);
} }
construct_flag = 0; construct_flag = 0;

View File

@ -15,6 +15,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#ifndef __GIMPIMAGE_H__ #ifndef __GIMPIMAGE_H__
#define __GIMPIMAGE_H__ #define __GIMPIMAGE_H__
@ -38,7 +39,7 @@
#define GIMP_IMAGE(obj) GTK_CHECK_CAST (obj, GIMP_TYPE_IMAGE, GimpImage) #define GIMP_IMAGE(obj) GTK_CHECK_CAST (obj, GIMP_TYPE_IMAGE, GimpImage)
#define GIMP_IS_IMAGE(obj) GTK_CHECK_TYPE (obj, GIMP_TYPE_IMAGE) #define GIMP_IS_IMAGE(obj) GTK_CHECK_TYPE (obj, GIMP_TYPE_IMAGE)
#define TYPE_HAS_ALPHA(t) ((t)==RGBA_GIMAGE || (t)==GRAYA_GIMAGE || (t)==INDEXEDA_GIMAGE) #define GIMP_IMAGE_TYPE_HAS_ALPHA(t) ((t)==RGBA_GIMAGE || (t)==GRAYA_GIMAGE || (t)==INDEXEDA_GIMAGE)
#define GRAY_PIX 0 #define GRAY_PIX 0
#define ALPHA_G_PIX 1 #define ALPHA_G_PIX 1
@ -237,27 +238,30 @@ Channel * gimp_image_remove_channel (GimpImage *, Channel *);
void gimp_image_construct (GimpImage *, void gimp_image_construct (GimpImage *,
gint, gint, gint, gint, gint, gint, gint, gint,
gboolean); gboolean);
void gimp_image_invalidate_without_render (GimpImage *, gint, gint, void gimp_image_invalidate_without_render (GimpImage *, gint, gint,
gint, gint, gint, gint, gint, gint,
gint, gint, gint); gint, gint, gint);
void gimp_image_invalidate (GimpImage *, gint, gint, void gimp_image_invalidate (GimpImage *, gint, gint,
gint, gint, gint, gint, gint, gint,
gint, gint, gint); gint, gint, gint);
void gimp_image_validate (TileManager *, Tile *); void gimp_image_validate (TileManager *, Tile *);
/* Access functions */ /* Access functions */
gboolean gimp_image_is_empty (GimpImage *); gboolean gimp_image_is_empty (GimpImage *);
GimpDrawable * gimp_image_active_drawable (GimpImage *); GimpDrawable * gimp_image_active_drawable (GimpImage *);
GimpImageBaseType gimp_image_base_type (GimpImage *);
GimpImageType gimp_image_base_type_with_alpha (GimpImage *); GimpImageBaseType gimp_image_base_type (GimpImage *gimage);
GimpImageType gimp_image_base_type_with_alpha (GimpImage *gimage);
gchar * gimp_image_filename (GimpImage *); gchar * gimp_image_filename (GimpImage *);
gboolean gimp_image_undo_is_enabled (GimpImage *); gboolean gimp_image_undo_is_enabled (GimpImage *);
gboolean gimp_image_undo_enable (GimpImage *); gboolean gimp_image_undo_enable (GimpImage *);
gboolean gimp_image_undo_disable (GimpImage *); gboolean gimp_image_undo_disable (GimpImage *);
gboolean gimp_image_undo_freeze (GimpImage *); gboolean gimp_image_undo_freeze (GimpImage *);
gboolean gimp_image_undo_thaw (GimpImage *); gboolean gimp_image_undo_thaw (GimpImage *);
void gimp_image_undo_event (GimpImage *, int); void gimp_image_undo_event (GimpImage *, gint);
gint gimp_image_dirty (GimpImage *); gint gimp_image_dirty (GimpImage *);
gint gimp_image_clean (GimpImage *); gint gimp_image_clean (GimpImage *);
void gimp_image_clean_all (GimpImage *); void gimp_image_clean_all (GimpImage *);
@ -280,10 +284,12 @@ GimpImageType gimp_image_composite_type (GimpImage *);
gint gimp_image_composite_bytes (GimpImage *); gint gimp_image_composite_bytes (GimpImage *);
TempBuf * gimp_image_composite_preview (GimpImage *, ChannelType, TempBuf * gimp_image_composite_preview (GimpImage *, ChannelType,
gint, gint); gint, gint);
gint gimp_image_preview_valid (GimpImage *, ChannelType); gint gimp_image_preview_valid (GimpImage *, ChannelType);
void gimp_image_invalidate_preview (GimpImage *); void gimp_image_invalidate_preview (GimpImage *);
void gimp_image_invalidate_previews (void); void gimp_image_invalidate_previews (void);
TempBuf * gimp_image_construct_composite_preview (GimpImage *, TempBuf * gimp_image_construct_composite_preview (GimpImage *,
gint , gint); gint , gint);

View File

@ -960,16 +960,15 @@ gimp_image_get_color_at (GimpImage *gimage,
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL); g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
if (x < 0 || y < 0 || x >= gimage->width || y >= gimage->height) if (x < 0 || y < 0 || x >= gimage->width || y >= gimage->height)
{ return NULL;
return NULL;
}
dest = g_new (unsigned char, 5); dest = g_new (unsigned char, 5);
tile = tile_manager_get_tile (gimp_image_composite (gimage), x, y, tile = tile_manager_get_tile (gimp_image_composite (gimage), x, y,
TRUE, FALSE); TRUE, FALSE);
src = tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT); src = tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT);
gimp_image_get_color (gimage, gimp_image_composite_type (gimage), dest, src); gimp_image_get_color (gimage, gimp_image_composite_type (gimage), dest, src);
if (TYPE_HAS_ALPHA (gimp_image_composite_type (gimage))) if (GIMP_IMAGE_TYPE_HAS_ALPHA (gimp_image_composite_type (gimage)))
dest[3] = src[gimp_image_composite_bytes (gimage) - 1]; dest[3] = src[gimp_image_composite_bytes (gimage) - 1];
else else
dest[3] = 255; dest[3] = 255;
@ -3696,7 +3695,6 @@ gimp_image_construct_composite_preview (GimpImage *gimage,
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL); g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
list = gimage->layers;
ratio = (gdouble) width / (gdouble) gimage->width; ratio = (gdouble) width / (gdouble) gimage->width;
switch (gimp_image_base_type (gimage)) switch (gimp_image_base_type (gimage))
@ -3718,7 +3716,7 @@ gimp_image_construct_composite_preview (GimpImage *gimage,
memset (temp_buf_data (comp), 0, comp->width * comp->height * comp->bytes); memset (temp_buf_data (comp), 0, comp->width * comp->height * comp->bytes);
floating_sel = NULL; floating_sel = NULL;
while (list) for (list = gimage->layers; list; list = g_slist_next (list))
{ {
layer = (Layer *) list->data; layer = (Layer *) list->data;
@ -3738,8 +3736,6 @@ gimp_image_construct_composite_preview (GimpImage *gimage,
reverse_list = g_slist_prepend (reverse_list, layer); reverse_list = g_slist_prepend (reverse_list, layer);
} }
} }
list = g_slist_next (list);
} }
construct_flag = 0; construct_flag = 0;

View File

@ -15,6 +15,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#ifndef __GIMPIMAGE_H__ #ifndef __GIMPIMAGE_H__
#define __GIMPIMAGE_H__ #define __GIMPIMAGE_H__
@ -38,7 +39,7 @@
#define GIMP_IMAGE(obj) GTK_CHECK_CAST (obj, GIMP_TYPE_IMAGE, GimpImage) #define GIMP_IMAGE(obj) GTK_CHECK_CAST (obj, GIMP_TYPE_IMAGE, GimpImage)
#define GIMP_IS_IMAGE(obj) GTK_CHECK_TYPE (obj, GIMP_TYPE_IMAGE) #define GIMP_IS_IMAGE(obj) GTK_CHECK_TYPE (obj, GIMP_TYPE_IMAGE)
#define TYPE_HAS_ALPHA(t) ((t)==RGBA_GIMAGE || (t)==GRAYA_GIMAGE || (t)==INDEXEDA_GIMAGE) #define GIMP_IMAGE_TYPE_HAS_ALPHA(t) ((t)==RGBA_GIMAGE || (t)==GRAYA_GIMAGE || (t)==INDEXEDA_GIMAGE)
#define GRAY_PIX 0 #define GRAY_PIX 0
#define ALPHA_G_PIX 1 #define ALPHA_G_PIX 1
@ -237,27 +238,30 @@ Channel * gimp_image_remove_channel (GimpImage *, Channel *);
void gimp_image_construct (GimpImage *, void gimp_image_construct (GimpImage *,
gint, gint, gint, gint, gint, gint, gint, gint,
gboolean); gboolean);
void gimp_image_invalidate_without_render (GimpImage *, gint, gint, void gimp_image_invalidate_without_render (GimpImage *, gint, gint,
gint, gint, gint, gint, gint, gint,
gint, gint, gint); gint, gint, gint);
void gimp_image_invalidate (GimpImage *, gint, gint, void gimp_image_invalidate (GimpImage *, gint, gint,
gint, gint, gint, gint, gint, gint,
gint, gint, gint); gint, gint, gint);
void gimp_image_validate (TileManager *, Tile *); void gimp_image_validate (TileManager *, Tile *);
/* Access functions */ /* Access functions */
gboolean gimp_image_is_empty (GimpImage *); gboolean gimp_image_is_empty (GimpImage *);
GimpDrawable * gimp_image_active_drawable (GimpImage *); GimpDrawable * gimp_image_active_drawable (GimpImage *);
GimpImageBaseType gimp_image_base_type (GimpImage *);
GimpImageType gimp_image_base_type_with_alpha (GimpImage *); GimpImageBaseType gimp_image_base_type (GimpImage *gimage);
GimpImageType gimp_image_base_type_with_alpha (GimpImage *gimage);
gchar * gimp_image_filename (GimpImage *); gchar * gimp_image_filename (GimpImage *);
gboolean gimp_image_undo_is_enabled (GimpImage *); gboolean gimp_image_undo_is_enabled (GimpImage *);
gboolean gimp_image_undo_enable (GimpImage *); gboolean gimp_image_undo_enable (GimpImage *);
gboolean gimp_image_undo_disable (GimpImage *); gboolean gimp_image_undo_disable (GimpImage *);
gboolean gimp_image_undo_freeze (GimpImage *); gboolean gimp_image_undo_freeze (GimpImage *);
gboolean gimp_image_undo_thaw (GimpImage *); gboolean gimp_image_undo_thaw (GimpImage *);
void gimp_image_undo_event (GimpImage *, int); void gimp_image_undo_event (GimpImage *, gint);
gint gimp_image_dirty (GimpImage *); gint gimp_image_dirty (GimpImage *);
gint gimp_image_clean (GimpImage *); gint gimp_image_clean (GimpImage *);
void gimp_image_clean_all (GimpImage *); void gimp_image_clean_all (GimpImage *);
@ -280,10 +284,12 @@ GimpImageType gimp_image_composite_type (GimpImage *);
gint gimp_image_composite_bytes (GimpImage *); gint gimp_image_composite_bytes (GimpImage *);
TempBuf * gimp_image_composite_preview (GimpImage *, ChannelType, TempBuf * gimp_image_composite_preview (GimpImage *, ChannelType,
gint, gint); gint, gint);
gint gimp_image_preview_valid (GimpImage *, ChannelType); gint gimp_image_preview_valid (GimpImage *, ChannelType);
void gimp_image_invalidate_preview (GimpImage *); void gimp_image_invalidate_preview (GimpImage *);
void gimp_image_invalidate_previews (void); void gimp_image_invalidate_previews (void);
TempBuf * gimp_image_construct_composite_preview (GimpImage *, TempBuf * gimp_image_construct_composite_preview (GimpImage *,
gint , gint); gint , gint);

View File

@ -960,16 +960,15 @@ gimp_image_get_color_at (GimpImage *gimage,
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL); g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
if (x < 0 || y < 0 || x >= gimage->width || y >= gimage->height) if (x < 0 || y < 0 || x >= gimage->width || y >= gimage->height)
{ return NULL;
return NULL;
}
dest = g_new (unsigned char, 5); dest = g_new (unsigned char, 5);
tile = tile_manager_get_tile (gimp_image_composite (gimage), x, y, tile = tile_manager_get_tile (gimp_image_composite (gimage), x, y,
TRUE, FALSE); TRUE, FALSE);
src = tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT); src = tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT);
gimp_image_get_color (gimage, gimp_image_composite_type (gimage), dest, src); gimp_image_get_color (gimage, gimp_image_composite_type (gimage), dest, src);
if (TYPE_HAS_ALPHA (gimp_image_composite_type (gimage))) if (GIMP_IMAGE_TYPE_HAS_ALPHA (gimp_image_composite_type (gimage)))
dest[3] = src[gimp_image_composite_bytes (gimage) - 1]; dest[3] = src[gimp_image_composite_bytes (gimage) - 1];
else else
dest[3] = 255; dest[3] = 255;
@ -3696,7 +3695,6 @@ gimp_image_construct_composite_preview (GimpImage *gimage,
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL); g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
list = gimage->layers;
ratio = (gdouble) width / (gdouble) gimage->width; ratio = (gdouble) width / (gdouble) gimage->width;
switch (gimp_image_base_type (gimage)) switch (gimp_image_base_type (gimage))
@ -3718,7 +3716,7 @@ gimp_image_construct_composite_preview (GimpImage *gimage,
memset (temp_buf_data (comp), 0, comp->width * comp->height * comp->bytes); memset (temp_buf_data (comp), 0, comp->width * comp->height * comp->bytes);
floating_sel = NULL; floating_sel = NULL;
while (list) for (list = gimage->layers; list; list = g_slist_next (list))
{ {
layer = (Layer *) list->data; layer = (Layer *) list->data;
@ -3738,8 +3736,6 @@ gimp_image_construct_composite_preview (GimpImage *gimage,
reverse_list = g_slist_prepend (reverse_list, layer); reverse_list = g_slist_prepend (reverse_list, layer);
} }
} }
list = g_slist_next (list);
} }
construct_flag = 0; construct_flag = 0;

View File

@ -15,6 +15,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#ifndef __GIMPIMAGE_H__ #ifndef __GIMPIMAGE_H__
#define __GIMPIMAGE_H__ #define __GIMPIMAGE_H__
@ -38,7 +39,7 @@
#define GIMP_IMAGE(obj) GTK_CHECK_CAST (obj, GIMP_TYPE_IMAGE, GimpImage) #define GIMP_IMAGE(obj) GTK_CHECK_CAST (obj, GIMP_TYPE_IMAGE, GimpImage)
#define GIMP_IS_IMAGE(obj) GTK_CHECK_TYPE (obj, GIMP_TYPE_IMAGE) #define GIMP_IS_IMAGE(obj) GTK_CHECK_TYPE (obj, GIMP_TYPE_IMAGE)
#define TYPE_HAS_ALPHA(t) ((t)==RGBA_GIMAGE || (t)==GRAYA_GIMAGE || (t)==INDEXEDA_GIMAGE) #define GIMP_IMAGE_TYPE_HAS_ALPHA(t) ((t)==RGBA_GIMAGE || (t)==GRAYA_GIMAGE || (t)==INDEXEDA_GIMAGE)
#define GRAY_PIX 0 #define GRAY_PIX 0
#define ALPHA_G_PIX 1 #define ALPHA_G_PIX 1
@ -237,27 +238,30 @@ Channel * gimp_image_remove_channel (GimpImage *, Channel *);
void gimp_image_construct (GimpImage *, void gimp_image_construct (GimpImage *,
gint, gint, gint, gint, gint, gint, gint, gint,
gboolean); gboolean);
void gimp_image_invalidate_without_render (GimpImage *, gint, gint, void gimp_image_invalidate_without_render (GimpImage *, gint, gint,
gint, gint, gint, gint, gint, gint,
gint, gint, gint); gint, gint, gint);
void gimp_image_invalidate (GimpImage *, gint, gint, void gimp_image_invalidate (GimpImage *, gint, gint,
gint, gint, gint, gint, gint, gint,
gint, gint, gint); gint, gint, gint);
void gimp_image_validate (TileManager *, Tile *); void gimp_image_validate (TileManager *, Tile *);
/* Access functions */ /* Access functions */
gboolean gimp_image_is_empty (GimpImage *); gboolean gimp_image_is_empty (GimpImage *);
GimpDrawable * gimp_image_active_drawable (GimpImage *); GimpDrawable * gimp_image_active_drawable (GimpImage *);
GimpImageBaseType gimp_image_base_type (GimpImage *);
GimpImageType gimp_image_base_type_with_alpha (GimpImage *); GimpImageBaseType gimp_image_base_type (GimpImage *gimage);
GimpImageType gimp_image_base_type_with_alpha (GimpImage *gimage);
gchar * gimp_image_filename (GimpImage *); gchar * gimp_image_filename (GimpImage *);
gboolean gimp_image_undo_is_enabled (GimpImage *); gboolean gimp_image_undo_is_enabled (GimpImage *);
gboolean gimp_image_undo_enable (GimpImage *); gboolean gimp_image_undo_enable (GimpImage *);
gboolean gimp_image_undo_disable (GimpImage *); gboolean gimp_image_undo_disable (GimpImage *);
gboolean gimp_image_undo_freeze (GimpImage *); gboolean gimp_image_undo_freeze (GimpImage *);
gboolean gimp_image_undo_thaw (GimpImage *); gboolean gimp_image_undo_thaw (GimpImage *);
void gimp_image_undo_event (GimpImage *, int); void gimp_image_undo_event (GimpImage *, gint);
gint gimp_image_dirty (GimpImage *); gint gimp_image_dirty (GimpImage *);
gint gimp_image_clean (GimpImage *); gint gimp_image_clean (GimpImage *);
void gimp_image_clean_all (GimpImage *); void gimp_image_clean_all (GimpImage *);
@ -280,10 +284,12 @@ GimpImageType gimp_image_composite_type (GimpImage *);
gint gimp_image_composite_bytes (GimpImage *); gint gimp_image_composite_bytes (GimpImage *);
TempBuf * gimp_image_composite_preview (GimpImage *, ChannelType, TempBuf * gimp_image_composite_preview (GimpImage *, ChannelType,
gint, gint); gint, gint);
gint gimp_image_preview_valid (GimpImage *, ChannelType); gint gimp_image_preview_valid (GimpImage *, ChannelType);
void gimp_image_invalidate_preview (GimpImage *); void gimp_image_invalidate_preview (GimpImage *);
void gimp_image_invalidate_previews (void); void gimp_image_invalidate_previews (void);
TempBuf * gimp_image_construct_composite_preview (GimpImage *, TempBuf * gimp_image_construct_composite_preview (GimpImage *,
gint , gint); gint , gint);

View File

@ -960,16 +960,15 @@ gimp_image_get_color_at (GimpImage *gimage,
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL); g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
if (x < 0 || y < 0 || x >= gimage->width || y >= gimage->height) if (x < 0 || y < 0 || x >= gimage->width || y >= gimage->height)
{ return NULL;
return NULL;
}
dest = g_new (unsigned char, 5); dest = g_new (unsigned char, 5);
tile = tile_manager_get_tile (gimp_image_composite (gimage), x, y, tile = tile_manager_get_tile (gimp_image_composite (gimage), x, y,
TRUE, FALSE); TRUE, FALSE);
src = tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT); src = tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT);
gimp_image_get_color (gimage, gimp_image_composite_type (gimage), dest, src); gimp_image_get_color (gimage, gimp_image_composite_type (gimage), dest, src);
if (TYPE_HAS_ALPHA (gimp_image_composite_type (gimage))) if (GIMP_IMAGE_TYPE_HAS_ALPHA (gimp_image_composite_type (gimage)))
dest[3] = src[gimp_image_composite_bytes (gimage) - 1]; dest[3] = src[gimp_image_composite_bytes (gimage) - 1];
else else
dest[3] = 255; dest[3] = 255;
@ -3696,7 +3695,6 @@ gimp_image_construct_composite_preview (GimpImage *gimage,
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL); g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
list = gimage->layers;
ratio = (gdouble) width / (gdouble) gimage->width; ratio = (gdouble) width / (gdouble) gimage->width;
switch (gimp_image_base_type (gimage)) switch (gimp_image_base_type (gimage))
@ -3718,7 +3716,7 @@ gimp_image_construct_composite_preview (GimpImage *gimage,
memset (temp_buf_data (comp), 0, comp->width * comp->height * comp->bytes); memset (temp_buf_data (comp), 0, comp->width * comp->height * comp->bytes);
floating_sel = NULL; floating_sel = NULL;
while (list) for (list = gimage->layers; list; list = g_slist_next (list))
{ {
layer = (Layer *) list->data; layer = (Layer *) list->data;
@ -3738,8 +3736,6 @@ gimp_image_construct_composite_preview (GimpImage *gimage,
reverse_list = g_slist_prepend (reverse_list, layer); reverse_list = g_slist_prepend (reverse_list, layer);
} }
} }
list = g_slist_next (list);
} }
construct_flag = 0; construct_flag = 0;

View File

@ -15,6 +15,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#ifndef __GIMPIMAGE_H__ #ifndef __GIMPIMAGE_H__
#define __GIMPIMAGE_H__ #define __GIMPIMAGE_H__
@ -38,7 +39,7 @@
#define GIMP_IMAGE(obj) GTK_CHECK_CAST (obj, GIMP_TYPE_IMAGE, GimpImage) #define GIMP_IMAGE(obj) GTK_CHECK_CAST (obj, GIMP_TYPE_IMAGE, GimpImage)
#define GIMP_IS_IMAGE(obj) GTK_CHECK_TYPE (obj, GIMP_TYPE_IMAGE) #define GIMP_IS_IMAGE(obj) GTK_CHECK_TYPE (obj, GIMP_TYPE_IMAGE)
#define TYPE_HAS_ALPHA(t) ((t)==RGBA_GIMAGE || (t)==GRAYA_GIMAGE || (t)==INDEXEDA_GIMAGE) #define GIMP_IMAGE_TYPE_HAS_ALPHA(t) ((t)==RGBA_GIMAGE || (t)==GRAYA_GIMAGE || (t)==INDEXEDA_GIMAGE)
#define GRAY_PIX 0 #define GRAY_PIX 0
#define ALPHA_G_PIX 1 #define ALPHA_G_PIX 1
@ -237,27 +238,30 @@ Channel * gimp_image_remove_channel (GimpImage *, Channel *);
void gimp_image_construct (GimpImage *, void gimp_image_construct (GimpImage *,
gint, gint, gint, gint, gint, gint, gint, gint,
gboolean); gboolean);
void gimp_image_invalidate_without_render (GimpImage *, gint, gint, void gimp_image_invalidate_without_render (GimpImage *, gint, gint,
gint, gint, gint, gint, gint, gint,
gint, gint, gint); gint, gint, gint);
void gimp_image_invalidate (GimpImage *, gint, gint, void gimp_image_invalidate (GimpImage *, gint, gint,
gint, gint, gint, gint, gint, gint,
gint, gint, gint); gint, gint, gint);
void gimp_image_validate (TileManager *, Tile *); void gimp_image_validate (TileManager *, Tile *);
/* Access functions */ /* Access functions */
gboolean gimp_image_is_empty (GimpImage *); gboolean gimp_image_is_empty (GimpImage *);
GimpDrawable * gimp_image_active_drawable (GimpImage *); GimpDrawable * gimp_image_active_drawable (GimpImage *);
GimpImageBaseType gimp_image_base_type (GimpImage *);
GimpImageType gimp_image_base_type_with_alpha (GimpImage *); GimpImageBaseType gimp_image_base_type (GimpImage *gimage);
GimpImageType gimp_image_base_type_with_alpha (GimpImage *gimage);
gchar * gimp_image_filename (GimpImage *); gchar * gimp_image_filename (GimpImage *);
gboolean gimp_image_undo_is_enabled (GimpImage *); gboolean gimp_image_undo_is_enabled (GimpImage *);
gboolean gimp_image_undo_enable (GimpImage *); gboolean gimp_image_undo_enable (GimpImage *);
gboolean gimp_image_undo_disable (GimpImage *); gboolean gimp_image_undo_disable (GimpImage *);
gboolean gimp_image_undo_freeze (GimpImage *); gboolean gimp_image_undo_freeze (GimpImage *);
gboolean gimp_image_undo_thaw (GimpImage *); gboolean gimp_image_undo_thaw (GimpImage *);
void gimp_image_undo_event (GimpImage *, int); void gimp_image_undo_event (GimpImage *, gint);
gint gimp_image_dirty (GimpImage *); gint gimp_image_dirty (GimpImage *);
gint gimp_image_clean (GimpImage *); gint gimp_image_clean (GimpImage *);
void gimp_image_clean_all (GimpImage *); void gimp_image_clean_all (GimpImage *);
@ -280,10 +284,12 @@ GimpImageType gimp_image_composite_type (GimpImage *);
gint gimp_image_composite_bytes (GimpImage *); gint gimp_image_composite_bytes (GimpImage *);
TempBuf * gimp_image_composite_preview (GimpImage *, ChannelType, TempBuf * gimp_image_composite_preview (GimpImage *, ChannelType,
gint, gint); gint, gint);
gint gimp_image_preview_valid (GimpImage *, ChannelType); gint gimp_image_preview_valid (GimpImage *, ChannelType);
void gimp_image_invalidate_preview (GimpImage *); void gimp_image_invalidate_preview (GimpImage *);
void gimp_image_invalidate_previews (void); void gimp_image_invalidate_previews (void);
TempBuf * gimp_image_construct_composite_preview (GimpImage *, TempBuf * gimp_image_construct_composite_preview (GimpImage *,
gint , gint); gint , gint);

View File

@ -960,16 +960,15 @@ gimp_image_get_color_at (GimpImage *gimage,
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL); g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
if (x < 0 || y < 0 || x >= gimage->width || y >= gimage->height) if (x < 0 || y < 0 || x >= gimage->width || y >= gimage->height)
{ return NULL;
return NULL;
}
dest = g_new (unsigned char, 5); dest = g_new (unsigned char, 5);
tile = tile_manager_get_tile (gimp_image_composite (gimage), x, y, tile = tile_manager_get_tile (gimp_image_composite (gimage), x, y,
TRUE, FALSE); TRUE, FALSE);
src = tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT); src = tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT);
gimp_image_get_color (gimage, gimp_image_composite_type (gimage), dest, src); gimp_image_get_color (gimage, gimp_image_composite_type (gimage), dest, src);
if (TYPE_HAS_ALPHA (gimp_image_composite_type (gimage))) if (GIMP_IMAGE_TYPE_HAS_ALPHA (gimp_image_composite_type (gimage)))
dest[3] = src[gimp_image_composite_bytes (gimage) - 1]; dest[3] = src[gimp_image_composite_bytes (gimage) - 1];
else else
dest[3] = 255; dest[3] = 255;
@ -3696,7 +3695,6 @@ gimp_image_construct_composite_preview (GimpImage *gimage,
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL); g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
list = gimage->layers;
ratio = (gdouble) width / (gdouble) gimage->width; ratio = (gdouble) width / (gdouble) gimage->width;
switch (gimp_image_base_type (gimage)) switch (gimp_image_base_type (gimage))
@ -3718,7 +3716,7 @@ gimp_image_construct_composite_preview (GimpImage *gimage,
memset (temp_buf_data (comp), 0, comp->width * comp->height * comp->bytes); memset (temp_buf_data (comp), 0, comp->width * comp->height * comp->bytes);
floating_sel = NULL; floating_sel = NULL;
while (list) for (list = gimage->layers; list; list = g_slist_next (list))
{ {
layer = (Layer *) list->data; layer = (Layer *) list->data;
@ -3738,8 +3736,6 @@ gimp_image_construct_composite_preview (GimpImage *gimage,
reverse_list = g_slist_prepend (reverse_list, layer); reverse_list = g_slist_prepend (reverse_list, layer);
} }
} }
list = g_slist_next (list);
} }
construct_flag = 0; construct_flag = 0;

View File

@ -15,6 +15,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#ifndef __GIMPIMAGE_H__ #ifndef __GIMPIMAGE_H__
#define __GIMPIMAGE_H__ #define __GIMPIMAGE_H__
@ -38,7 +39,7 @@
#define GIMP_IMAGE(obj) GTK_CHECK_CAST (obj, GIMP_TYPE_IMAGE, GimpImage) #define GIMP_IMAGE(obj) GTK_CHECK_CAST (obj, GIMP_TYPE_IMAGE, GimpImage)
#define GIMP_IS_IMAGE(obj) GTK_CHECK_TYPE (obj, GIMP_TYPE_IMAGE) #define GIMP_IS_IMAGE(obj) GTK_CHECK_TYPE (obj, GIMP_TYPE_IMAGE)
#define TYPE_HAS_ALPHA(t) ((t)==RGBA_GIMAGE || (t)==GRAYA_GIMAGE || (t)==INDEXEDA_GIMAGE) #define GIMP_IMAGE_TYPE_HAS_ALPHA(t) ((t)==RGBA_GIMAGE || (t)==GRAYA_GIMAGE || (t)==INDEXEDA_GIMAGE)
#define GRAY_PIX 0 #define GRAY_PIX 0
#define ALPHA_G_PIX 1 #define ALPHA_G_PIX 1
@ -237,27 +238,30 @@ Channel * gimp_image_remove_channel (GimpImage *, Channel *);
void gimp_image_construct (GimpImage *, void gimp_image_construct (GimpImage *,
gint, gint, gint, gint, gint, gint, gint, gint,
gboolean); gboolean);
void gimp_image_invalidate_without_render (GimpImage *, gint, gint, void gimp_image_invalidate_without_render (GimpImage *, gint, gint,
gint, gint, gint, gint, gint, gint,
gint, gint, gint); gint, gint, gint);
void gimp_image_invalidate (GimpImage *, gint, gint, void gimp_image_invalidate (GimpImage *, gint, gint,
gint, gint, gint, gint, gint, gint,
gint, gint, gint); gint, gint, gint);
void gimp_image_validate (TileManager *, Tile *); void gimp_image_validate (TileManager *, Tile *);
/* Access functions */ /* Access functions */
gboolean gimp_image_is_empty (GimpImage *); gboolean gimp_image_is_empty (GimpImage *);
GimpDrawable * gimp_image_active_drawable (GimpImage *); GimpDrawable * gimp_image_active_drawable (GimpImage *);
GimpImageBaseType gimp_image_base_type (GimpImage *);
GimpImageType gimp_image_base_type_with_alpha (GimpImage *); GimpImageBaseType gimp_image_base_type (GimpImage *gimage);
GimpImageType gimp_image_base_type_with_alpha (GimpImage *gimage);
gchar * gimp_image_filename (GimpImage *); gchar * gimp_image_filename (GimpImage *);
gboolean gimp_image_undo_is_enabled (GimpImage *); gboolean gimp_image_undo_is_enabled (GimpImage *);
gboolean gimp_image_undo_enable (GimpImage *); gboolean gimp_image_undo_enable (GimpImage *);
gboolean gimp_image_undo_disable (GimpImage *); gboolean gimp_image_undo_disable (GimpImage *);
gboolean gimp_image_undo_freeze (GimpImage *); gboolean gimp_image_undo_freeze (GimpImage *);
gboolean gimp_image_undo_thaw (GimpImage *); gboolean gimp_image_undo_thaw (GimpImage *);
void gimp_image_undo_event (GimpImage *, int); void gimp_image_undo_event (GimpImage *, gint);
gint gimp_image_dirty (GimpImage *); gint gimp_image_dirty (GimpImage *);
gint gimp_image_clean (GimpImage *); gint gimp_image_clean (GimpImage *);
void gimp_image_clean_all (GimpImage *); void gimp_image_clean_all (GimpImage *);
@ -280,10 +284,12 @@ GimpImageType gimp_image_composite_type (GimpImage *);
gint gimp_image_composite_bytes (GimpImage *); gint gimp_image_composite_bytes (GimpImage *);
TempBuf * gimp_image_composite_preview (GimpImage *, ChannelType, TempBuf * gimp_image_composite_preview (GimpImage *, ChannelType,
gint, gint); gint, gint);
gint gimp_image_preview_valid (GimpImage *, ChannelType); gint gimp_image_preview_valid (GimpImage *, ChannelType);
void gimp_image_invalidate_preview (GimpImage *); void gimp_image_invalidate_preview (GimpImage *);
void gimp_image_invalidate_previews (void); void gimp_image_invalidate_previews (void);
TempBuf * gimp_image_construct_composite_preview (GimpImage *, TempBuf * gimp_image_construct_composite_preview (GimpImage *,
gint , gint); gint , gint);

View File

@ -1599,7 +1599,7 @@ undo_pop_layer_mod (GImage *gimage,
GIMP_DRAWABLE (layer)->height = tiles->height; GIMP_DRAWABLE (layer)->height = tiles->height;
GIMP_DRAWABLE (layer)->bytes = tiles->bpp; GIMP_DRAWABLE (layer)->bytes = tiles->bpp;
GIMP_DRAWABLE (layer)->type = layer_type; GIMP_DRAWABLE (layer)->type = layer_type;
GIMP_DRAWABLE (layer)->has_alpha = TYPE_HAS_ALPHA (layer_type); GIMP_DRAWABLE (layer)->has_alpha = GIMP_IMAGE_TYPE_HAS_ALPHA (layer_type);
if (layer->mask) if (layer->mask)
{ {

View File

@ -960,16 +960,15 @@ gimp_image_get_color_at (GimpImage *gimage,
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL); g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
if (x < 0 || y < 0 || x >= gimage->width || y >= gimage->height) if (x < 0 || y < 0 || x >= gimage->width || y >= gimage->height)
{ return NULL;
return NULL;
}
dest = g_new (unsigned char, 5); dest = g_new (unsigned char, 5);
tile = tile_manager_get_tile (gimp_image_composite (gimage), x, y, tile = tile_manager_get_tile (gimp_image_composite (gimage), x, y,
TRUE, FALSE); TRUE, FALSE);
src = tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT); src = tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT);
gimp_image_get_color (gimage, gimp_image_composite_type (gimage), dest, src); gimp_image_get_color (gimage, gimp_image_composite_type (gimage), dest, src);
if (TYPE_HAS_ALPHA (gimp_image_composite_type (gimage))) if (GIMP_IMAGE_TYPE_HAS_ALPHA (gimp_image_composite_type (gimage)))
dest[3] = src[gimp_image_composite_bytes (gimage) - 1]; dest[3] = src[gimp_image_composite_bytes (gimage) - 1];
else else
dest[3] = 255; dest[3] = 255;
@ -3696,7 +3695,6 @@ gimp_image_construct_composite_preview (GimpImage *gimage,
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL); g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
list = gimage->layers;
ratio = (gdouble) width / (gdouble) gimage->width; ratio = (gdouble) width / (gdouble) gimage->width;
switch (gimp_image_base_type (gimage)) switch (gimp_image_base_type (gimage))
@ -3718,7 +3716,7 @@ gimp_image_construct_composite_preview (GimpImage *gimage,
memset (temp_buf_data (comp), 0, comp->width * comp->height * comp->bytes); memset (temp_buf_data (comp), 0, comp->width * comp->height * comp->bytes);
floating_sel = NULL; floating_sel = NULL;
while (list) for (list = gimage->layers; list; list = g_slist_next (list))
{ {
layer = (Layer *) list->data; layer = (Layer *) list->data;
@ -3738,8 +3736,6 @@ gimp_image_construct_composite_preview (GimpImage *gimage,
reverse_list = g_slist_prepend (reverse_list, layer); reverse_list = g_slist_prepend (reverse_list, layer);
} }
} }
list = g_slist_next (list);
} }
construct_flag = 0; construct_flag = 0;

View File

@ -15,6 +15,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#ifndef __GIMPIMAGE_H__ #ifndef __GIMPIMAGE_H__
#define __GIMPIMAGE_H__ #define __GIMPIMAGE_H__
@ -38,7 +39,7 @@
#define GIMP_IMAGE(obj) GTK_CHECK_CAST (obj, GIMP_TYPE_IMAGE, GimpImage) #define GIMP_IMAGE(obj) GTK_CHECK_CAST (obj, GIMP_TYPE_IMAGE, GimpImage)
#define GIMP_IS_IMAGE(obj) GTK_CHECK_TYPE (obj, GIMP_TYPE_IMAGE) #define GIMP_IS_IMAGE(obj) GTK_CHECK_TYPE (obj, GIMP_TYPE_IMAGE)
#define TYPE_HAS_ALPHA(t) ((t)==RGBA_GIMAGE || (t)==GRAYA_GIMAGE || (t)==INDEXEDA_GIMAGE) #define GIMP_IMAGE_TYPE_HAS_ALPHA(t) ((t)==RGBA_GIMAGE || (t)==GRAYA_GIMAGE || (t)==INDEXEDA_GIMAGE)
#define GRAY_PIX 0 #define GRAY_PIX 0
#define ALPHA_G_PIX 1 #define ALPHA_G_PIX 1
@ -237,27 +238,30 @@ Channel * gimp_image_remove_channel (GimpImage *, Channel *);
void gimp_image_construct (GimpImage *, void gimp_image_construct (GimpImage *,
gint, gint, gint, gint, gint, gint, gint, gint,
gboolean); gboolean);
void gimp_image_invalidate_without_render (GimpImage *, gint, gint, void gimp_image_invalidate_without_render (GimpImage *, gint, gint,
gint, gint, gint, gint, gint, gint,
gint, gint, gint); gint, gint, gint);
void gimp_image_invalidate (GimpImage *, gint, gint, void gimp_image_invalidate (GimpImage *, gint, gint,
gint, gint, gint, gint, gint, gint,
gint, gint, gint); gint, gint, gint);
void gimp_image_validate (TileManager *, Tile *); void gimp_image_validate (TileManager *, Tile *);
/* Access functions */ /* Access functions */
gboolean gimp_image_is_empty (GimpImage *); gboolean gimp_image_is_empty (GimpImage *);
GimpDrawable * gimp_image_active_drawable (GimpImage *); GimpDrawable * gimp_image_active_drawable (GimpImage *);
GimpImageBaseType gimp_image_base_type (GimpImage *);
GimpImageType gimp_image_base_type_with_alpha (GimpImage *); GimpImageBaseType gimp_image_base_type (GimpImage *gimage);
GimpImageType gimp_image_base_type_with_alpha (GimpImage *gimage);
gchar * gimp_image_filename (GimpImage *); gchar * gimp_image_filename (GimpImage *);
gboolean gimp_image_undo_is_enabled (GimpImage *); gboolean gimp_image_undo_is_enabled (GimpImage *);
gboolean gimp_image_undo_enable (GimpImage *); gboolean gimp_image_undo_enable (GimpImage *);
gboolean gimp_image_undo_disable (GimpImage *); gboolean gimp_image_undo_disable (GimpImage *);
gboolean gimp_image_undo_freeze (GimpImage *); gboolean gimp_image_undo_freeze (GimpImage *);
gboolean gimp_image_undo_thaw (GimpImage *); gboolean gimp_image_undo_thaw (GimpImage *);
void gimp_image_undo_event (GimpImage *, int); void gimp_image_undo_event (GimpImage *, gint);
gint gimp_image_dirty (GimpImage *); gint gimp_image_dirty (GimpImage *);
gint gimp_image_clean (GimpImage *); gint gimp_image_clean (GimpImage *);
void gimp_image_clean_all (GimpImage *); void gimp_image_clean_all (GimpImage *);
@ -280,10 +284,12 @@ GimpImageType gimp_image_composite_type (GimpImage *);
gint gimp_image_composite_bytes (GimpImage *); gint gimp_image_composite_bytes (GimpImage *);
TempBuf * gimp_image_composite_preview (GimpImage *, ChannelType, TempBuf * gimp_image_composite_preview (GimpImage *, ChannelType,
gint, gint); gint, gint);
gint gimp_image_preview_valid (GimpImage *, ChannelType); gint gimp_image_preview_valid (GimpImage *, ChannelType);
void gimp_image_invalidate_preview (GimpImage *); void gimp_image_invalidate_preview (GimpImage *);
void gimp_image_invalidate_previews (void); void gimp_image_invalidate_previews (void);
TempBuf * gimp_image_construct_composite_preview (GimpImage *, TempBuf * gimp_image_construct_composite_preview (GimpImage *,
gint , gint); gint , gint);

View File

@ -322,12 +322,12 @@ image_map_get_color_at (ImageMap image_map,
gint x, gint x,
gint y) gint y)
{ {
Tile *tile; Tile *tile;
unsigned char *src; unsigned char *src;
unsigned char *dest; unsigned char *dest;
_ImageMap *_image_map; _ImageMap *_image_map;
if(!image_map) if (!image_map)
return NULL; return NULL;
_image_map = (_ImageMap *) image_map; _image_map = (_ImageMap *) image_map;
@ -359,11 +359,11 @@ image_map_get_color_at (ImageMap image_map,
gimp_image_get_color (gimp_drawable_gimage(_image_map->drawable), gimp_image_get_color (gimp_drawable_gimage(_image_map->drawable),
gimp_drawable_type (_image_map->drawable), dest, src); gimp_drawable_type (_image_map->drawable), dest, src);
if(TYPE_HAS_ALPHA(gimp_drawable_type (_image_map->drawable))) if (GIMP_IMAGE_TYPE_HAS_ALPHA (gimp_drawable_type (_image_map->drawable)))
dest[3] = src[gimp_drawable_bytes (_image_map->drawable) - 1]; dest[3] = src[gimp_drawable_bytes (_image_map->drawable) - 1];
else else
dest[3] = 255; dest[3] = 255;
if (gimp_drawable_is_indexed(_image_map->drawable)) if (gimp_drawable_is_indexed (_image_map->drawable))
dest[4] = src[0]; dest[4] = src[0];
else else
dest[4] = 0; dest[4] = 0;

View File

@ -443,7 +443,7 @@ layer_new_from_tiles (GimpImage *gimage,
return NULL; return NULL;
/* the layer_type needs to have alpha */ /* the layer_type needs to have alpha */
g_return_val_if_fail (TYPE_HAS_ALPHA (layer_type), NULL); g_return_val_if_fail (GIMP_IMAGE_TYPE_HAS_ALPHA (layer_type), NULL);
/* Create the new layer */ /* Create the new layer */
new_layer = layer_new (0, tiles->width, tiles->height, new_layer = layer_new (0, tiles->width, tiles->height,
@ -754,7 +754,7 @@ layer_add_alpha (Layer *layer)
GIMP_DRAWABLE(layer)->tiles = new_tiles; GIMP_DRAWABLE(layer)->tiles = new_tiles;
GIMP_DRAWABLE(layer)->type = type; GIMP_DRAWABLE(layer)->type = type;
GIMP_DRAWABLE(layer)->bytes = GIMP_DRAWABLE(layer)->bytes + 1; GIMP_DRAWABLE(layer)->bytes = GIMP_DRAWABLE(layer)->bytes + 1;
GIMP_DRAWABLE(layer)->has_alpha = TYPE_HAS_ALPHA (type); GIMP_DRAWABLE(layer)->has_alpha = GIMP_IMAGE_TYPE_HAS_ALPHA (type);
GIMP_DRAWABLE(layer)->preview_valid = FALSE; GIMP_DRAWABLE(layer)->preview_valid = FALSE;
gtk_signal_emit_by_name (GTK_OBJECT (gimp_drawable_gimage (GIMP_DRAWABLE (layer))), gtk_signal_emit_by_name (GTK_OBJECT (gimp_drawable_gimage (GIMP_DRAWABLE (layer))),
@ -1277,12 +1277,10 @@ layer_get_mask (Layer *layer)
gboolean gboolean
layer_has_alpha (Layer *layer) layer_has_alpha (Layer *layer)
{ {
if (GIMP_DRAWABLE(layer)->type == RGBA_GIMAGE || g_return_if_fail (layer != NULL);
GIMP_DRAWABLE(layer)->type == GRAYA_GIMAGE || g_return_if_fail (GIMP_IS_LAYER (layer));
GIMP_DRAWABLE(layer)->type == INDEXEDA_GIMAGE)
return TRUE; return GIMP_IMAGE_TYPE_HAS_ALPHA (GIMP_DRAWABLE (layer)->type);
else
return FALSE;
} }
gboolean gboolean

View File

@ -960,16 +960,15 @@ gimp_image_get_color_at (GimpImage *gimage,
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL); g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
if (x < 0 || y < 0 || x >= gimage->width || y >= gimage->height) if (x < 0 || y < 0 || x >= gimage->width || y >= gimage->height)
{ return NULL;
return NULL;
}
dest = g_new (unsigned char, 5); dest = g_new (unsigned char, 5);
tile = tile_manager_get_tile (gimp_image_composite (gimage), x, y, tile = tile_manager_get_tile (gimp_image_composite (gimage), x, y,
TRUE, FALSE); TRUE, FALSE);
src = tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT); src = tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT);
gimp_image_get_color (gimage, gimp_image_composite_type (gimage), dest, src); gimp_image_get_color (gimage, gimp_image_composite_type (gimage), dest, src);
if (TYPE_HAS_ALPHA (gimp_image_composite_type (gimage))) if (GIMP_IMAGE_TYPE_HAS_ALPHA (gimp_image_composite_type (gimage)))
dest[3] = src[gimp_image_composite_bytes (gimage) - 1]; dest[3] = src[gimp_image_composite_bytes (gimage) - 1];
else else
dest[3] = 255; dest[3] = 255;
@ -3696,7 +3695,6 @@ gimp_image_construct_composite_preview (GimpImage *gimage,
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL); g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
list = gimage->layers;
ratio = (gdouble) width / (gdouble) gimage->width; ratio = (gdouble) width / (gdouble) gimage->width;
switch (gimp_image_base_type (gimage)) switch (gimp_image_base_type (gimage))
@ -3718,7 +3716,7 @@ gimp_image_construct_composite_preview (GimpImage *gimage,
memset (temp_buf_data (comp), 0, comp->width * comp->height * comp->bytes); memset (temp_buf_data (comp), 0, comp->width * comp->height * comp->bytes);
floating_sel = NULL; floating_sel = NULL;
while (list) for (list = gimage->layers; list; list = g_slist_next (list))
{ {
layer = (Layer *) list->data; layer = (Layer *) list->data;
@ -3738,8 +3736,6 @@ gimp_image_construct_composite_preview (GimpImage *gimage,
reverse_list = g_slist_prepend (reverse_list, layer); reverse_list = g_slist_prepend (reverse_list, layer);
} }
} }
list = g_slist_next (list);
} }
construct_flag = 0; construct_flag = 0;

View File

@ -15,6 +15,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#ifndef __GIMPIMAGE_H__ #ifndef __GIMPIMAGE_H__
#define __GIMPIMAGE_H__ #define __GIMPIMAGE_H__
@ -38,7 +39,7 @@
#define GIMP_IMAGE(obj) GTK_CHECK_CAST (obj, GIMP_TYPE_IMAGE, GimpImage) #define GIMP_IMAGE(obj) GTK_CHECK_CAST (obj, GIMP_TYPE_IMAGE, GimpImage)
#define GIMP_IS_IMAGE(obj) GTK_CHECK_TYPE (obj, GIMP_TYPE_IMAGE) #define GIMP_IS_IMAGE(obj) GTK_CHECK_TYPE (obj, GIMP_TYPE_IMAGE)
#define TYPE_HAS_ALPHA(t) ((t)==RGBA_GIMAGE || (t)==GRAYA_GIMAGE || (t)==INDEXEDA_GIMAGE) #define GIMP_IMAGE_TYPE_HAS_ALPHA(t) ((t)==RGBA_GIMAGE || (t)==GRAYA_GIMAGE || (t)==INDEXEDA_GIMAGE)
#define GRAY_PIX 0 #define GRAY_PIX 0
#define ALPHA_G_PIX 1 #define ALPHA_G_PIX 1
@ -237,27 +238,30 @@ Channel * gimp_image_remove_channel (GimpImage *, Channel *);
void gimp_image_construct (GimpImage *, void gimp_image_construct (GimpImage *,
gint, gint, gint, gint, gint, gint, gint, gint,
gboolean); gboolean);
void gimp_image_invalidate_without_render (GimpImage *, gint, gint, void gimp_image_invalidate_without_render (GimpImage *, gint, gint,
gint, gint, gint, gint, gint, gint,
gint, gint, gint); gint, gint, gint);
void gimp_image_invalidate (GimpImage *, gint, gint, void gimp_image_invalidate (GimpImage *, gint, gint,
gint, gint, gint, gint, gint, gint,
gint, gint, gint); gint, gint, gint);
void gimp_image_validate (TileManager *, Tile *); void gimp_image_validate (TileManager *, Tile *);
/* Access functions */ /* Access functions */
gboolean gimp_image_is_empty (GimpImage *); gboolean gimp_image_is_empty (GimpImage *);
GimpDrawable * gimp_image_active_drawable (GimpImage *); GimpDrawable * gimp_image_active_drawable (GimpImage *);
GimpImageBaseType gimp_image_base_type (GimpImage *);
GimpImageType gimp_image_base_type_with_alpha (GimpImage *); GimpImageBaseType gimp_image_base_type (GimpImage *gimage);
GimpImageType gimp_image_base_type_with_alpha (GimpImage *gimage);
gchar * gimp_image_filename (GimpImage *); gchar * gimp_image_filename (GimpImage *);
gboolean gimp_image_undo_is_enabled (GimpImage *); gboolean gimp_image_undo_is_enabled (GimpImage *);
gboolean gimp_image_undo_enable (GimpImage *); gboolean gimp_image_undo_enable (GimpImage *);
gboolean gimp_image_undo_disable (GimpImage *); gboolean gimp_image_undo_disable (GimpImage *);
gboolean gimp_image_undo_freeze (GimpImage *); gboolean gimp_image_undo_freeze (GimpImage *);
gboolean gimp_image_undo_thaw (GimpImage *); gboolean gimp_image_undo_thaw (GimpImage *);
void gimp_image_undo_event (GimpImage *, int); void gimp_image_undo_event (GimpImage *, gint);
gint gimp_image_dirty (GimpImage *); gint gimp_image_dirty (GimpImage *);
gint gimp_image_clean (GimpImage *); gint gimp_image_clean (GimpImage *);
void gimp_image_clean_all (GimpImage *); void gimp_image_clean_all (GimpImage *);
@ -280,10 +284,12 @@ GimpImageType gimp_image_composite_type (GimpImage *);
gint gimp_image_composite_bytes (GimpImage *); gint gimp_image_composite_bytes (GimpImage *);
TempBuf * gimp_image_composite_preview (GimpImage *, ChannelType, TempBuf * gimp_image_composite_preview (GimpImage *, ChannelType,
gint, gint); gint, gint);
gint gimp_image_preview_valid (GimpImage *, ChannelType); gint gimp_image_preview_valid (GimpImage *, ChannelType);
void gimp_image_invalidate_preview (GimpImage *); void gimp_image_invalidate_preview (GimpImage *);
void gimp_image_invalidate_previews (void); void gimp_image_invalidate_previews (void);
TempBuf * gimp_image_construct_composite_preview (GimpImage *, TempBuf * gimp_image_construct_composite_preview (GimpImage *,
gint , gint); gint , gint);

View File

@ -135,22 +135,24 @@ static void curves_write_to_file (FILE *f);
/* curves machinery */ /* curves machinery */
float gfloat
curves_lut_func (CurvesDialog *cd, curves_lut_func (CurvesDialog *cd,
gint nchannels, gint nchannels,
gint channel, gint channel,
gfloat value) gfloat value)
{ {
float f; gfloat f;
int index; gint index;
double inten; gdouble inten;
int j; gint j;
if (nchannels == 1) if (nchannels == 1)
j = 0; j = 0;
else else
j = channel + 1; j = channel + 1;
inten = value; inten = value;
/* For color images this runs through the loop with j = channel +1 /* For color images this runs through the loop with j = channel +1
the first time and j = 0 the second time */ the first time and j = 0 the second time */
/* For bw images this runs through the loop with j = 0 the first and /* For bw images this runs through the loop with j = 0 the first and
@ -184,12 +186,13 @@ curves_colour_update (Tool *tool,
gint x, gint x,
gint y) gint y)
{ {
unsigned char *color; guchar *color;
int offx, offy; gint offx;
int has_alpha; gint offy;
int is_indexed; gint maxval;
int sample_type; gboolean has_alpha;
int maxval; gboolean is_indexed;
GimpImageType sample_type;
if(!tool || tool->state != ACTIVE) if(!tool || tool->state != ACTIVE)
return; return;
@ -203,8 +206,8 @@ curves_colour_update (Tool *tool,
return; return;
sample_type = gimp_drawable_type (drawable); sample_type = gimp_drawable_type (drawable);
is_indexed = gimp_drawable_is_indexed (drawable); is_indexed = gimp_drawable_is_indexed (drawable);
has_alpha = TYPE_HAS_ALPHA (sample_type); has_alpha = GIMP_IMAGE_TYPE_HAS_ALPHA (sample_type);
curves_dialog->col_value[HISTOGRAM_RED] = color[RED_PIX]; curves_dialog->col_value[HISTOGRAM_RED] = color[RED_PIX];
curves_dialog->col_value[HISTOGRAM_GREEN] = color[GREEN_PIX]; curves_dialog->col_value[HISTOGRAM_GREEN] = color[GREEN_PIX];
@ -231,10 +234,10 @@ curves_add_point (GimpDrawable *drawable,
gint cchan) gint cchan)
{ {
/* Add point onto the curve */ /* Add point onto the curve */
int closest_point = 0; gint closest_point = 0;
int distance; gint distance;
int curvex; gint curvex;
int i; gint i;
switch (curves_dialog->curve_type[cchan]) switch (curves_dialog->curve_type[cchan])
{ {
@ -271,9 +274,9 @@ curves_button_press (Tool *tool,
GdkEventButton *bevent, GdkEventButton *bevent,
gpointer gdisp_ptr) gpointer gdisp_ptr)
{ {
GDisplay *gdisp;
gint x, y; gint x, y;
GimpDrawable * drawable; GDisplay *gdisp;
GimpDrawable *drawable;
gdisp = gdisp_ptr; gdisp = gdisp_ptr;
drawable = gimage_active_drawable (gdisp->gimage); drawable = gimage_active_drawable (gdisp->gimage);
@ -307,8 +310,8 @@ curves_button_release (Tool *tool,
gpointer gdisp_ptr) gpointer gdisp_ptr)
{ {
gint x, y; gint x, y;
GimpDrawable * drawable; GimpDrawable *drawable;
GDisplay *gdisp; GDisplay *gdisp;
gdisp = (GDisplay *) gdisp_ptr; gdisp = (GDisplay *) gdisp_ptr;
@ -343,9 +346,9 @@ curves_motion (Tool *tool,
GdkEventMotion *mevent, GdkEventMotion *mevent,
gpointer gdisp_ptr) gpointer gdisp_ptr)
{ {
GDisplay *gdisp;
gint x, y; gint x, y;
GimpDrawable * drawable; GDisplay *gdisp;
GimpDrawable *drawable;
gdisp = (GDisplay *) gdisp_ptr; gdisp = (GDisplay *) gdisp_ptr;
@ -384,8 +387,8 @@ curves_control (Tool *tool,
Tool * Tool *
tools_new_curves (void) tools_new_curves (void)
{ {
Tool * tool; Tool *tool;
Curves * private; Curves *private;
/* The tool options */ /* The tool options */
if (!curves_options) if (!curves_options)
@ -420,7 +423,7 @@ curves_dialog_hide (void)
void void
tools_free_curves (Tool *tool) tools_free_curves (Tool *tool)
{ {
Curves * private; Curves *private;
private = (Curves *) tool->private; private = (Curves *) tool->private;
@ -722,10 +725,10 @@ curve_print_loc (CurvesDialog *cd,
gint xpos, gint xpos,
gint ypos) gint ypos)
{ {
char buf[32]; gchar buf[32];
gint width; gint width;
gint ascent; gint ascent;
gint descent; gint descent;
if (cd->cursor_ind_width < 0) if (cd->cursor_ind_width < 0)
{ {
@ -771,12 +774,12 @@ curve_print_loc (CurvesDialog *cd,
/* TODO: preview alpha channel stuff correctly. -- austin, 20/May/99 */ /* TODO: preview alpha channel stuff correctly. -- austin, 20/May/99 */
static void static void
curves_update (CurvesDialog *cd, curves_update (CurvesDialog *cd,
int update) gint update)
{ {
GdkRectangle area; GdkRectangle area;
gint i, j; gint i, j;
gchar buf[32]; gchar buf[32];
gint offset; gint offset;
gint sel_channel; gint sel_channel;
if(cd->color) { if(cd->color) {
@ -1155,7 +1158,7 @@ curves_smooth_callback (GtkWidget *widget,
gpointer data) gpointer data)
{ {
CurvesDialog *cd; CurvesDialog *cd;
int i; gint i;
gint32 index; gint32 index;
cd = (CurvesDialog *) data; cd = (CurvesDialog *) data;
@ -1202,7 +1205,7 @@ curves_free_callback (GtkWidget *widget,
static void static void
curves_channel_reset (int i) curves_channel_reset (int i)
{ {
int j; gint j;
curves_dialog->grab_point = -1; curves_dialog->grab_point = -1;
@ -1223,7 +1226,7 @@ curves_reset_callback (GtkWidget *widget,
gpointer data) gpointer data)
{ {
CurvesDialog *cd; CurvesDialog *cd;
int i; gint i;
cd = (CurvesDialog *) data; cd = (CurvesDialog *) data;
@ -1356,12 +1359,12 @@ curves_graph_events (GtkWidget *widget,
GdkCursorType new_type; GdkCursorType new_type;
GdkEventButton *bevent; GdkEventButton *bevent;
GdkEventMotion *mevent; GdkEventMotion *mevent;
int i; gint i;
int tx, ty; gint tx, ty;
int x, y; gint x, y;
int closest_point; gint closest_point;
int distance; gint distance;
int x1, x2, y1, y2; gint x1, x2, y1, y2;
new_type = GDK_X_CURSOR; new_type = GDK_X_CURSOR;
closest_point = 0; closest_point = 0;
@ -1693,11 +1696,12 @@ file_dialog_cancel_callback (GtkWidget *widget,
static gboolean static gboolean
curves_read_from_file (FILE *f) curves_read_from_file (FILE *f)
{ {
gint i, j, fields; gint i, j;
gint fields;
gchar buf[50]; gchar buf[50];
gint index[5][17]; gint index[5][17];
gint value[5][17]; gint value[5][17];
gint current_channel; gint current_channel;
if (!fgets (buf, 50, f)) if (!fgets (buf, 50, f))
return FALSE; return FALSE;
@ -1750,7 +1754,7 @@ curves_read_from_file (FILE *f)
static void static void
curves_write_to_file (FILE *f) curves_write_to_file (FILE *f)
{ {
int i, j; gint i, j;
gint32 index; gint32 index;
for (i = 0; i < 5; i++) for (i = 0; i < 5; i++)

View File

@ -15,6 +15,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#include "config.h" #include "config.h"
#include "appenv.h" #include "appenv.h"
@ -438,7 +439,7 @@ info_window_update_RGB (GDisplay *gdisp,
sample_type = gimp_image_composite_type (gdisp->gimage); sample_type = gimp_image_composite_type (gdisp->gimage);
if (TYPE_HAS_ALPHA (sample_type)) if (GIMP_IMAGE_TYPE_HAS_ALPHA (sample_type))
{ {
g_snprintf (buff, sizeof (buff), "%d", (gint) color[ALPHA_PIX]); g_snprintf (buff, sizeof (buff), "%d", (gint) color[ALPHA_PIX]);
gtk_label_set_text (GTK_LABEL (iwd->labelAvalue), buff); gtk_label_set_text (GTK_LABEL (iwd->labelAvalue), buff);

View File

@ -433,7 +433,7 @@ gimp_drawable_get_color_at (GimpDrawable *drawable,
gimp_image_get_color (gimp_drawable_gimage (drawable), gimp_image_get_color (gimp_drawable_gimage (drawable),
gimp_drawable_type (drawable), dest, src); gimp_drawable_type (drawable), dest, src);
if (TYPE_HAS_ALPHA (gimp_drawable_type (drawable))) if (GIMP_IMAGE_TYPE_HAS_ALPHA (gimp_drawable_type (drawable)))
dest[3] = src[gimp_drawable_bytes (drawable) - 1]; dest[3] = src[gimp_drawable_bytes (drawable) - 1];
else else
dest[3] = 255; dest[3] = 255;

View File

@ -1362,10 +1362,10 @@ convert_image (GImage *gimage,
/* Push the layer on the undo stack */ /* Push the layer on the undo stack */
undo_push_layer_mod (gimage, layer); undo_push_layer_mod (gimage, layer);
GIMP_DRAWABLE(layer)->tiles = new_tiles; GIMP_DRAWABLE (layer)->tiles = new_tiles;
GIMP_DRAWABLE(layer)->bytes = new_layer_bytes; GIMP_DRAWABLE (layer)->bytes = new_layer_bytes;
GIMP_DRAWABLE(layer)->type = new_layer_type; GIMP_DRAWABLE (layer)->type = new_layer_type;
GIMP_DRAWABLE(layer)->has_alpha = TYPE_HAS_ALPHA(new_layer_type); GIMP_DRAWABLE (layer)->has_alpha = GIMP_IMAGE_TYPE_HAS_ALPHA (new_layer_type);
} }
/* colourmap stuff */ /* colourmap stuff */

View File

@ -960,16 +960,15 @@ gimp_image_get_color_at (GimpImage *gimage,
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL); g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
if (x < 0 || y < 0 || x >= gimage->width || y >= gimage->height) if (x < 0 || y < 0 || x >= gimage->width || y >= gimage->height)
{ return NULL;
return NULL;
}
dest = g_new (unsigned char, 5); dest = g_new (unsigned char, 5);
tile = tile_manager_get_tile (gimp_image_composite (gimage), x, y, tile = tile_manager_get_tile (gimp_image_composite (gimage), x, y,
TRUE, FALSE); TRUE, FALSE);
src = tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT); src = tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT);
gimp_image_get_color (gimage, gimp_image_composite_type (gimage), dest, src); gimp_image_get_color (gimage, gimp_image_composite_type (gimage), dest, src);
if (TYPE_HAS_ALPHA (gimp_image_composite_type (gimage))) if (GIMP_IMAGE_TYPE_HAS_ALPHA (gimp_image_composite_type (gimage)))
dest[3] = src[gimp_image_composite_bytes (gimage) - 1]; dest[3] = src[gimp_image_composite_bytes (gimage) - 1];
else else
dest[3] = 255; dest[3] = 255;
@ -3696,7 +3695,6 @@ gimp_image_construct_composite_preview (GimpImage *gimage,
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL); g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
list = gimage->layers;
ratio = (gdouble) width / (gdouble) gimage->width; ratio = (gdouble) width / (gdouble) gimage->width;
switch (gimp_image_base_type (gimage)) switch (gimp_image_base_type (gimage))
@ -3718,7 +3716,7 @@ gimp_image_construct_composite_preview (GimpImage *gimage,
memset (temp_buf_data (comp), 0, comp->width * comp->height * comp->bytes); memset (temp_buf_data (comp), 0, comp->width * comp->height * comp->bytes);
floating_sel = NULL; floating_sel = NULL;
while (list) for (list = gimage->layers; list; list = g_slist_next (list))
{ {
layer = (Layer *) list->data; layer = (Layer *) list->data;
@ -3738,8 +3736,6 @@ gimp_image_construct_composite_preview (GimpImage *gimage,
reverse_list = g_slist_prepend (reverse_list, layer); reverse_list = g_slist_prepend (reverse_list, layer);
} }
} }
list = g_slist_next (list);
} }
construct_flag = 0; construct_flag = 0;

View File

@ -15,6 +15,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#ifndef __GIMPIMAGE_H__ #ifndef __GIMPIMAGE_H__
#define __GIMPIMAGE_H__ #define __GIMPIMAGE_H__
@ -38,7 +39,7 @@
#define GIMP_IMAGE(obj) GTK_CHECK_CAST (obj, GIMP_TYPE_IMAGE, GimpImage) #define GIMP_IMAGE(obj) GTK_CHECK_CAST (obj, GIMP_TYPE_IMAGE, GimpImage)
#define GIMP_IS_IMAGE(obj) GTK_CHECK_TYPE (obj, GIMP_TYPE_IMAGE) #define GIMP_IS_IMAGE(obj) GTK_CHECK_TYPE (obj, GIMP_TYPE_IMAGE)
#define TYPE_HAS_ALPHA(t) ((t)==RGBA_GIMAGE || (t)==GRAYA_GIMAGE || (t)==INDEXEDA_GIMAGE) #define GIMP_IMAGE_TYPE_HAS_ALPHA(t) ((t)==RGBA_GIMAGE || (t)==GRAYA_GIMAGE || (t)==INDEXEDA_GIMAGE)
#define GRAY_PIX 0 #define GRAY_PIX 0
#define ALPHA_G_PIX 1 #define ALPHA_G_PIX 1
@ -237,27 +238,30 @@ Channel * gimp_image_remove_channel (GimpImage *, Channel *);
void gimp_image_construct (GimpImage *, void gimp_image_construct (GimpImage *,
gint, gint, gint, gint, gint, gint, gint, gint,
gboolean); gboolean);
void gimp_image_invalidate_without_render (GimpImage *, gint, gint, void gimp_image_invalidate_without_render (GimpImage *, gint, gint,
gint, gint, gint, gint, gint, gint,
gint, gint, gint); gint, gint, gint);
void gimp_image_invalidate (GimpImage *, gint, gint, void gimp_image_invalidate (GimpImage *, gint, gint,
gint, gint, gint, gint, gint, gint,
gint, gint, gint); gint, gint, gint);
void gimp_image_validate (TileManager *, Tile *); void gimp_image_validate (TileManager *, Tile *);
/* Access functions */ /* Access functions */
gboolean gimp_image_is_empty (GimpImage *); gboolean gimp_image_is_empty (GimpImage *);
GimpDrawable * gimp_image_active_drawable (GimpImage *); GimpDrawable * gimp_image_active_drawable (GimpImage *);
GimpImageBaseType gimp_image_base_type (GimpImage *);
GimpImageType gimp_image_base_type_with_alpha (GimpImage *); GimpImageBaseType gimp_image_base_type (GimpImage *gimage);
GimpImageType gimp_image_base_type_with_alpha (GimpImage *gimage);
gchar * gimp_image_filename (GimpImage *); gchar * gimp_image_filename (GimpImage *);
gboolean gimp_image_undo_is_enabled (GimpImage *); gboolean gimp_image_undo_is_enabled (GimpImage *);
gboolean gimp_image_undo_enable (GimpImage *); gboolean gimp_image_undo_enable (GimpImage *);
gboolean gimp_image_undo_disable (GimpImage *); gboolean gimp_image_undo_disable (GimpImage *);
gboolean gimp_image_undo_freeze (GimpImage *); gboolean gimp_image_undo_freeze (GimpImage *);
gboolean gimp_image_undo_thaw (GimpImage *); gboolean gimp_image_undo_thaw (GimpImage *);
void gimp_image_undo_event (GimpImage *, int); void gimp_image_undo_event (GimpImage *, gint);
gint gimp_image_dirty (GimpImage *); gint gimp_image_dirty (GimpImage *);
gint gimp_image_clean (GimpImage *); gint gimp_image_clean (GimpImage *);
void gimp_image_clean_all (GimpImage *); void gimp_image_clean_all (GimpImage *);
@ -280,10 +284,12 @@ GimpImageType gimp_image_composite_type (GimpImage *);
gint gimp_image_composite_bytes (GimpImage *); gint gimp_image_composite_bytes (GimpImage *);
TempBuf * gimp_image_composite_preview (GimpImage *, ChannelType, TempBuf * gimp_image_composite_preview (GimpImage *, ChannelType,
gint, gint); gint, gint);
gint gimp_image_preview_valid (GimpImage *, ChannelType); gint gimp_image_preview_valid (GimpImage *, ChannelType);
void gimp_image_invalidate_preview (GimpImage *); void gimp_image_invalidate_preview (GimpImage *);
void gimp_image_invalidate_previews (void); void gimp_image_invalidate_previews (void);
TempBuf * gimp_image_construct_composite_preview (GimpImage *, TempBuf * gimp_image_construct_composite_preview (GimpImage *,
gint , gint); gint , gint);

View File

@ -443,7 +443,7 @@ layer_new_from_tiles (GimpImage *gimage,
return NULL; return NULL;
/* the layer_type needs to have alpha */ /* the layer_type needs to have alpha */
g_return_val_if_fail (TYPE_HAS_ALPHA (layer_type), NULL); g_return_val_if_fail (GIMP_IMAGE_TYPE_HAS_ALPHA (layer_type), NULL);
/* Create the new layer */ /* Create the new layer */
new_layer = layer_new (0, tiles->width, tiles->height, new_layer = layer_new (0, tiles->width, tiles->height,
@ -754,7 +754,7 @@ layer_add_alpha (Layer *layer)
GIMP_DRAWABLE(layer)->tiles = new_tiles; GIMP_DRAWABLE(layer)->tiles = new_tiles;
GIMP_DRAWABLE(layer)->type = type; GIMP_DRAWABLE(layer)->type = type;
GIMP_DRAWABLE(layer)->bytes = GIMP_DRAWABLE(layer)->bytes + 1; GIMP_DRAWABLE(layer)->bytes = GIMP_DRAWABLE(layer)->bytes + 1;
GIMP_DRAWABLE(layer)->has_alpha = TYPE_HAS_ALPHA (type); GIMP_DRAWABLE(layer)->has_alpha = GIMP_IMAGE_TYPE_HAS_ALPHA (type);
GIMP_DRAWABLE(layer)->preview_valid = FALSE; GIMP_DRAWABLE(layer)->preview_valid = FALSE;
gtk_signal_emit_by_name (GTK_OBJECT (gimp_drawable_gimage (GIMP_DRAWABLE (layer))), gtk_signal_emit_by_name (GTK_OBJECT (gimp_drawable_gimage (GIMP_DRAWABLE (layer))),
@ -1277,12 +1277,10 @@ layer_get_mask (Layer *layer)
gboolean gboolean
layer_has_alpha (Layer *layer) layer_has_alpha (Layer *layer)
{ {
if (GIMP_DRAWABLE(layer)->type == RGBA_GIMAGE || g_return_if_fail (layer != NULL);
GIMP_DRAWABLE(layer)->type == GRAYA_GIMAGE || g_return_if_fail (GIMP_IS_LAYER (layer));
GIMP_DRAWABLE(layer)->type == INDEXEDA_GIMAGE)
return TRUE; return GIMP_IMAGE_TYPE_HAS_ALPHA (GIMP_DRAWABLE (layer)->type);
else
return FALSE;
} }
gboolean gboolean

View File

@ -15,6 +15,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#include "config.h" #include "config.h"
#include "appenv.h" #include "appenv.h"
@ -438,7 +439,7 @@ info_window_update_RGB (GDisplay *gdisp,
sample_type = gimp_image_composite_type (gdisp->gimage); sample_type = gimp_image_composite_type (gdisp->gimage);
if (TYPE_HAS_ALPHA (sample_type)) if (GIMP_IMAGE_TYPE_HAS_ALPHA (sample_type))
{ {
g_snprintf (buff, sizeof (buff), "%d", (gint) color[ALPHA_PIX]); g_snprintf (buff, sizeof (buff), "%d", (gint) color[ALPHA_PIX]);
gtk_label_set_text (GTK_LABEL (iwd->labelAvalue), buff); gtk_label_set_text (GTK_LABEL (iwd->labelAvalue), buff);

View File

@ -322,12 +322,12 @@ image_map_get_color_at (ImageMap image_map,
gint x, gint x,
gint y) gint y)
{ {
Tile *tile; Tile *tile;
unsigned char *src; unsigned char *src;
unsigned char *dest; unsigned char *dest;
_ImageMap *_image_map; _ImageMap *_image_map;
if(!image_map) if (!image_map)
return NULL; return NULL;
_image_map = (_ImageMap *) image_map; _image_map = (_ImageMap *) image_map;
@ -359,11 +359,11 @@ image_map_get_color_at (ImageMap image_map,
gimp_image_get_color (gimp_drawable_gimage(_image_map->drawable), gimp_image_get_color (gimp_drawable_gimage(_image_map->drawable),
gimp_drawable_type (_image_map->drawable), dest, src); gimp_drawable_type (_image_map->drawable), dest, src);
if(TYPE_HAS_ALPHA(gimp_drawable_type (_image_map->drawable))) if (GIMP_IMAGE_TYPE_HAS_ALPHA (gimp_drawable_type (_image_map->drawable)))
dest[3] = src[gimp_drawable_bytes (_image_map->drawable) - 1]; dest[3] = src[gimp_drawable_bytes (_image_map->drawable) - 1];
else else
dest[3] = 255; dest[3] = 255;
if (gimp_drawable_is_indexed(_image_map->drawable)) if (gimp_drawable_is_indexed (_image_map->drawable))
dest[4] = src[0]; dest[4] = src[0];
else else
dest[4] = 0; dest[4] = 0;

View File

@ -15,6 +15,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#include "config.h" #include "config.h"
#include "appenv.h" #include "appenv.h"
@ -438,7 +439,7 @@ info_window_update_RGB (GDisplay *gdisp,
sample_type = gimp_image_composite_type (gdisp->gimage); sample_type = gimp_image_composite_type (gdisp->gimage);
if (TYPE_HAS_ALPHA (sample_type)) if (GIMP_IMAGE_TYPE_HAS_ALPHA (sample_type))
{ {
g_snprintf (buff, sizeof (buff), "%d", (gint) color[ALPHA_PIX]); g_snprintf (buff, sizeof (buff), "%d", (gint) color[ALPHA_PIX]);
gtk_label_set_text (GTK_LABEL (iwd->labelAvalue), buff); gtk_label_set_text (GTK_LABEL (iwd->labelAvalue), buff);

View File

@ -443,7 +443,7 @@ layer_new_from_tiles (GimpImage *gimage,
return NULL; return NULL;
/* the layer_type needs to have alpha */ /* the layer_type needs to have alpha */
g_return_val_if_fail (TYPE_HAS_ALPHA (layer_type), NULL); g_return_val_if_fail (GIMP_IMAGE_TYPE_HAS_ALPHA (layer_type), NULL);
/* Create the new layer */ /* Create the new layer */
new_layer = layer_new (0, tiles->width, tiles->height, new_layer = layer_new (0, tiles->width, tiles->height,
@ -754,7 +754,7 @@ layer_add_alpha (Layer *layer)
GIMP_DRAWABLE(layer)->tiles = new_tiles; GIMP_DRAWABLE(layer)->tiles = new_tiles;
GIMP_DRAWABLE(layer)->type = type; GIMP_DRAWABLE(layer)->type = type;
GIMP_DRAWABLE(layer)->bytes = GIMP_DRAWABLE(layer)->bytes + 1; GIMP_DRAWABLE(layer)->bytes = GIMP_DRAWABLE(layer)->bytes + 1;
GIMP_DRAWABLE(layer)->has_alpha = TYPE_HAS_ALPHA (type); GIMP_DRAWABLE(layer)->has_alpha = GIMP_IMAGE_TYPE_HAS_ALPHA (type);
GIMP_DRAWABLE(layer)->preview_valid = FALSE; GIMP_DRAWABLE(layer)->preview_valid = FALSE;
gtk_signal_emit_by_name (GTK_OBJECT (gimp_drawable_gimage (GIMP_DRAWABLE (layer))), gtk_signal_emit_by_name (GTK_OBJECT (gimp_drawable_gimage (GIMP_DRAWABLE (layer))),
@ -1277,12 +1277,10 @@ layer_get_mask (Layer *layer)
gboolean gboolean
layer_has_alpha (Layer *layer) layer_has_alpha (Layer *layer)
{ {
if (GIMP_DRAWABLE(layer)->type == RGBA_GIMAGE || g_return_if_fail (layer != NULL);
GIMP_DRAWABLE(layer)->type == GRAYA_GIMAGE || g_return_if_fail (GIMP_IS_LAYER (layer));
GIMP_DRAWABLE(layer)->type == INDEXEDA_GIMAGE)
return TRUE; return GIMP_IMAGE_TYPE_HAS_ALPHA (GIMP_DRAWABLE (layer)->type);
else
return FALSE;
} }
gboolean gboolean

View File

@ -508,7 +508,7 @@ pick_color_do (GimpImage *gimage,
get_color_obj = GTK_OBJECT (gimage); get_color_obj = GTK_OBJECT (gimage);
} }
has_alpha = TYPE_HAS_ALPHA (sample_type); has_alpha = GIMP_IMAGE_TYPE_HAS_ALPHA (sample_type);
if (!(color = (*get_color_func) (get_color_obj, x, y))) if (!(color = (*get_color_func) (get_color_obj, x, y)))
return FALSE; return FALSE;

View File

@ -135,22 +135,24 @@ static void curves_write_to_file (FILE *f);
/* curves machinery */ /* curves machinery */
float gfloat
curves_lut_func (CurvesDialog *cd, curves_lut_func (CurvesDialog *cd,
gint nchannels, gint nchannels,
gint channel, gint channel,
gfloat value) gfloat value)
{ {
float f; gfloat f;
int index; gint index;
double inten; gdouble inten;
int j; gint j;
if (nchannels == 1) if (nchannels == 1)
j = 0; j = 0;
else else
j = channel + 1; j = channel + 1;
inten = value; inten = value;
/* For color images this runs through the loop with j = channel +1 /* For color images this runs through the loop with j = channel +1
the first time and j = 0 the second time */ the first time and j = 0 the second time */
/* For bw images this runs through the loop with j = 0 the first and /* For bw images this runs through the loop with j = 0 the first and
@ -184,12 +186,13 @@ curves_colour_update (Tool *tool,
gint x, gint x,
gint y) gint y)
{ {
unsigned char *color; guchar *color;
int offx, offy; gint offx;
int has_alpha; gint offy;
int is_indexed; gint maxval;
int sample_type; gboolean has_alpha;
int maxval; gboolean is_indexed;
GimpImageType sample_type;
if(!tool || tool->state != ACTIVE) if(!tool || tool->state != ACTIVE)
return; return;
@ -203,8 +206,8 @@ curves_colour_update (Tool *tool,
return; return;
sample_type = gimp_drawable_type (drawable); sample_type = gimp_drawable_type (drawable);
is_indexed = gimp_drawable_is_indexed (drawable); is_indexed = gimp_drawable_is_indexed (drawable);
has_alpha = TYPE_HAS_ALPHA (sample_type); has_alpha = GIMP_IMAGE_TYPE_HAS_ALPHA (sample_type);
curves_dialog->col_value[HISTOGRAM_RED] = color[RED_PIX]; curves_dialog->col_value[HISTOGRAM_RED] = color[RED_PIX];
curves_dialog->col_value[HISTOGRAM_GREEN] = color[GREEN_PIX]; curves_dialog->col_value[HISTOGRAM_GREEN] = color[GREEN_PIX];
@ -231,10 +234,10 @@ curves_add_point (GimpDrawable *drawable,
gint cchan) gint cchan)
{ {
/* Add point onto the curve */ /* Add point onto the curve */
int closest_point = 0; gint closest_point = 0;
int distance; gint distance;
int curvex; gint curvex;
int i; gint i;
switch (curves_dialog->curve_type[cchan]) switch (curves_dialog->curve_type[cchan])
{ {
@ -271,9 +274,9 @@ curves_button_press (Tool *tool,
GdkEventButton *bevent, GdkEventButton *bevent,
gpointer gdisp_ptr) gpointer gdisp_ptr)
{ {
GDisplay *gdisp;
gint x, y; gint x, y;
GimpDrawable * drawable; GDisplay *gdisp;
GimpDrawable *drawable;
gdisp = gdisp_ptr; gdisp = gdisp_ptr;
drawable = gimage_active_drawable (gdisp->gimage); drawable = gimage_active_drawable (gdisp->gimage);
@ -307,8 +310,8 @@ curves_button_release (Tool *tool,
gpointer gdisp_ptr) gpointer gdisp_ptr)
{ {
gint x, y; gint x, y;
GimpDrawable * drawable; GimpDrawable *drawable;
GDisplay *gdisp; GDisplay *gdisp;
gdisp = (GDisplay *) gdisp_ptr; gdisp = (GDisplay *) gdisp_ptr;
@ -343,9 +346,9 @@ curves_motion (Tool *tool,
GdkEventMotion *mevent, GdkEventMotion *mevent,
gpointer gdisp_ptr) gpointer gdisp_ptr)
{ {
GDisplay *gdisp;
gint x, y; gint x, y;
GimpDrawable * drawable; GDisplay *gdisp;
GimpDrawable *drawable;
gdisp = (GDisplay *) gdisp_ptr; gdisp = (GDisplay *) gdisp_ptr;
@ -384,8 +387,8 @@ curves_control (Tool *tool,
Tool * Tool *
tools_new_curves (void) tools_new_curves (void)
{ {
Tool * tool; Tool *tool;
Curves * private; Curves *private;
/* The tool options */ /* The tool options */
if (!curves_options) if (!curves_options)
@ -420,7 +423,7 @@ curves_dialog_hide (void)
void void
tools_free_curves (Tool *tool) tools_free_curves (Tool *tool)
{ {
Curves * private; Curves *private;
private = (Curves *) tool->private; private = (Curves *) tool->private;
@ -722,10 +725,10 @@ curve_print_loc (CurvesDialog *cd,
gint xpos, gint xpos,
gint ypos) gint ypos)
{ {
char buf[32]; gchar buf[32];
gint width; gint width;
gint ascent; gint ascent;
gint descent; gint descent;
if (cd->cursor_ind_width < 0) if (cd->cursor_ind_width < 0)
{ {
@ -771,12 +774,12 @@ curve_print_loc (CurvesDialog *cd,
/* TODO: preview alpha channel stuff correctly. -- austin, 20/May/99 */ /* TODO: preview alpha channel stuff correctly. -- austin, 20/May/99 */
static void static void
curves_update (CurvesDialog *cd, curves_update (CurvesDialog *cd,
int update) gint update)
{ {
GdkRectangle area; GdkRectangle area;
gint i, j; gint i, j;
gchar buf[32]; gchar buf[32];
gint offset; gint offset;
gint sel_channel; gint sel_channel;
if(cd->color) { if(cd->color) {
@ -1155,7 +1158,7 @@ curves_smooth_callback (GtkWidget *widget,
gpointer data) gpointer data)
{ {
CurvesDialog *cd; CurvesDialog *cd;
int i; gint i;
gint32 index; gint32 index;
cd = (CurvesDialog *) data; cd = (CurvesDialog *) data;
@ -1202,7 +1205,7 @@ curves_free_callback (GtkWidget *widget,
static void static void
curves_channel_reset (int i) curves_channel_reset (int i)
{ {
int j; gint j;
curves_dialog->grab_point = -1; curves_dialog->grab_point = -1;
@ -1223,7 +1226,7 @@ curves_reset_callback (GtkWidget *widget,
gpointer data) gpointer data)
{ {
CurvesDialog *cd; CurvesDialog *cd;
int i; gint i;
cd = (CurvesDialog *) data; cd = (CurvesDialog *) data;
@ -1356,12 +1359,12 @@ curves_graph_events (GtkWidget *widget,
GdkCursorType new_type; GdkCursorType new_type;
GdkEventButton *bevent; GdkEventButton *bevent;
GdkEventMotion *mevent; GdkEventMotion *mevent;
int i; gint i;
int tx, ty; gint tx, ty;
int x, y; gint x, y;
int closest_point; gint closest_point;
int distance; gint distance;
int x1, x2, y1, y2; gint x1, x2, y1, y2;
new_type = GDK_X_CURSOR; new_type = GDK_X_CURSOR;
closest_point = 0; closest_point = 0;
@ -1693,11 +1696,12 @@ file_dialog_cancel_callback (GtkWidget *widget,
static gboolean static gboolean
curves_read_from_file (FILE *f) curves_read_from_file (FILE *f)
{ {
gint i, j, fields; gint i, j;
gint fields;
gchar buf[50]; gchar buf[50];
gint index[5][17]; gint index[5][17];
gint value[5][17]; gint value[5][17];
gint current_channel; gint current_channel;
if (!fgets (buf, 50, f)) if (!fgets (buf, 50, f))
return FALSE; return FALSE;
@ -1750,7 +1754,7 @@ curves_read_from_file (FILE *f)
static void static void
curves_write_to_file (FILE *f) curves_write_to_file (FILE *f)
{ {
int i, j; gint i, j;
gint32 index; gint32 index;
for (i = 0; i < 5; i++) for (i = 0; i < 5; i++)

View File

@ -135,22 +135,24 @@ static void curves_write_to_file (FILE *f);
/* curves machinery */ /* curves machinery */
float gfloat
curves_lut_func (CurvesDialog *cd, curves_lut_func (CurvesDialog *cd,
gint nchannels, gint nchannels,
gint channel, gint channel,
gfloat value) gfloat value)
{ {
float f; gfloat f;
int index; gint index;
double inten; gdouble inten;
int j; gint j;
if (nchannels == 1) if (nchannels == 1)
j = 0; j = 0;
else else
j = channel + 1; j = channel + 1;
inten = value; inten = value;
/* For color images this runs through the loop with j = channel +1 /* For color images this runs through the loop with j = channel +1
the first time and j = 0 the second time */ the first time and j = 0 the second time */
/* For bw images this runs through the loop with j = 0 the first and /* For bw images this runs through the loop with j = 0 the first and
@ -184,12 +186,13 @@ curves_colour_update (Tool *tool,
gint x, gint x,
gint y) gint y)
{ {
unsigned char *color; guchar *color;
int offx, offy; gint offx;
int has_alpha; gint offy;
int is_indexed; gint maxval;
int sample_type; gboolean has_alpha;
int maxval; gboolean is_indexed;
GimpImageType sample_type;
if(!tool || tool->state != ACTIVE) if(!tool || tool->state != ACTIVE)
return; return;
@ -203,8 +206,8 @@ curves_colour_update (Tool *tool,
return; return;
sample_type = gimp_drawable_type (drawable); sample_type = gimp_drawable_type (drawable);
is_indexed = gimp_drawable_is_indexed (drawable); is_indexed = gimp_drawable_is_indexed (drawable);
has_alpha = TYPE_HAS_ALPHA (sample_type); has_alpha = GIMP_IMAGE_TYPE_HAS_ALPHA (sample_type);
curves_dialog->col_value[HISTOGRAM_RED] = color[RED_PIX]; curves_dialog->col_value[HISTOGRAM_RED] = color[RED_PIX];
curves_dialog->col_value[HISTOGRAM_GREEN] = color[GREEN_PIX]; curves_dialog->col_value[HISTOGRAM_GREEN] = color[GREEN_PIX];
@ -231,10 +234,10 @@ curves_add_point (GimpDrawable *drawable,
gint cchan) gint cchan)
{ {
/* Add point onto the curve */ /* Add point onto the curve */
int closest_point = 0; gint closest_point = 0;
int distance; gint distance;
int curvex; gint curvex;
int i; gint i;
switch (curves_dialog->curve_type[cchan]) switch (curves_dialog->curve_type[cchan])
{ {
@ -271,9 +274,9 @@ curves_button_press (Tool *tool,
GdkEventButton *bevent, GdkEventButton *bevent,
gpointer gdisp_ptr) gpointer gdisp_ptr)
{ {
GDisplay *gdisp;
gint x, y; gint x, y;
GimpDrawable * drawable; GDisplay *gdisp;
GimpDrawable *drawable;
gdisp = gdisp_ptr; gdisp = gdisp_ptr;
drawable = gimage_active_drawable (gdisp->gimage); drawable = gimage_active_drawable (gdisp->gimage);
@ -307,8 +310,8 @@ curves_button_release (Tool *tool,
gpointer gdisp_ptr) gpointer gdisp_ptr)
{ {
gint x, y; gint x, y;
GimpDrawable * drawable; GimpDrawable *drawable;
GDisplay *gdisp; GDisplay *gdisp;
gdisp = (GDisplay *) gdisp_ptr; gdisp = (GDisplay *) gdisp_ptr;
@ -343,9 +346,9 @@ curves_motion (Tool *tool,
GdkEventMotion *mevent, GdkEventMotion *mevent,
gpointer gdisp_ptr) gpointer gdisp_ptr)
{ {
GDisplay *gdisp;
gint x, y; gint x, y;
GimpDrawable * drawable; GDisplay *gdisp;
GimpDrawable *drawable;
gdisp = (GDisplay *) gdisp_ptr; gdisp = (GDisplay *) gdisp_ptr;
@ -384,8 +387,8 @@ curves_control (Tool *tool,
Tool * Tool *
tools_new_curves (void) tools_new_curves (void)
{ {
Tool * tool; Tool *tool;
Curves * private; Curves *private;
/* The tool options */ /* The tool options */
if (!curves_options) if (!curves_options)
@ -420,7 +423,7 @@ curves_dialog_hide (void)
void void
tools_free_curves (Tool *tool) tools_free_curves (Tool *tool)
{ {
Curves * private; Curves *private;
private = (Curves *) tool->private; private = (Curves *) tool->private;
@ -722,10 +725,10 @@ curve_print_loc (CurvesDialog *cd,
gint xpos, gint xpos,
gint ypos) gint ypos)
{ {
char buf[32]; gchar buf[32];
gint width; gint width;
gint ascent; gint ascent;
gint descent; gint descent;
if (cd->cursor_ind_width < 0) if (cd->cursor_ind_width < 0)
{ {
@ -771,12 +774,12 @@ curve_print_loc (CurvesDialog *cd,
/* TODO: preview alpha channel stuff correctly. -- austin, 20/May/99 */ /* TODO: preview alpha channel stuff correctly. -- austin, 20/May/99 */
static void static void
curves_update (CurvesDialog *cd, curves_update (CurvesDialog *cd,
int update) gint update)
{ {
GdkRectangle area; GdkRectangle area;
gint i, j; gint i, j;
gchar buf[32]; gchar buf[32];
gint offset; gint offset;
gint sel_channel; gint sel_channel;
if(cd->color) { if(cd->color) {
@ -1155,7 +1158,7 @@ curves_smooth_callback (GtkWidget *widget,
gpointer data) gpointer data)
{ {
CurvesDialog *cd; CurvesDialog *cd;
int i; gint i;
gint32 index; gint32 index;
cd = (CurvesDialog *) data; cd = (CurvesDialog *) data;
@ -1202,7 +1205,7 @@ curves_free_callback (GtkWidget *widget,
static void static void
curves_channel_reset (int i) curves_channel_reset (int i)
{ {
int j; gint j;
curves_dialog->grab_point = -1; curves_dialog->grab_point = -1;
@ -1223,7 +1226,7 @@ curves_reset_callback (GtkWidget *widget,
gpointer data) gpointer data)
{ {
CurvesDialog *cd; CurvesDialog *cd;
int i; gint i;
cd = (CurvesDialog *) data; cd = (CurvesDialog *) data;
@ -1356,12 +1359,12 @@ curves_graph_events (GtkWidget *widget,
GdkCursorType new_type; GdkCursorType new_type;
GdkEventButton *bevent; GdkEventButton *bevent;
GdkEventMotion *mevent; GdkEventMotion *mevent;
int i; gint i;
int tx, ty; gint tx, ty;
int x, y; gint x, y;
int closest_point; gint closest_point;
int distance; gint distance;
int x1, x2, y1, y2; gint x1, x2, y1, y2;
new_type = GDK_X_CURSOR; new_type = GDK_X_CURSOR;
closest_point = 0; closest_point = 0;
@ -1693,11 +1696,12 @@ file_dialog_cancel_callback (GtkWidget *widget,
static gboolean static gboolean
curves_read_from_file (FILE *f) curves_read_from_file (FILE *f)
{ {
gint i, j, fields; gint i, j;
gint fields;
gchar buf[50]; gchar buf[50];
gint index[5][17]; gint index[5][17];
gint value[5][17]; gint value[5][17];
gint current_channel; gint current_channel;
if (!fgets (buf, 50, f)) if (!fgets (buf, 50, f))
return FALSE; return FALSE;
@ -1750,7 +1754,7 @@ curves_read_from_file (FILE *f)
static void static void
curves_write_to_file (FILE *f) curves_write_to_file (FILE *f)
{ {
int i, j; gint i, j;
gint32 index; gint32 index;
for (i = 0; i < 5; i++) for (i = 0; i < 5; i++)

View File

@ -1599,7 +1599,7 @@ undo_pop_layer_mod (GImage *gimage,
GIMP_DRAWABLE (layer)->height = tiles->height; GIMP_DRAWABLE (layer)->height = tiles->height;
GIMP_DRAWABLE (layer)->bytes = tiles->bpp; GIMP_DRAWABLE (layer)->bytes = tiles->bpp;
GIMP_DRAWABLE (layer)->type = layer_type; GIMP_DRAWABLE (layer)->type = layer_type;
GIMP_DRAWABLE (layer)->has_alpha = TYPE_HAS_ALPHA (layer_type); GIMP_DRAWABLE (layer)->has_alpha = GIMP_IMAGE_TYPE_HAS_ALPHA (layer_type);
if (layer->mask) if (layer->mask)
{ {

View File

@ -881,7 +881,7 @@ set_color_table (gint32 image_ID,
for (j = 0; j < ncols; j++) for (j = 0; j < ncols; j++)
{ {
ColorMap[j*3] = suncolmap[j]; ColorMap[j*3] = suncolmap[j];
ColorMap[j*3+1] = suncolmap[j+ncols]; ColorMap[j*3+1] = suncolmap[j+ncols];
ColorMap[j*3+2] = suncolmap[j+2*ncols]; ColorMap[j*3+2] = suncolmap[j+2*ncols];
} }
@ -898,13 +898,13 @@ set_color_table (gint32 image_ID,
/* Create an image. Sets layer_ID, drawable and rgn. Returns image_ID */ /* Create an image. Sets layer_ID, drawable and rgn. Returns image_ID */
static gint32 static gint32
create_new_image (gchar *filename, create_new_image (gchar *filename,
guint width, guint width,
guint height, guint height,
GimpImageBaseType type, GimpImageBaseType type,
gint32 *layer_ID, gint32 *layer_ID,
GimpDrawable **drawable, GimpDrawable **drawable,
GimpPixelRgn *pixel_rgn) GimpPixelRgn *pixel_rgn)
{ {
gint32 image_ID; gint32 image_ID;
GimpImageType gdtype; GimpImageType gdtype;

View File

@ -995,16 +995,15 @@ set_color_table (gint32 image_ID,
/* Create an image. Sets layer_ID, drawable and rgn. Returns image_ID */ /* Create an image. Sets layer_ID, drawable and rgn. Returns image_ID */
static gint32 static gint32
create_new_image (char *filename, create_new_image (char *filename,
guint width, guint width,
guint height, guint height,
GimpImageBaseType type, GimpImageBaseType type,
gint32 *layer_ID, gint32 *layer_ID,
GimpDrawable **drawable, GimpDrawable **drawable,
GimpPixelRgn *pixel_rgn) GimpPixelRgn *pixel_rgn)
{ {
gint32 image_ID; gint32 image_ID;
GimpImageType gdtype; GimpImageType gdtype;
switch (type) switch (type)