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>
* plug-ins/common/spheredesigner.c: Small algo improvements.

View File

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

View File

@ -508,7 +508,7 @@ pick_color_do (GimpImage *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)))
return FALSE;

View File

@ -1365,7 +1365,7 @@ convert_image (GImage *gimage,
GIMP_DRAWABLE (layer)->tiles = new_tiles;
GIMP_DRAWABLE (layer)->bytes = new_layer_bytes;
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 */

View File

@ -433,7 +433,7 @@ gimp_drawable_get_color_at (GimpDrawable *drawable,
gimp_image_get_color (gimp_drawable_gimage (drawable),
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];
else
dest[3] = 255;

View File

@ -1365,7 +1365,7 @@ convert_image (GImage *gimage,
GIMP_DRAWABLE (layer)->tiles = new_tiles;
GIMP_DRAWABLE (layer)->bytes = new_layer_bytes;
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 */

View File

@ -960,16 +960,15 @@ gimp_image_get_color_at (GimpImage *gimage,
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
if (x < 0 || y < 0 || x >= gimage->width || y >= gimage->height)
{
return NULL;
}
dest = g_new (unsigned char, 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);
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];
else
dest[3] = 255;
@ -3696,7 +3695,6 @@ gimp_image_construct_composite_preview (GimpImage *gimage,
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
list = gimage->layers;
ratio = (gdouble) width / (gdouble) gimage->width;
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);
floating_sel = NULL;
while (list)
for (list = gimage->layers; list; list = g_slist_next (list))
{
layer = (Layer *) list->data;
@ -3738,8 +3736,6 @@ gimp_image_construct_composite_preview (GimpImage *gimage,
reverse_list = g_slist_prepend (reverse_list, layer);
}
}
list = g_slist_next (list);
}
construct_flag = 0;

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 __GIMPIMAGE_H__
#define __GIMPIMAGE_H__
@ -38,7 +39,7 @@
#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 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 ALPHA_G_PIX 1
@ -237,6 +238,7 @@ Channel * gimp_image_remove_channel (GimpImage *, Channel *);
void gimp_image_construct (GimpImage *,
gint, gint, gint, gint,
gboolean);
void gimp_image_invalidate_without_render (GimpImage *, gint, gint,
gint, gint, gint,
gint, gint, gint);
@ -249,15 +251,17 @@ void gimp_image_validate (TileManager *, Tile *);
gboolean gimp_image_is_empty (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 *);
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 *, int);
void gimp_image_undo_event (GimpImage *, gint);
gint gimp_image_dirty (GimpImage *);
gint gimp_image_clean (GimpImage *);
void gimp_image_clean_all (GimpImage *);
@ -280,10 +284,12 @@ GimpImageType gimp_image_composite_type (GimpImage *);
gint gimp_image_composite_bytes (GimpImage *);
TempBuf * gimp_image_composite_preview (GimpImage *, ChannelType,
gint, gint);
gint gimp_image_preview_valid (GimpImage *, ChannelType);
void gimp_image_invalidate_preview (GimpImage *);
void gimp_image_invalidate_previews (void);
TempBuf * gimp_image_construct_composite_preview (GimpImage *,
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);
if (x < 0 || y < 0 || x >= gimage->width || y >= gimage->height)
{
return NULL;
}
dest = g_new (unsigned char, 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);
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];
else
dest[3] = 255;
@ -3696,7 +3695,6 @@ gimp_image_construct_composite_preview (GimpImage *gimage,
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
list = gimage->layers;
ratio = (gdouble) width / (gdouble) gimage->width;
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);
floating_sel = NULL;
while (list)
for (list = gimage->layers; list; list = g_slist_next (list))
{
layer = (Layer *) list->data;
@ -3738,8 +3736,6 @@ gimp_image_construct_composite_preview (GimpImage *gimage,
reverse_list = g_slist_prepend (reverse_list, layer);
}
}
list = g_slist_next (list);
}
construct_flag = 0;

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 __GIMPIMAGE_H__
#define __GIMPIMAGE_H__
@ -38,7 +39,7 @@
#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 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 ALPHA_G_PIX 1
@ -237,6 +238,7 @@ Channel * gimp_image_remove_channel (GimpImage *, Channel *);
void gimp_image_construct (GimpImage *,
gint, gint, gint, gint,
gboolean);
void gimp_image_invalidate_without_render (GimpImage *, gint, gint,
gint, gint, gint,
gint, gint, gint);
@ -249,15 +251,17 @@ void gimp_image_validate (TileManager *, Tile *);
gboolean gimp_image_is_empty (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 *);
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 *, int);
void gimp_image_undo_event (GimpImage *, gint);
gint gimp_image_dirty (GimpImage *);
gint gimp_image_clean (GimpImage *);
void gimp_image_clean_all (GimpImage *);
@ -280,10 +284,12 @@ GimpImageType gimp_image_composite_type (GimpImage *);
gint gimp_image_composite_bytes (GimpImage *);
TempBuf * gimp_image_composite_preview (GimpImage *, ChannelType,
gint, gint);
gint gimp_image_preview_valid (GimpImage *, ChannelType);
void gimp_image_invalidate_preview (GimpImage *);
void gimp_image_invalidate_previews (void);
TempBuf * gimp_image_construct_composite_preview (GimpImage *,
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);
if (x < 0 || y < 0 || x >= gimage->width || y >= gimage->height)
{
return NULL;
}
dest = g_new (unsigned char, 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);
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];
else
dest[3] = 255;
@ -3696,7 +3695,6 @@ gimp_image_construct_composite_preview (GimpImage *gimage,
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
list = gimage->layers;
ratio = (gdouble) width / (gdouble) gimage->width;
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);
floating_sel = NULL;
while (list)
for (list = gimage->layers; list; list = g_slist_next (list))
{
layer = (Layer *) list->data;
@ -3738,8 +3736,6 @@ gimp_image_construct_composite_preview (GimpImage *gimage,
reverse_list = g_slist_prepend (reverse_list, layer);
}
}
list = g_slist_next (list);
}
construct_flag = 0;

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 __GIMPIMAGE_H__
#define __GIMPIMAGE_H__
@ -38,7 +39,7 @@
#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 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 ALPHA_G_PIX 1
@ -237,6 +238,7 @@ Channel * gimp_image_remove_channel (GimpImage *, Channel *);
void gimp_image_construct (GimpImage *,
gint, gint, gint, gint,
gboolean);
void gimp_image_invalidate_without_render (GimpImage *, gint, gint,
gint, gint, gint,
gint, gint, gint);
@ -249,15 +251,17 @@ void gimp_image_validate (TileManager *, Tile *);
gboolean gimp_image_is_empty (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 *);
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 *, int);
void gimp_image_undo_event (GimpImage *, gint);
gint gimp_image_dirty (GimpImage *);
gint gimp_image_clean (GimpImage *);
void gimp_image_clean_all (GimpImage *);
@ -280,10 +284,12 @@ GimpImageType gimp_image_composite_type (GimpImage *);
gint gimp_image_composite_bytes (GimpImage *);
TempBuf * gimp_image_composite_preview (GimpImage *, ChannelType,
gint, gint);
gint gimp_image_preview_valid (GimpImage *, ChannelType);
void gimp_image_invalidate_preview (GimpImage *);
void gimp_image_invalidate_previews (void);
TempBuf * gimp_image_construct_composite_preview (GimpImage *,
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);
if (x < 0 || y < 0 || x >= gimage->width || y >= gimage->height)
{
return NULL;
}
dest = g_new (unsigned char, 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);
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];
else
dest[3] = 255;
@ -3696,7 +3695,6 @@ gimp_image_construct_composite_preview (GimpImage *gimage,
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
list = gimage->layers;
ratio = (gdouble) width / (gdouble) gimage->width;
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);
floating_sel = NULL;
while (list)
for (list = gimage->layers; list; list = g_slist_next (list))
{
layer = (Layer *) list->data;
@ -3738,8 +3736,6 @@ gimp_image_construct_composite_preview (GimpImage *gimage,
reverse_list = g_slist_prepend (reverse_list, layer);
}
}
list = g_slist_next (list);
}
construct_flag = 0;

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 __GIMPIMAGE_H__
#define __GIMPIMAGE_H__
@ -38,7 +39,7 @@
#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 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 ALPHA_G_PIX 1
@ -237,6 +238,7 @@ Channel * gimp_image_remove_channel (GimpImage *, Channel *);
void gimp_image_construct (GimpImage *,
gint, gint, gint, gint,
gboolean);
void gimp_image_invalidate_without_render (GimpImage *, gint, gint,
gint, gint, gint,
gint, gint, gint);
@ -249,15 +251,17 @@ void gimp_image_validate (TileManager *, Tile *);
gboolean gimp_image_is_empty (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 *);
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 *, int);
void gimp_image_undo_event (GimpImage *, gint);
gint gimp_image_dirty (GimpImage *);
gint gimp_image_clean (GimpImage *);
void gimp_image_clean_all (GimpImage *);
@ -280,10 +284,12 @@ GimpImageType gimp_image_composite_type (GimpImage *);
gint gimp_image_composite_bytes (GimpImage *);
TempBuf * gimp_image_composite_preview (GimpImage *, ChannelType,
gint, gint);
gint gimp_image_preview_valid (GimpImage *, ChannelType);
void gimp_image_invalidate_preview (GimpImage *);
void gimp_image_invalidate_previews (void);
TempBuf * gimp_image_construct_composite_preview (GimpImage *,
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);
if (x < 0 || y < 0 || x >= gimage->width || y >= gimage->height)
{
return NULL;
}
dest = g_new (unsigned char, 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);
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];
else
dest[3] = 255;
@ -3696,7 +3695,6 @@ gimp_image_construct_composite_preview (GimpImage *gimage,
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
list = gimage->layers;
ratio = (gdouble) width / (gdouble) gimage->width;
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);
floating_sel = NULL;
while (list)
for (list = gimage->layers; list; list = g_slist_next (list))
{
layer = (Layer *) list->data;
@ -3738,8 +3736,6 @@ gimp_image_construct_composite_preview (GimpImage *gimage,
reverse_list = g_slist_prepend (reverse_list, layer);
}
}
list = g_slist_next (list);
}
construct_flag = 0;

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 __GIMPIMAGE_H__
#define __GIMPIMAGE_H__
@ -38,7 +39,7 @@
#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 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 ALPHA_G_PIX 1
@ -237,6 +238,7 @@ Channel * gimp_image_remove_channel (GimpImage *, Channel *);
void gimp_image_construct (GimpImage *,
gint, gint, gint, gint,
gboolean);
void gimp_image_invalidate_without_render (GimpImage *, gint, gint,
gint, gint, gint,
gint, gint, gint);
@ -249,15 +251,17 @@ void gimp_image_validate (TileManager *, Tile *);
gboolean gimp_image_is_empty (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 *);
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 *, int);
void gimp_image_undo_event (GimpImage *, gint);
gint gimp_image_dirty (GimpImage *);
gint gimp_image_clean (GimpImage *);
void gimp_image_clean_all (GimpImage *);
@ -280,10 +284,12 @@ GimpImageType gimp_image_composite_type (GimpImage *);
gint gimp_image_composite_bytes (GimpImage *);
TempBuf * gimp_image_composite_preview (GimpImage *, ChannelType,
gint, gint);
gint gimp_image_preview_valid (GimpImage *, ChannelType);
void gimp_image_invalidate_preview (GimpImage *);
void gimp_image_invalidate_previews (void);
TempBuf * gimp_image_construct_composite_preview (GimpImage *,
gint , gint);

