Commit 77718ca7 authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

added function gimp_rgb_intensity_uchar()

2001-01-15  Sven Neumann  <sven@gimp.org>

	* libgimp/gimpcolor.[ch]: added function gimp_rgb_intensity_uchar()

	* libgimp/gimpcolorbutton.c
	* plug-ins/common/apply_lens.c
	* plug-ins/common/blinds.c
	* plug-ins/common/borderaverage.c
	* plug-ins/common/checkerboard.c
	* plug-ins/common/cubism.c
	* plug-ins/common/gif.c
	* plug-ins/common/grid.c
	* plug-ins/common/mblur.c
	* plug-ins/common/papertile.c
	* plug-ins/common/png.c
	* plug-ins/common/polar.c
	* plug-ins/common/semiflatten.c
	* plug-ins/common/sparkle.c
	* plug-ins/common/vpropagate.c
	* plug-ins/common/warp.c
	* plug-ins/common/whirlpinch.c
	* plug-ins/gap/gap_mov_dialog.c
	* plug-ins/gdyntext/gdyntext.c
	* plug-ins/gfig/gfig.c
	* plug-ins/ifscompose/ifscompose.c
	* plug-ins/maze/handy.c
	* plug-ins/mosaic/mosaic.c
	* plug-ins/pagecurl/pagecurl.c: replaced all occurences of
	gimp_palette_[get|set]_[back|fore]ground() with the respective
	gimp_palette_[get|set]_[back|fore]ground_rgb() functions.