View File

@ -1599,7 +1599,7 @@ undo_pop_layer_mod (GImage *gimage,
GIMP_DRAWABLE (layer)->height = tiles->height;
GIMP_DRAWABLE (layer)->bytes = tiles->bpp;
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)
{

View File

@ -960,16 +960,15 @@ gimp_image_get_color_at (GimpImage *gimage,
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
if (x < 0 || y < 0 || x >= gimage->width || y >= gimage->height)
{
return NULL;
}
dest = g_new (unsigned char, 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);
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];
else
dest[3] = 255;
@ -3696,7 +3695,6 @@ gimp_image_construct_composite_preview (GimpImage *gimage,
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
list = gimage->layers;
ratio = (gdouble) width / (gdouble) gimage->width;
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);
floating_sel = NULL;
while (list)
for (list = gimage->layers; list; list = g_slist_next (list))
{
layer = (Layer *) list->data;
@ -3738,8 +3736,6 @@ gimp_image_construct_composite_preview (GimpImage *gimage,
reverse_list = g_slist_prepend (reverse_list, layer);
}
}
list = g_slist_next (list);
}
construct_flag = 0;

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 __GIMPIMAGE_H__
#define __GIMPIMAGE_H__
@ -38,7 +39,7 @@
#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 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 ALPHA_G_PIX 1
@ -237,6 +238,7 @@ Channel * gimp_image_remove_channel (GimpImage *, Channel *);
void gimp_image_construct (GimpImage *,
gint, gint, gint, gint,
gboolean);
void gimp_image_invalidate_without_render (GimpImage *, gint, gint,
gint, gint, gint,
gint, gint, gint);
@ -249,15 +251,17 @@ void gimp_image_validate (TileManager *, Tile *);
gboolean gimp_image_is_empty (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 *);
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 *, int);
void gimp_image_undo_event (GimpImage *, gint);
gint gimp_image_dirty (GimpImage *);
gint gimp_image_clean (GimpImage *);
void gimp_image_clean_all (GimpImage *);
@ -280,10 +284,12 @@ GimpImageType gimp_image_composite_type (GimpImage *);
gint gimp_image_composite_bytes (GimpImage *);
TempBuf * gimp_image_composite_preview (GimpImage *, ChannelType,
gint, gint);
gint gimp_image_preview_valid (GimpImage *, ChannelType);
void gimp_image_invalidate_preview (GimpImage *);
void gimp_image_invalidate_previews (void);
TempBuf * gimp_image_construct_composite_preview (GimpImage *,
gint , gint);

View File

@ -359,7 +359,7 @@ image_map_get_color_at (ImageMap image_map,
gimp_image_get_color (gimp_drawable_gimage(_image_map->drawable),
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];
else
dest[3] = 255;

View File

@ -443,7 +443,7 @@ layer_new_from_tiles (GimpImage *gimage,
return NULL;
/* 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 */
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)->type = type;
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;
gtk_signal_emit_by_name (GTK_OBJECT (gimp_drawable_gimage (GIMP_DRAWABLE (layer))),
@ -1277,12 +1277,10 @@ layer_get_mask (Layer *layer)
gboolean
layer_has_alpha (Layer *layer)
{
if (GIMP_DRAWABLE(layer)->type == RGBA_GIMAGE ||
GIMP_DRAWABLE(layer)->type == GRAYA_GIMAGE ||
GIMP_DRAWABLE(layer)->type == INDEXEDA_GIMAGE)
return TRUE;
else
return FALSE;
g_return_if_fail (layer != NULL);
g_return_if_fail (GIMP_IS_LAYER (layer));
return GIMP_IMAGE_TYPE_HAS_ALPHA (GIMP_DRAWABLE (layer)->type);
}
gboolean

View File

@ -960,16 +960,15 @@ gimp_image_get_color_at (GimpImage *gimage,
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
if (x < 0 || y < 0 || x >= gimage->width || y >= gimage->height)
{
return NULL;
}
dest = g_new (unsigned char, 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);
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];
else
dest[3] = 255;
@ -3696,7 +3695,6 @@ gimp_image_construct_composite_preview (GimpImage *gimage,
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
list = gimage->layers;
ratio = (gdouble) width / (gdouble) gimage->width;
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);
floating_sel = NULL;
while (list)
for (list = gimage->layers; list; list = g_slist_next (list))
{
layer = (Layer *) list->data;
@ -3738,8 +3736,6 @@ gimp_image_construct_composite_preview (GimpImage *gimage,
reverse_list = g_slist_prepend (reverse_list, layer);
}
}
list = g_slist_next (list);
}
construct_flag = 0;

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 __GIMPIMAGE_H__
#define __GIMPIMAGE_H__
@ -38,7 +39,7 @@
#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 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 ALPHA_G_PIX 1
@ -237,6 +238,7 @@ Channel * gimp_image_remove_channel (GimpImage *, Channel *);
void gimp_image_construct (GimpImage *,
gint, gint, gint, gint,
gboolean);
void gimp_image_invalidate_without_render (GimpImage *, gint, gint,
gint, gint, gint,
gint, gint, gint);
@ -249,15 +251,17 @@ void gimp_image_validate (TileManager *, Tile *);
gboolean gimp_image_is_empty (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 *);
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 *, int);
void gimp_image_undo_event (GimpImage *, gint);
gint gimp_image_dirty (GimpImage *);
gint gimp_image_clean (GimpImage *);
void gimp_image_clean_all (GimpImage *);
@ -280,10 +284,12 @@ GimpImageType gimp_image_composite_type (GimpImage *);
gint gimp_image_composite_bytes (GimpImage *);
TempBuf * gimp_image_composite_preview (GimpImage *, ChannelType,
gint, gint);
gint gimp_image_preview_valid (GimpImage *, ChannelType);
void gimp_image_invalidate_preview (GimpImage *);
void gimp_image_invalidate_previews (void);
TempBuf * gimp_image_construct_composite_preview (GimpImage *,
gint , gint);