parent 84bb0a5a
2001-01-15 Sven Neumann <sven@gimp.org>
* libgimp/gimpcolor.[ch]: added function gimp_rgb_intensity_uchar()
* libgimp/gimpcolorbutton.c
* plug-ins/common/apply_lens.c
* plug-ins/common/blinds.c
* plug-ins/common/borderaverage.c
* plug-ins/common/checkerboard.c
* plug-ins/common/cubism.c
* plug-ins/common/gif.c
* plug-ins/common/grid.c
* plug-ins/common/mblur.c
* plug-ins/common/papertile.c
* plug-ins/common/png.c
* plug-ins/common/polar.c
* plug-ins/common/semiflatten.c
* plug-ins/common/sparkle.c
* plug-ins/common/vpropagate.c
* plug-ins/common/warp.c
* plug-ins/common/whirlpinch.c
* plug-ins/gap/gap_mov_dialog.c
* plug-ins/gdyntext/gdyntext.c
* plug-ins/gfig/gfig.c
* plug-ins/ifscompose/ifscompose.c
* plug-ins/maze/handy.c
* plug-ins/mosaic/mosaic.c
* plug-ins/pagecurl/pagecurl.c: replaced all occurences of
gimp_palette_[get|set]_[back|fore]ground() with the respective
gimp_palette_[get|set]_[back|fore]ground_rgb() functions.
2001-01-14 Simon Budig <simon@gimp.org>
* app/tools.c:
......
......@@ -76,9 +76,9 @@ gimp_rgb_get_uchar (const GimpRGB *rgb,
{
g_return_if_fail (rgb != NULL);
if (r) *r = rgb->r * 255.999;
if (g) *g = rgb->g * 255.999;
if (b) *b = rgb->b * 255.999;
if (r) *r = CLAMP (rgb->r, 0.0, 1.0) * 255.999;
if (g) *g = CLAMP (rgb->g, 0.0, 1.0) * 255.999;
if (b) *b = CLAMP (rgb->b, 0.0, 1.0) * 255.999;
}
void
......@@ -183,6 +183,14 @@ gimp_rgb_intensity (const GimpRGB *rgb)
INTENSITY_BLUE * rgb->b);
}
guchar
gimp_rgb_intensity_uchar (const GimpRGB *rgb)
{
g_return_val_if_fail (rgb != NULL, 0);
return (CLAMP (gimp_rgb_intensity (rgb) * 255.999, 0.0, 1.0));
}
void
gimp_rgb_composite (GimpRGB *color1,
const GimpRGB *color2,
......@@ -259,10 +267,10 @@ gimp_rgba_get_uchar (const GimpRGB *rgba,
{
g_return_if_fail (rgba != NULL);
if (r) *r = rgba->r * 255.999;
if (g) *g = rgba->g * 255.999;
if (b) *b = rgba->b * 255.999;
if (a) *a = rgba->a * 255.999;
if (r) *r = CLAMP (rgba->r, 0.0, 1.0) * 255.999;
if (g) *g = CLAMP (rgba->g, 0.0, 1.0) * 255.999;
if (b) *b = CLAMP (rgba->b, 0.0, 1.0) * 255.999;
if (a) *a = CLAMP (rgba->a, 0.0, 1.0) * 255.999;
}
void
......
......@@ -79,7 +79,8 @@ gdouble gimp_rgb_min (const GimpRGB *rgb);
void gimp_rgb_clamp (GimpRGB *rgb);
void gimp_rgb_gamma (GimpRGB *rgb,
gdouble gamma);
gdouble gimp_rgb_intensity (const GimpRGB *rgb);
gdouble gimp_rgb_intensity (const GimpRGB *rgb);
guchar gimp_rgb_intensity_uchar (const GimpRGB *rgb);
void gimp_rgb_composite (GimpRGB *color1,
const GimpRGB *color2,
......
......@@ -226,7 +226,8 @@ gimp_color_button_new (const gchar *title,
gtk_item_factory_set_translate_func (gcb->item_factory,
gimp_color_button_menu_translate,
NULL, NULL);
gtk_item_factory_create_items (gcb->item_factory, nmenu_items, menu_items, gcb);
gtk_item_factory_create_items (gcb->item_factory,
nmenu_items, menu_items, gcb);
gtk_signal_connect (GTK_OBJECT (gcb), "button_press_event",
GTK_SIGNAL_FUNC (gimp_color_button_menu_popup),
gcb);
......@@ -411,18 +412,12 @@ gimp_color_button_use_fg (gpointer callback_data,
GtkWidget *widget)
{
GimpRGB color;
guchar fg_color[3];
g_return_if_fail (callback_data != NULL);
g_return_if_fail (GIMP_IS_COLOR_BUTTON (callback_data));
gimp_palette_get_foreground (&fg_color[0], &fg_color[1], &fg_color[2]);
gimp_color_button_get_color (GIMP_COLOR_BUTTON (callback_data), &color);
gimp_rgb_set (&color,
fg_color[0] / 255.0,
fg_color[1] / 255.0,
fg_color[2] / 255.0);
gimp_palette_get_foreground_rgb (&color);
gimp_color_button_set_color (GIMP_COLOR_BUTTON (callback_data), &color);
}
......@@ -432,19 +427,12 @@ gimp_color_button_use_bg (gpointer callback_data,
GtkWidget *widget)
{
GimpRGB color;
guchar bg_color[3];
g_return_if_fail (callback_data != NULL);
g_return_if_fail (GIMP_IS_COLOR_BUTTON (callback_data));
gimp_palette_get_background (&bg_color[0], &bg_color[1], &bg_color[2]);
gimp_color_button_get_color (GIMP_COLOR_BUTTON (callback_data), &color);
gimp_rgb_set (&color,
bg_color[0] / 255.0,
bg_color[1] / 255.0,
bg_color[2] / 255.0);
gimp_palette_get_background_rgb (&color);
gimp_color_button_set_color (GIMP_COLOR_BUTTON (callback_data), &color);
}
......
......@@ -226,7 +226,8 @@ gimp_color_button_new (const gchar *title,
gtk_item_factory_set_translate_func (gcb->item_factory,
gimp_color_button_menu_translate,
NULL, NULL);
gtk_item_factory_create_items (gcb->item_factory, nmenu_items, menu_items, gcb);
gtk_item_factory_create_items (gcb->item_factory,
nmenu_items, menu_items, gcb);
gtk_signal_connect (GTK_OBJECT (gcb), "button_press_event",
GTK_SIGNAL_FUNC (gimp_color_button_menu_popup),
gcb);
......@@ -411,18 +412,12 @@ gimp_color_button_use_fg (gpointer callback_data,
GtkWidget *widget)
{
GimpRGB color;
guchar fg_color[3];
g_return_if_fail (callback_data != NULL);
g_return_if_fail (GIMP_IS_COLOR_BUTTON (callback_data));
gimp_palette_get_foreground (&fg_color[0], &fg_color[1], &fg_color[2]);
gimp_color_button_get_color (GIMP_COLOR_BUTTON (callback_data), &color);
gimp_rgb_set (&color,
fg_color[0] / 255.0,
fg_color[1] / 255.0,
fg_color[2] / 255.0);
gimp_palette_get_foreground_rgb (&color);
gimp_color_button_set_color (GIMP_COLOR_BUTTON (callback_data), &color);
}
......@@ -432,19 +427,12 @@ gimp_color_button_use_bg (gpointer callback_data,
GtkWidget *widget)
{
GimpRGB color;
guchar bg_color[3];
g_return_if_fail (callback_data != NULL);
g_return_if_fail (GIMP_IS_COLOR_BUTTON (callback_data));
gimp_palette_get_background (&bg_color[0], &bg_color[1], &bg_color[2]);
gimp_color_button_get_color (GIMP_COLOR_BUTTON (callback_data), &color);
gimp_rgb_set (&color,
bg_color[0] / 255.0,
bg_color[1] / 255.0,
bg_color[2] / 255.0);
gimp_palette_get_background_rgb (&color);
gimp_color_button_set_color (GIMP_COLOR_BUTTON (callback_data), &color);
}
......
......@@ -165,10 +165,9 @@ compute_preview (gint x,
gdouble realw;
gdouble realh;
GimpVector3 p1, p2;
GimpRGB color;
GimpRGB lightcheck, darkcheck;
GimpRGB temp;
guchar r, g, b;
GimpRGB color;
GimpRGB lightcheck, darkcheck;
GimpRGB temp;
gint xcnt, ycnt, f1, f2;
glong index = 0;
......@@ -198,11 +197,8 @@ compute_preview (gint x,
}
else
{
gimp_palette_get_background (&r, &g, &b);
background.r = (gdouble) r / 255.0;
background.g = (gdouble) g / 255.0;
background.b = (gdouble) b / 255.0;
background.a = 1.0;
gimp_palette_get_background_rgb (&background);
gimp_rgb_set_alpha (&background, 1.0);
}
gimp_rgb_set (&lightcheck, 0.75, 0.75, 0.75);
......
......@@ -246,20 +246,24 @@ find_projected_pos (gfloat a,
static void
drawlens (GimpDrawable *drawable)
{
GimpPixelRgn srcPR, destPR;
gint width, height;
gint bytes;
gint row;
gint x1, y1, x2, y2;
guchar *src, *dest;
gint i, col;
gfloat regionwidth, regionheight, dx, dy, xsqr, ysqr;
gfloat a, b, asqr, bsqr, x, y;
glong pixelpos, pos;
guchar bgr_red, bgr_blue, bgr_green, alphaval;
GimpImageType drawtype = gimp_drawable_type (drawable->id);
gimp_palette_get_background (&bgr_red, &bgr_green, &bgr_blue);
GimpPixelRgn srcPR, destPR;
gint width, height;
gint bytes;
gint row;
gint x1, y1, x2, y2;
guchar *src, *dest;
gint i, col;
gfloat regionwidth, regionheight, dx, dy, xsqr, ysqr;
gfloat a, b, asqr, bsqr, x, y;
glong pixelpos, pos;
GimpRGB background;
guchar bgr_red, bgr_blue, bgr_green;
guchar alphaval;
gimp_palette_get_background_rgb (&background);
gimp_rgb_get_uchar (&background,
&bgr_red, &bgr_green, &bgr_blue);
gimp_drawable_mask_bounds (drawable->id, &x1, &y1, &x2, &y2);
regionwidth = x2 - x1;
......
......@@ -128,7 +128,7 @@ static void blinds_button_update (GtkWidget *widget,
static void dialog_update_preview (void);
static void cache_preview (void);
static void apply_blinds (void);
static int blinds_get_bg (guchar *bg);
static void blinds_get_bg (guchar *bg);
GimpPlugInInfo PLUG_IN_INFO =
{
......@@ -647,44 +647,44 @@ blindsapply (guchar *srow,
}
}
static int
static void
blinds_get_bg (guchar *bg)
{
/* Get the background color */
int retval = FALSE; /*Return TRUE if of GREYA type */
GimpRGB background;
gimp_palette_get_background_rgb (&background);
switch (gimp_drawable_type (blindsdrawable->id))
{
case GIMP_RGBA_IMAGE:
bg[3] = bvals.bg_trans ? 0 : 255;
break;
case GIMP_RGB_IMAGE :
gimp_palette_get_background (&bg[0], &bg[1], &bg[2]);
gimp_rgb_get_uchar (&background, &bg[0], &bg[1], &bg[2]);
bg[3] = 255;
break;
case GIMP_GRAYA_IMAGE:
retval = TRUE;
case GIMP_RGBA_IMAGE:
gimp_rgb_get_uchar (&background, &bg[0], &bg[1], &bg[2]);
bg[3] = bvals.bg_trans ? 0 : 255;
break;
case GIMP_GRAY_IMAGE:
bg[2] = 0;
bg[1] = 0;
bg[0] = 0;
bg[0] = gimp_rgb_intensity_uchar (&background);
bg[1] = 255;
break;
case GIMP_GRAYA_IMAGE:
bg[0] = gimp_rgb_intensity_uchar (&background);
bg[1] = bvals.bg_trans ? 0 : 255;
break;
default:
break;
}
return retval;
}
static void
dialog_update_preview (void)
{
int y;
gint y;
guchar *p;
guchar bg[4];
gint check, check_0, check_1;
......@@ -702,39 +702,42 @@ dialog_update_preview (void)
if ((y / GIMP_CHECK_SIZE) & 1)
{
check_0 = GIMP_CHECK_DARK * 255;
check_1 = GIMP_CHECK_LIGHT * 255;
check_0 = GIMP_CHECK_DARK * 255.0;
check_1 = GIMP_CHECK_LIGHT * 255.0;
}
else
{
check_0 = GIMP_CHECK_LIGHT * 255;
check_1 = GIMP_CHECK_DARK * 255;
check_0 = GIMP_CHECK_LIGHT * 255.0;
check_1 = GIMP_CHECK_DARK * 255.0;
}
if (bint.img_bpp > 3)
{
int i,j;
for (i = 0, j = 0 ; i < sizeof(bint.preview_row); i += 4, j += 3 )
{
gint alphaval;
if (((i/4) / GIMP_CHECK_SIZE) & 1)
check = check_0;
else
check = check_1;
alphaval = bint.preview_row[i + 3];
bint.preview_row[j] =
check + (((bint.preview_row[i] - check)*alphaval)/255);
bint.preview_row[j + 1] =
check + (((bint.preview_row[i + 1] - check)*alphaval)/255);
bint.preview_row[j + 2] =
check + (((bint.preview_row[i + 2] - check)*alphaval)/255);
}
}
gint i,j;
for (i = 0, j = 0 ;
i < sizeof(bint.preview_row);
i += 4, j += 3 )
{
gint alphaval;
if (((i/4) / GIMP_CHECK_SIZE) & 1)
check = check_0;
else
check = check_1;
alphaval = bint.preview_row[i + 3];
bint.preview_row[j] =
check + (((bint.preview_row[i] - check) * alphaval) / 255);
bint.preview_row[j + 1] =
check + (((bint.preview_row[i + 1] - check) * alphaval) / 255);
bint.preview_row[j + 2] =
check + (((bint.preview_row[i + 2] - check) * alphaval) / 255);
}
}
gtk_preview_draw_row(GTK_PREVIEW(bint.preview),
bint.preview_row, 0, y, preview_width);
gtk_preview_draw_row (GTK_PREVIEW (bint.preview),
bint.preview_row, 0, y, preview_width);
p += preview_width * bint.img_bpp;
}
......@@ -746,10 +749,10 @@ dialog_update_preview (void)
* this act as a transfomation matrix for the
* rows. Make row 0 invalid so we can find it again!
*/
int i;
int loop1,loop2;
guchar *sr = g_new(guchar,(preview_height)*4);
guchar *dr = g_new(guchar,(preview_height)*4);
gint i;
gint loop1,loop2;
guchar *sr = g_new (guchar, preview_height * 4);
guchar *dr = g_new (guchar, preview_height * 4);
guchar dummybg[4];
/* Copy into here after translation*/
guchar copy_row[PREVIEW_SIZE*4];
......@@ -760,8 +763,8 @@ dialog_update_preview (void)
/* Fill in with background color ? */
for (i = 0 ; i < preview_width ; i++)
{
int j;
int bd = bint.img_bpp;
gint j;
gint bd = bint.img_bpp;
guchar *dst;
dst = &bint.preview_row[i*bd];
......@@ -857,9 +860,7 @@ apply_blinds (void)
int x,y;
guchar bg[4];
/* Adjust aplha channel if GREYA */
if (blinds_get_bg (bg) == TRUE)
bg[1] = bvals.bg_trans ? 0 : 255;
blinds_get_bg (bg);
gimp_pixel_rgn_init (&src_rgn, blindsdrawable,
sel_x1, sel_y1, sel_width, sel_height, FALSE, FALSE);
......
......@@ -32,16 +32,16 @@
/* Declare local functions.
*/
static void query (void);
static void run (gchar *name,
gint nparams,
GimpParam *param,
gint *nreturn_vals,
GimpParam **return_vals);
static void run (gchar *name,
gint nparams,
GimpParam *param,
gint *nreturn_vals,
GimpParam **return_vals);
static void borderaverage (GimpDrawable *drawable,
guchar *res_r,
guchar *res_g,
guchar *res_b);
guchar *res_r,
guchar *res_g,
guchar *res_b);
static gint borderaverage_dialog (void);
......@@ -50,6 +50,7 @@ static void add_new_color (gint bytes,
gint *cube,
gint bucket_expo);
GimpPlugInInfo PLUG_IN_INFO =
{
NULL, /* init */
......
......@@ -187,14 +187,17 @@ static void
check (GimpDrawable *drawable)
{
GimpPixelRgn dest_rgn;
guchar *dest_row;
guchar *dest;
gint row, col;
gint progress, max_progress;
gint x1, y1, x2, y2, x, y;
guchar fg[4],bg[4];
gint bp;
gpointer pr;
guchar *dest_row;
guchar *dest;
gint row, col;
gint progress, max_progress;
gint x1, y1, x2, y2, x, y;
GimpRGB foreground;
GimpRGB background;
guchar fg[4];
guchar bg[4];
gint bp;
gpointer pr;
gimp_drawable_mask_bounds (drawable->id, &x1, &y1, &x2, &y2);
gimp_pixel_rgn_init (&dest_rgn, drawable,
......@@ -205,22 +208,27 @@ check (GimpDrawable *drawable)
/* Get the foreground and background colors */
switch ( gimp_drawable_type (drawable->id) )
gimp_palette_get_foreground_rgb (&foreground);
gimp_palette_get_background_rgb (&background);
switch (gimp_drawable_type (drawable->id))
{
case GIMP_RGBA_IMAGE:
fg[3] = 255;
bg[3] = 255;
case GIMP_RGB_IMAGE:
gimp_palette_get_foreground (&fg[0], &fg[1], &fg[2]);
gimp_palette_get_background (&bg[0], &bg[1], &bg[2]);
gimp_rgb_get_uchar (&foreground, &fg[0], &fg[1], &fg[2]);
gimp_rgb_get_uchar (&background, &bg[0], &bg[1], &bg[2]);
break;
case GIMP_GRAYA_IMAGE:
fg[1] = 255;
bg[1] = 255;
case GIMP_GRAY_IMAGE:
fg[0] = 255;
bg[0] = 0;
fg[0] = gimp_rgb_intensity_uchar (&foreground);
bg[0] = gimp_rgb_intensity_uchar (&background);
break;
default:
break;
}
......@@ -260,15 +268,19 @@ check (GimpDrawable *drawable)
}
for (bp = 0; bp < dest_rgn.bpp; bp++)
dest[bp] = val ? fg[bp] : bg[bp];
dest += dest_rgn.bpp;
x++;
}
dest_row += dest_rgn.rowstride;
y++;
}
progress += dest_rgn.w * dest_rgn.h;
gimp_progress_update ((double) progress / (double) max_progress);
gimp_progress_update ((gdouble) progress / (gdouble) max_progress);
}
gimp_drawable_flush (drawable);
gimp_drawable_merge_shadow (drawable->id, TRUE);
gimp_drawable_update (drawable->id, x1, y1, (x2 - x1), (y2 - y1));
......
......@@ -62,17 +62,17 @@ typedef struct
/* Declare local functions.
*/
static void query (void);
static void run (gchar *name,
gint nparams,
static void run (gchar *name,
gint nparams,
GimpParam *param,
gint *nreturn_vals,
gint *nreturn_vals,
GimpParam **return_vals);
static void cubism (GimpDrawable *drawable);
static void render_cubism (GimpDrawable *drawable);
static void fill_poly_color (Polygon *poly,
static void fill_poly_color (Polygon *poly,
GimpDrawable *drawable,
guchar *col);
guchar *col);
static void convert_segment (gint x1,
gint y1,
gint x2,
......@@ -168,10 +168,10 @@ query (void)
}
static void
run (gchar *name,
gint nparams,
run (gchar *name,
gint nparams,
GimpParam *param,
gint *nreturn_vals,
gint *nreturn_vals,
GimpParam **return_vals)
{
static GimpParam values[1];
......@@ -206,9 +206,9 @@ run (gchar *name,
status = GIMP_PDB_CALLING_ERROR;
if (status == GIMP_PDB_SUCCESS)
{
cvals.tile_size = param[3].data.d_float;
cvals.tile_size = param[3].data.d_float;
cvals.tile_saturation = param[4].data.d_float;
cvals.bg_color = param[5].data.d_int32;
cvals.bg_color = param[5].data.d_int32;
}
if (status == GIMP_PDB_SUCCESS &&
(cvals.bg_color < BLACK || cvals.bg_color > BG))
......@@ -259,19 +259,37 @@ run (gchar *name,
static void
cubism (GimpDrawable *drawable)
{
gint x1, y1, x2, y2;
GimpRGB background;
gint x1, y1, x2, y2;
/* find the drawable mask bounds */
gimp_drawable_mask_bounds (drawable->id, &x1, &y1, &x2, &y2);
/* determine the background color */
if (cvals.bg_color == BLACK)
bg_col[0] = bg_col[1] = bg_col[2] = 0;
{
bg_col[0] = bg_col[1] = bg_col[2] = bg_col[3] = 0;
}
else
gimp_palette_get_background (&bg_col[0], &bg_col[1], &bg_col[2]);
if (gimp_drawable_has_alpha (drawable->id))
bg_col[drawable->bpp - 1] = 0;
{
gimp_palette_get_background_rgb (&background);
switch (gimp_drawable_type (drawable->id))
{
case GIMP_RGBA_IMAGE:
bg_col[3] = 0;
case GIMP_RGB_IMAGE:
gimp_rgb_get_uchar (&background,
&bg_col[0], &bg_col[1], &bg_col[2]);
break;
case GIMP_GRAYA_IMAGE:
bg_col[1] = 0;
case GIMP_GRAY_IMAGE:
bg_col[0] = gimp_rgb_intensity_uchar (&background);
default:
break;
}
}
gimp_progress_init (_("Cubistic Transformation"));
......@@ -433,10 +451,14 @@ render_cubism (GimpDrawable *drawable)
{
i = random_indices[count] / (cols + 1);
j = random_indices[count] % (cols + 1);
x = j * cvals.tile_size + (cvals.tile_size / 4.0) - fp_rand (cvals.tile_size/2.0) + x1;
y = i * cvals.tile_size + (cvals.tile_size / 4.0) - fp_rand (cvals.tile_size/2.0) + y1;
width = (cvals.tile_size + fp_rand (cvals.tile_size / 4.0) - cvals.tile_size / 8.0) * cvals.tile_saturation;
height = (cvals.tile_size + fp_rand (cvals.tile_size / 4.0) - cvals.tile_size / 8.0) * cvals.tile_saturation;
x = j * cvals.tile_size + (cvals.tile_size / 4.0)
- fp_rand (cvals.tile_size/2.0) + x1;
y = i * cvals.tile_size + (cvals.tile_size / 4.0)
- fp_rand (cvals.tile_size/2.0) + y1;
width = (cvals.tile_size + fp_rand (cvals.tile_size / 4.0)
- cvals.tile_size / 8.0) * cvals.tile_saturation;
height = (cvals.tile_size + fp_rand (cvals.tile_size / 4.0)
- cvals.tile_size / 8.0) * cvals.tile_saturation;
theta = fp_rand (2 * G_PI);
polygon_reset (&poly);
polygon_add_point (&poly, -width / 2.0, -height / 2.0);
......
......@@ -844,28 +844,29 @@ save_image (gchar *filename,
GimpDrawable *drawable;
GimpImageType drawable_type;
FILE *outfile;
int Red[MAXCOLORS];
int Green[MAXCOLORS];
int Blue[MAXCOLORS];
gint Red[MAXCOLORS];
gint Green[MAXCOLORS];
gint Blue[MAXCOLORS];
guchar *cmap;
guint rows, cols;
int BitsPerPixel, liberalBPP=0, useBPP=0;
int colors;
char *temp_buf;
int i;
int transparent;
gint BitsPerPixel, liberalBPP=0, useBPP=0;
gint colors;
gchar *temp_buf;
gint i;
gint transparent;
gint offset_x, offset_y;
gint32 *layers;
int nlayers;
gint nlayers;
gboolean is_gif89 = FALSE;
int Delay89;
int Disposal;
char *layer_name;
gint Delay89;
gint Disposal;
gchar *layer_name;
unsigned char bgred, bggreen, bgblue;
GimpRGB background;
guchar bgred, bggreen, bgblue;
#ifdef FACEHUGGERS
......@@ -906,19 +907,20 @@ save_image (gchar *filename,
case GIMP_INDEXED_IMAGE:
cmap = gimp_image_get_cmap (image_ID, &colors);
gimp_palette_get_background(&bgred, &bggreen, &bgblue);
gimp_palette_get_background_rgb (&background);
gimp_rgb_get_uchar (&background, &bgred, &bggreen, &bgblue);
for (i = 0; i < colors; i++)
{
Red[i] = *cmap++;
Red[i] = *cmap++;