View File

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

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.
*/
#include "config.h"
#include "appenv.h"
@ -438,7 +439,7 @@ info_window_update_RGB (GDisplay *gdisp,
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]);
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_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];
else
dest[3] = 255;

View File

@ -1365,7 +1365,7 @@ convert_image (GImage *gimage,
GIMP_DRAWABLE (layer)->tiles = new_tiles;
GIMP_DRAWABLE (layer)->bytes = new_layer_bytes;
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 */

View File

@ -960,16 +960,15 @@ gimp_image_get_color_at (GimpImage *gimage,
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
if (x < 0 || y < 0 || x >= gimage->width || y >= gimage->height)
{
return NULL;
}
dest = g_new (unsigned char, 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);
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];
else
dest[3] = 255;
@ -3696,7 +3695,6 @@ gimp_image_construct_composite_preview (GimpImage *gimage,
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
list = gimage->layers;
ratio = (gdouble) width / (gdouble) gimage->width;
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);
floating_sel = NULL;
while (list)
for (list = gimage->layers; list; list = g_slist_next (list))
{
layer = (Layer *) list->data;
@ -3738,8 +3736,6 @@ gimp_image_construct_composite_preview (GimpImage *gimage,
reverse_list = g_slist_prepend (reverse_list, layer);
}
}
list = g_slist_next (list);
}
construct_flag = 0;

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 __GIMPIMAGE_H__
#define __GIMPIMAGE_H__
@ -38,7 +39,7 @@
#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 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 ALPHA_G_PIX 1
@ -237,6 +238,7 @@ Channel * gimp_image_remove_channel (GimpImage *, Channel *);
void gimp_image_construct (GimpImage *,
gint, gint, gint, gint,
gboolean);
void gimp_image_invalidate_without_render (GimpImage *, gint, gint,
gint, gint, gint,
gint, gint, gint);
@ -249,15 +251,17 @@ void gimp_image_validate (TileManager *, Tile *);
gboolean gimp_image_is_empty (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 *);
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 *, int);
void gimp_image_undo_event (GimpImage *, gint);
gint gimp_image_dirty (GimpImage *);
gint gimp_image_clean (GimpImage *);
void gimp_image_clean_all (GimpImage *);
@ -280,10 +284,12 @@ GimpImageType gimp_image_composite_type (GimpImage *);
gint gimp_image_composite_bytes (GimpImage *);
TempBuf * gimp_image_composite_preview (GimpImage *, ChannelType,
gint, gint);
gint gimp_image_preview_valid (GimpImage *, ChannelType);
void gimp_image_invalidate_preview (GimpImage *);
void gimp_image_invalidate_previews (void);
TempBuf * gimp_image_construct_composite_preview (GimpImage *,
gint , gint);

View File

@ -443,7 +443,7 @@ layer_new_from_tiles (GimpImage *gimage,
return NULL;
/* 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 */
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)->type = type;
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;
gtk_signal_emit_by_name (GTK_OBJECT (gimp_drawable_gimage (GIMP_DRAWABLE (layer))),
@ -1277,12 +1277,10 @@ layer_get_mask (Layer *layer)
gboolean
layer_has_alpha (Layer *layer)
{
if (GIMP_DRAWABLE(layer)->type == RGBA_GIMAGE ||
GIMP_DRAWABLE(layer)->type == GRAYA_GIMAGE ||
GIMP_DRAWABLE(layer)->type == INDEXEDA_GIMAGE)
return TRUE;
else
return FALSE;
g_return_if_fail (layer != NULL);
g_return_if_fail (GIMP_IS_LAYER (layer));
return GIMP_IMAGE_TYPE_HAS_ALPHA (GIMP_DRAWABLE (layer)->type);
}
gboolean

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.
*/
#include "config.h"
#include "appenv.h"
@ -438,7 +439,7 @@ info_window_update_RGB (GDisplay *gdisp,
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]);
gtk_label_set_text (GTK_LABEL (iwd->labelAvalue), buff);

View File

@ -359,7 +359,7 @@ image_map_get_color_at (ImageMap image_map,
gimp_image_get_color (gimp_drawable_gimage(_image_map->drawable),
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];
else
dest[3] = 255;

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.
*/
#include "config.h"
#include "appenv.h"
@ -438,7 +439,7 @@ info_window_update_RGB (GDisplay *gdisp,
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]);
gtk_label_set_text (GTK_LABEL (iwd->labelAvalue), buff);

View File

@ -443,7 +443,7 @@ layer_new_from_tiles (GimpImage *gimage,
return NULL;
/* 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 */
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)->type = type;
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;
gtk_signal_emit_by_name (GTK_OBJECT (gimp_drawable_gimage (GIMP_DRAWABLE (layer))),
@ -1277,12 +1277,10 @@ layer_get_mask (Layer *layer)
gboolean
layer_has_alpha (Layer *layer)
{
if (GIMP_DRAWABLE(layer)->type == RGBA_GIMAGE ||
GIMP_DRAWABLE(layer)->type == GRAYA_GIMAGE ||
GIMP_DRAWABLE(layer)->type == INDEXEDA_GIMAGE)
return TRUE;
else
return FALSE;
g_return_if_fail (layer != NULL);
g_return_if_fail (GIMP_IS_LAYER (layer));
return GIMP_IMAGE_TYPE_HAS_ALPHA (GIMP_DRAWABLE (layer)->type);
}
gboolean

View File

@ -508,7 +508,7 @@ pick_color_do (GimpImage *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)))
return FALSE;

View File

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

View File

@ -135,22 +135,24 @@ static void curves_write_to_file (FILE *f);
/* curves machinery */
float
gfloat
curves_lut_func (CurvesDialog *cd,
gint nchannels,
gint channel,
gfloat value)
{
float f;
int index;
double inten;
int j;
gfloat f;
gint index;
gdouble inten;
gint j;
if (nchannels == 1)
j = 0;
else
j = channel + 1;
inten = value;
/* For color images this runs through the loop with j = channel +1
the first time and j = 0 the second time */
/* 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 y)
{
unsigned char *color;
int offx, offy;
int has_alpha;
int is_indexed;
int sample_type;
int maxval;
guchar *color;
gint offx;
gint offy;
gint maxval;
gboolean has_alpha;
gboolean is_indexed;
GimpImageType sample_type;
if(!tool || tool->state != ACTIVE)
return;
@ -204,7 +207,7 @@ curves_colour_update (Tool *tool,
sample_type = gimp_drawable_type (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_GREEN] = color[GREEN_PIX];
@ -231,10 +234,10 @@ curves_add_point (GimpDrawable *drawable,
gint cchan)
{
/* Add point onto the curve */
int closest_point = 0;
int distance;
int curvex;
int i;
gint closest_point = 0;
gint distance;
gint curvex;
gint i;
switch (curves_dialog->curve_type[cchan])
{
@ -271,8 +274,8 @@ curves_button_press (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
{
GDisplay *gdisp;
gint x, y;
GDisplay *gdisp;
GimpDrawable *drawable;
gdisp = gdisp_ptr;
@ -343,8 +346,8 @@ curves_motion (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
GDisplay *gdisp;
gint x, y;
GDisplay *gdisp;
GimpDrawable *drawable;
gdisp = (GDisplay *) gdisp_ptr;
@ -722,7 +725,7 @@ curve_print_loc (CurvesDialog *cd,
gint xpos,
gint ypos)
{
char buf[32];
gchar buf[32];
gint width;
gint ascent;
gint descent;
@ -771,7 +774,7 @@ curve_print_loc (CurvesDialog *cd,
/* TODO: preview alpha channel stuff correctly. -- austin, 20/May/99 */
static void
curves_update (CurvesDialog *cd,
int update)
gint update)
{
GdkRectangle area;
gint i, j;
@ -1155,7 +1158,7 @@ curves_smooth_callback (GtkWidget *widget,
gpointer data)
{
CurvesDialog *cd;
int i;
gint i;
gint32 index;
cd = (CurvesDialog *) data;
@ -1202,7 +1205,7 @@ curves_free_callback (GtkWidget *widget,
static void
curves_channel_reset (int i)
{
int j;
gint j;
curves_dialog->grab_point = -1;
@ -1223,7 +1226,7 @@ curves_reset_callback (GtkWidget *widget,
gpointer data)
{
CurvesDialog *cd;
int i;
gint i;
cd = (CurvesDialog *) data;
@ -1356,12 +1359,12 @@ curves_graph_events (GtkWidget *widget,
GdkCursorType new_type;
GdkEventButton *bevent;
GdkEventMotion *mevent;
int i;
int tx, ty;
int x, y;
int closest_point;
int distance;
int x1, x2, y1, y2;
gint i;
gint tx, ty;
gint x, y;
gint closest_point;
gint distance;
gint x1, x2, y1, y2;
new_type = GDK_X_CURSOR;
closest_point = 0;
@ -1693,7 +1696,8 @@ file_dialog_cancel_callback (GtkWidget *widget,
static gboolean
curves_read_from_file (FILE *f)
{
gint i, j, fields;
gint i, j;
gint fields;
gchar buf[50];
gint index[5][17];
gint value[5][17];
@ -1750,7 +1754,7 @@ curves_read_from_file (FILE *f)
static void
curves_write_to_file (FILE *f)
{
int i, j;
gint i, j;
gint32 index;
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)->bytes = tiles->bpp;
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)
{

View File

@ -1002,7 +1002,6 @@ create_new_image (char *filename,
gint32 *layer_ID,
GimpDrawable **drawable,
GimpPixelRgn *pixel_rgn)
{
gint32 image_ID;
GimpImageType gdtype;