plug-ins/common/file-header.c plug-ins/common/file-psp.c
2008-09-17 Michael Natterer <mitch@gimp.org> * plug-ins/common/file-header.c * plug-ins/common/file-psp.c * plug-ins/common/file-xbm.c * plug-ins/common/file-xpm.c * plug-ins/common/hot.c * plug-ins/common/mail.c: add const plus misc. cleanups. svn path=/trunk/; revision=26965
This commit is contained in:

committed by
Michael Natterer

parent
343b694195
commit
251c11aad3
@ -1,3 +1,12 @@
|
|||||||
|
2008-09-17 Michael Natterer <mitch@gimp.org>
|
||||||
|
|
||||||
|
* plug-ins/common/file-header.c
|
||||||
|
* plug-ins/common/file-psp.c
|
||||||
|
* plug-ins/common/file-xbm.c
|
||||||
|
* plug-ins/common/file-xpm.c
|
||||||
|
* plug-ins/common/hot.c
|
||||||
|
* plug-ins/common/mail.c: add const plus misc. cleanups.
|
||||||
|
|
||||||
2008-09-17 Michael Natterer <mitch@gimp.org>
|
2008-09-17 Michael Natterer <mitch@gimp.org>
|
||||||
|
|
||||||
* plug-ins/file-fits/fits.c
|
* plug-ins/file-fits/fits.c
|
||||||
|
@ -40,7 +40,7 @@ static void run (const gchar *name,
|
|||||||
const GimpParam *param,
|
const GimpParam *param,
|
||||||
gint *nreturn_vals,
|
gint *nreturn_vals,
|
||||||
GimpParam **return_vals);
|
GimpParam **return_vals);
|
||||||
static gint save_image (const gchar *filename,
|
static gboolean save_image (const gchar *filename,
|
||||||
gint32 image_ID,
|
gint32 image_ID,
|
||||||
gint32 drawable_ID);
|
gint32 drawable_ID);
|
||||||
|
|
||||||
@ -94,9 +94,6 @@ run (const gchar *name,
|
|||||||
static GimpParam values[2];
|
static GimpParam values[2];
|
||||||
GimpRunMode run_mode;
|
GimpRunMode run_mode;
|
||||||
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
|
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
|
||||||
gint32 image_ID;
|
|
||||||
gint32 drawable_ID;
|
|
||||||
GimpExportReturn export = GIMP_EXPORT_CANCEL;
|
|
||||||
|
|
||||||
run_mode = param[0].data.d_int32;
|
run_mode = param[0].data.d_int32;
|
||||||
|
|
||||||
@ -109,6 +106,10 @@ run (const gchar *name,
|
|||||||
|
|
||||||
if (strcmp (name, SAVE_PROC) == 0)
|
if (strcmp (name, SAVE_PROC) == 0)
|
||||||
{
|
{
|
||||||
|
gint32 image_ID;
|
||||||
|
gint32 drawable_ID;
|
||||||
|
GimpExportReturn export = GIMP_EXPORT_CANCEL;
|
||||||
|
|
||||||
image_ID = param[1].data.d_int32;
|
image_ID = param[1].data.d_int32;
|
||||||
drawable_ID = param[2].data.d_int32;
|
drawable_ID = param[2].data.d_int32;
|
||||||
|
|
||||||
@ -127,6 +128,7 @@ run (const gchar *name,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -147,7 +149,7 @@ run (const gchar *name,
|
|||||||
values[0].data.d_status = status;
|
values[0].data.d_status = status;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static gboolean
|
||||||
save_image (const gchar *filename,
|
save_image (const gchar *filename,
|
||||||
gint32 image_ID,
|
gint32 image_ID,
|
||||||
gint32 drawable_ID)
|
gint32 drawable_ID)
|
||||||
@ -157,9 +159,9 @@ save_image (const gchar *filename,
|
|||||||
GimpImageType drawable_type;
|
GimpImageType drawable_type;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
gint x, y, b, c;
|
gint x, y, b, c;
|
||||||
gchar *backslash = "\\\\";
|
const gchar *backslash = "\\\\";
|
||||||
gchar *quote = "\\\"";
|
const gchar *quote = "\\\"";
|
||||||
gchar *newline = "\"\n\t\"";
|
const gchar *newline = "\"\n\t\"";
|
||||||
gchar buf[4];
|
gchar buf[4];
|
||||||
guchar *d = NULL;
|
guchar *d = NULL;
|
||||||
guchar *data;
|
guchar *data;
|
||||||
@ -179,10 +181,16 @@ save_image (const gchar *filename,
|
|||||||
fprintf (fp, "static unsigned int width = %d;\n", drawable->width);
|
fprintf (fp, "static unsigned int width = %d;\n", drawable->width);
|
||||||
fprintf (fp, "static unsigned int height = %d;\n\n", drawable->height);
|
fprintf (fp, "static unsigned int height = %d;\n\n", drawable->height);
|
||||||
fprintf (fp, "/* Call this macro repeatedly. After each use, the pixel data can be extracted */\n\n");
|
fprintf (fp, "/* Call this macro repeatedly. After each use, the pixel data can be extracted */\n\n");
|
||||||
|
|
||||||
switch (drawable_type)
|
switch (drawable_type)
|
||||||
{
|
{
|
||||||
case GIMP_RGB_IMAGE:
|
case GIMP_RGB_IMAGE:
|
||||||
fprintf (fp, "#define HEADER_PIXEL(data,pixel) {\\\n pixel[0] = (((data[0] - 33) << 2) | ((data[1] - 33) >> 4)); \\\n pixel[1] = ((((data[1] - 33) & 0xF) << 4) | ((data[2] - 33) >> 2)); \\\n pixel[2] = ((((data[2] - 33) & 0x3) << 6) | ((data[3] - 33))); \\\n data += 4; \\\n}\n");
|
fprintf (fp,
|
||||||
|
"#define HEADER_PIXEL(data,pixel) {\\\n"
|
||||||
|
"pixel[0] = (((data[0] - 33) << 2) | ((data[1] - 33) >> 4)); \\\n"
|
||||||
|
"pixel[1] = ((((data[1] - 33) & 0xF) << 4) | ((data[2] - 33) >> 2)); \\\n"
|
||||||
|
"pixel[2] = ((((data[2] - 33) & 0x3) << 6) | ((data[3] - 33))); \\\n"
|
||||||
|
"data += 4; \\\n}\n");
|
||||||
fprintf (fp, "static char *header_data =\n\t\"");
|
fprintf (fp, "static char *header_data =\n\t\"");
|
||||||
|
|
||||||
data = g_new (guchar, drawable->width * drawable->bpp);
|
data = g_new (guchar, drawable->width * drawable->bpp);
|
||||||
@ -191,6 +199,7 @@ save_image (const gchar *filename,
|
|||||||
for (y = 0; y < drawable->height; y++)
|
for (y = 0; y < drawable->height; y++)
|
||||||
{
|
{
|
||||||
gimp_pixel_rgn_get_row (&pixel_rgn, data, 0, y, drawable->width);
|
gimp_pixel_rgn_get_row (&pixel_rgn, data, 0, y, drawable->width);
|
||||||
|
|
||||||
for (x = 0; x < drawable->width; x++)
|
for (x = 0; x < drawable->width; x++)
|
||||||
{
|
{
|
||||||
d = data + x * drawable->bpp;
|
d = data + x * drawable->bpp;
|
||||||
@ -201,12 +210,14 @@ save_image (const gchar *filename,
|
|||||||
buf[3] = (d[2] & 0x3F) + 33;
|
buf[3] = (d[2] & 0x3F) + 33;
|
||||||
|
|
||||||
for (b = 0; b < 4; b++)
|
for (b = 0; b < 4; b++)
|
||||||
|
{
|
||||||
if (buf[b] == '"')
|
if (buf[b] == '"')
|
||||||
fwrite (quote, 1, 2, fp);
|
fwrite (quote, 1, 2, fp);
|
||||||
else if (buf[b] == '\\')
|
else if (buf[b] == '\\')
|
||||||
fwrite (backslash, 1, 2, fp);
|
fwrite (backslash, 1, 2, fp);
|
||||||
else
|
else
|
||||||
fwrite (buf + b, 1, 1, fp);
|
fwrite (buf + b, 1, 1, fp);
|
||||||
|
}
|
||||||
|
|
||||||
c++;
|
c++;
|
||||||
if (c >= 16)
|
if (c >= 16)
|
||||||
@ -216,21 +227,30 @@ save_image (const gchar *filename,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf (fp, "\";\n");
|
fprintf (fp, "\";\n");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GIMP_INDEXED_IMAGE:
|
case GIMP_INDEXED_IMAGE:
|
||||||
fprintf (fp, "#define HEADER_PIXEL(data,pixel) {\\\n pixel[0] = header_data_cmap[(unsigned char)data[0]][0]; \\\n pixel[1] = header_data_cmap[(unsigned char)data[0]][1]; \\\n pixel[2] = header_data_cmap[(unsigned char)data[0]][2]; \\\n data ++; }\n\n");
|
fprintf (fp,
|
||||||
|
"#define HEADER_PIXEL(data,pixel) {\\\n"
|
||||||
|
"pixel[0] = header_data_cmap[(unsigned char)data[0]][0]; \\\n"
|
||||||
|
"pixel[1] = header_data_cmap[(unsigned char)data[0]][1]; \\\n"
|
||||||
|
"pixel[2] = header_data_cmap[(unsigned char)data[0]][2]; \\\n"
|
||||||
|
"data ++; }\n\n");
|
||||||
/* save colormap */
|
/* save colormap */
|
||||||
cmap = gimp_image_get_colormap (image_ID, &colors);
|
cmap = gimp_image_get_colormap (image_ID, &colors);
|
||||||
|
|
||||||
fprintf (fp, "static char header_data_cmap[256][3] = {");
|
fprintf (fp, "static char header_data_cmap[256][3] = {");
|
||||||
fprintf (fp, "\n\t{%3d,%3d,%3d}", (int)cmap[0], (int)cmap[1], (int)cmap[2]);
|
fprintf (fp, "\n\t{%3d,%3d,%3d}", (int)cmap[0], (int)cmap[1], (int)cmap[2]);
|
||||||
|
|
||||||
for (c = 1; c < colors; c++)
|
for (c = 1; c < colors; c++)
|
||||||
fprintf (fp, ",\n\t{%3d,%3d,%3d}", (int)cmap[3*c], (int)cmap[3*c+1], (int)cmap[3*c+2]);
|
fprintf (fp, ",\n\t{%3d,%3d,%3d}", (int)cmap[3*c], (int)cmap[3*c+1], (int)cmap[3*c+2]);
|
||||||
|
|
||||||
/* fill the rest */
|
/* fill the rest */
|
||||||
for ( ; c < 256; c++)
|
for ( ; c < 256; c++)
|
||||||
fprintf (fp, ",\n\t{255,255,255}");
|
fprintf (fp, ",\n\t{255,255,255}");
|
||||||
|
|
||||||
/* close bracket */
|
/* close bracket */
|
||||||
fprintf (fp, "\n\t};\n");
|
fprintf (fp, "\n\t};\n");
|
||||||
g_free (cmap);
|
g_free (cmap);
|
||||||
@ -244,6 +264,7 @@ save_image (const gchar *filename,
|
|||||||
for (y = 0; y < drawable->height; y++)
|
for (y = 0; y < drawable->height; y++)
|
||||||
{
|
{
|
||||||
gimp_pixel_rgn_get_row (&pixel_rgn, data, 0, y, drawable->width);
|
gimp_pixel_rgn_get_row (&pixel_rgn, data, 0, y, drawable->width);
|
||||||
|
|
||||||
for (x = 0; x < drawable->width-1; x++)
|
for (x = 0; x < drawable->width-1; x++)
|
||||||
{
|
{
|
||||||
d = data + x * drawable->bpp;
|
d = data + x * drawable->bpp;
|
||||||
@ -262,14 +283,16 @@ save_image (const gchar *filename,
|
|||||||
fprintf (fp, "%d,\n\t", (int)d[1]);
|
fprintf (fp, "%d,\n\t", (int)d[1]);
|
||||||
else
|
else
|
||||||
fprintf (fp, "%d\n\t", (int)d[1]);
|
fprintf (fp, "%d\n\t", (int)d[1]);
|
||||||
|
|
||||||
c = 0; /* reset line counter */
|
c = 0; /* reset line counter */
|
||||||
}
|
}
|
||||||
fprintf (fp, "};\n");
|
fprintf (fp, "};\n");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
g_warning ("unhandled drawable type (%d)", drawable_type);
|
g_warning ("unhandled drawable type (%d)", drawable_type);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
} /* switch (drawable_type) */
|
}
|
||||||
|
|
||||||
fclose (fp);
|
fclose (fp);
|
||||||
|
|
||||||
|
@ -681,10 +681,10 @@ save_dialog (void)
|
|||||||
/* This helper method is used to get the name of the block for the known block
|
/* This helper method is used to get the name of the block for the known block
|
||||||
* types. The enum PSPBlockID must cover the input values.
|
* types. The enum PSPBlockID must cover the input values.
|
||||||
*/
|
*/
|
||||||
static gchar *
|
static const gchar *
|
||||||
block_name (gint id)
|
block_name (gint id)
|
||||||
{
|
{
|
||||||
static gchar *block_names[] =
|
static const gchar *block_names[] =
|
||||||
{
|
{
|
||||||
"IMAGE",
|
"IMAGE",
|
||||||
"CREATOR",
|
"CREATOR",
|
||||||
@ -1082,10 +1082,10 @@ gimp_layer_mode_from_psp_blend_mode (PSPBlendModes mode)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gchar *
|
static const gchar *
|
||||||
blend_mode_name (PSPBlendModes mode)
|
blend_mode_name (PSPBlendModes mode)
|
||||||
{
|
{
|
||||||
static gchar *blend_mode_names[] =
|
static const gchar *blend_mode_names[] =
|
||||||
{
|
{
|
||||||
"NORMAL",
|
"NORMAL",
|
||||||
"DARKEN",
|
"DARKEN",
|
||||||
@ -1117,10 +1117,10 @@ blend_mode_name (PSPBlendModes mode)
|
|||||||
return err_name;
|
return err_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gchar *
|
static const gchar *
|
||||||
bitmap_type_name (gint type)
|
bitmap_type_name (gint type)
|
||||||
{
|
{
|
||||||
static gchar *bitmap_type_names[] =
|
static const gchar *bitmap_type_names[] =
|
||||||
{
|
{
|
||||||
"IMAGE",
|
"IMAGE",
|
||||||
"TRANS_MASK",
|
"TRANS_MASK",
|
||||||
@ -1140,10 +1140,10 @@ bitmap_type_name (gint type)
|
|||||||
return err_name;
|
return err_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gchar *
|
static const gchar *
|
||||||
channel_type_name (gint type)
|
channel_type_name (gint type)
|
||||||
{
|
{
|
||||||
static char *channel_type_names[] =
|
static const gchar *channel_type_names[] =
|
||||||
{
|
{
|
||||||
"COMPOSITE",
|
"COMPOSITE",
|
||||||
"RED",
|
"RED",
|
||||||
@ -1707,7 +1707,7 @@ read_tube_block (FILE *f,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gchar *
|
static const gchar *
|
||||||
compression_name (gint compression)
|
compression_name (gint compression)
|
||||||
{
|
{
|
||||||
switch (compression)
|
switch (compression)
|
||||||
|
@ -630,7 +630,7 @@ cpp_fgetc (FILE *fp)
|
|||||||
/* Match a string with a file. */
|
/* Match a string with a file. */
|
||||||
static gint
|
static gint
|
||||||
match (FILE *fp,
|
match (FILE *fp,
|
||||||
gchar *s)
|
const gchar *s)
|
||||||
{
|
{
|
||||||
gint c;
|
gint c;
|
||||||
|
|
||||||
@ -704,13 +704,12 @@ get_int (FILE *fp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static gint
|
static gint32
|
||||||
load_image (const gchar *filename,
|
load_image (const gchar *filename,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
GimpPixelRgn pixel_rgn;
|
GimpPixelRgn pixel_rgn;
|
||||||
GimpDrawable *drawable;
|
GimpDrawable *drawable;
|
||||||
|
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
gint32 image_ID;
|
gint32 image_ID;
|
||||||
gint32 layer_ID;
|
gint32 layer_ID;
|
||||||
@ -978,7 +977,7 @@ save_image (const gchar *filename,
|
|||||||
gint bpp;
|
gint bpp;
|
||||||
|
|
||||||
guchar *data, *cmap;
|
guchar *data, *cmap;
|
||||||
gchar *intfmt;
|
const gchar *intfmt;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if (save_mask)
|
if (save_mask)
|
||||||
|
@ -570,7 +570,9 @@ set_XpmImage (XpmColor *array,
|
|||||||
{
|
{
|
||||||
array[index].g_color = NULL;
|
array[index].g_color = NULL;
|
||||||
array[index].c_color = colorstring;
|
array[index].c_color = colorstring;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
array[index].c_color = NULL;
|
array[index].c_color = NULL;
|
||||||
array[index].g_color = colorstring;
|
array[index].g_color = colorstring;
|
||||||
}
|
}
|
||||||
|
@ -149,8 +149,8 @@ static void run (const gchar *name,
|
|||||||
gint *nretvals,
|
gint *nretvals,
|
||||||
GimpParam **retvals);
|
GimpParam **retvals);
|
||||||
|
|
||||||
static gint pluginCore (piArgs *argp);
|
static gboolean pluginCore (piArgs *argp);
|
||||||
static gint pluginCoreIA (piArgs *argp);
|
static gboolean plugin_dialog (piArgs *argp);
|
||||||
static gboolean hotp (guint8 r,
|
static gboolean hotp (guint8 r,
|
||||||
guint8 g,
|
guint8 g,
|
||||||
guint8 b);
|
guint8 b);
|
||||||
@ -238,7 +238,7 @@ run (const gchar *name,
|
|||||||
|
|
||||||
INIT_I18N ();
|
INIT_I18N ();
|
||||||
|
|
||||||
memset (&args, (int) 0, sizeof (args));
|
memset (&args, 0, sizeof (args));
|
||||||
args.mode = -1;
|
args.mode = -1;
|
||||||
|
|
||||||
gimp_get_data (PLUG_IN_PROC, &args);
|
gimp_get_data (PLUG_IN_PROC, &args);
|
||||||
@ -260,12 +260,19 @@ run (const gchar *name,
|
|||||||
args.new_layerp = 1;
|
args.new_layerp = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pluginCoreIA(&args) == -1)
|
if (plugin_dialog (&args))
|
||||||
|
{
|
||||||
|
if (! pluginCore (&args))
|
||||||
{
|
{
|
||||||
rvals[0].data.d_status = GIMP_PDB_EXECUTION_ERROR;
|
rvals[0].data.d_status = GIMP_PDB_EXECUTION_ERROR;
|
||||||
}
|
}
|
||||||
gimp_set_data (PLUG_IN_PROC, &args, sizeof (args));
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rvals[0].data.d_status = GIMP_PDB_CANCEL;
|
||||||
|
}
|
||||||
|
|
||||||
|
gimp_set_data (PLUG_IN_PROC, &args, sizeof (args));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GIMP_RUN_NONINTERACTIVE:
|
case GIMP_RUN_NONINTERACTIVE:
|
||||||
@ -279,7 +286,7 @@ run (const gchar *name,
|
|||||||
args.action = param[4].data.d_int32;
|
args.action = param[4].data.d_int32;
|
||||||
args.new_layerp = param[5].data.d_int32;
|
args.new_layerp = param[5].data.d_int32;
|
||||||
|
|
||||||
if (pluginCore(&args) == -1)
|
if (! pluginCore (&args))
|
||||||
{
|
{
|
||||||
rvals[0].data.d_status = GIMP_PDB_EXECUTION_ERROR;
|
rvals[0].data.d_status = GIMP_PDB_EXECUTION_ERROR;
|
||||||
break;
|
break;
|
||||||
@ -288,7 +295,7 @@ run (const gchar *name,
|
|||||||
|
|
||||||
case GIMP_RUN_WITH_LAST_VALS:
|
case GIMP_RUN_WITH_LAST_VALS:
|
||||||
/* XXX: add code here for last-values running */
|
/* XXX: add code here for last-values running */
|
||||||
if (pluginCore (&args) == -1)
|
if (! pluginCore (&args))
|
||||||
{
|
{
|
||||||
rvals[0].data.d_status = GIMP_PDB_EXECUTION_ERROR;
|
rvals[0].data.d_status = GIMP_PDB_EXECUTION_ERROR;
|
||||||
}
|
}
|
||||||
@ -296,14 +303,14 @@ run (const gchar *name,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint
|
static gboolean
|
||||||
pluginCore (piArgs *argp)
|
pluginCore (piArgs *argp)
|
||||||
{
|
{
|
||||||
GimpDrawable *drw, *ndrw = NULL;
|
GimpDrawable *drw, *ndrw = NULL;
|
||||||
GimpPixelRgn srcPr, dstPr;
|
GimpPixelRgn srcPr, dstPr;
|
||||||
gint retval = 0;
|
gboolean success = TRUE;
|
||||||
gint nl = 0;
|
gint nl = 0;
|
||||||
gint y, x, i;
|
gint y, i;
|
||||||
gint Y, I, Q;
|
gint Y, I, Q;
|
||||||
guint width, height, bpp;
|
guint width, height, bpp;
|
||||||
gint sel_x1, sel_x2, sel_y1, sel_y2;
|
gint sel_x1, sel_x2, sel_y1, sel_y2;
|
||||||
@ -321,15 +328,16 @@ pluginCore (piArgs *argp)
|
|||||||
width = drw->width;
|
width = drw->width;
|
||||||
height = drw->height;
|
height = drw->height;
|
||||||
bpp = drw->bpp;
|
bpp = drw->bpp;
|
||||||
|
|
||||||
if (argp->new_layerp)
|
if (argp->new_layerp)
|
||||||
{
|
{
|
||||||
gchar name[40];
|
gchar name[40];
|
||||||
gchar *mode_names[] =
|
const gchar *mode_names[] =
|
||||||
{
|
{
|
||||||
"ntsc",
|
"ntsc",
|
||||||
"pal",
|
"pal",
|
||||||
};
|
};
|
||||||
gchar *action_names[] =
|
const gchar *action_names[] =
|
||||||
{
|
{
|
||||||
"lum redux",
|
"lum redux",
|
||||||
"sat redux",
|
"sat redux",
|
||||||
@ -381,6 +389,8 @@ pluginCore (piArgs *argp)
|
|||||||
|
|
||||||
for (y = sel_y1; y < sel_y2; y++)
|
for (y = sel_y1; y < sel_y2; y++)
|
||||||
{
|
{
|
||||||
|
gint x;
|
||||||
|
|
||||||
if (y % prog_interval == 0)
|
if (y % prog_interval == 0)
|
||||||
gimp_progress_update ((double) y / (double) (sel_y2 - sel_y1));
|
gimp_progress_update ((double) y / (double) (sel_y2 - sel_y1));
|
||||||
|
|
||||||
@ -497,9 +507,11 @@ pluginCore (piArgs *argp)
|
|||||||
pr = gc (pr, argp->mode);
|
pr = gc (pr, argp->mode);
|
||||||
pg = gc (pg, argp->mode);
|
pg = gc (pg, argp->mode);
|
||||||
pb = gc (pb, argp->mode);
|
pb = gc (pb, argp->mode);
|
||||||
py = pr * mode[argp->mode].code[0][0] + pg *
|
|
||||||
mode[argp->mode].code[0][1] + pb *
|
py = pr * mode[argp->mode].code[0][0] +
|
||||||
mode[argp->mode].code[0][2];
|
pg * mode[argp->mode].code[0][1] +
|
||||||
|
pb * mode[argp->mode].code[0][2];
|
||||||
|
|
||||||
r = pix_encode (inv_gc (py + scale * (pr - py),
|
r = pix_encode (inv_gc (py + scale * (pr - py),
|
||||||
argp->mode));
|
argp->mode));
|
||||||
g = pix_encode (inv_gc (py + scale * (pg - py),
|
g = pix_encode (inv_gc (py + scale * (pg - py),
|
||||||
@ -507,10 +519,13 @@ pluginCore (piArgs *argp)
|
|||||||
b = pix_encode (inv_gc (py + scale * (pb - py),
|
b = pix_encode (inv_gc (py + scale * (pb - py),
|
||||||
argp->mode));
|
argp->mode));
|
||||||
}
|
}
|
||||||
|
|
||||||
*d++ = new_r = r;
|
*d++ = new_r = r;
|
||||||
*d++ = new_g = g;
|
*d++ = new_g = g;
|
||||||
*d++ = new_b = b;
|
*d++ = new_b = b;
|
||||||
|
|
||||||
s += 3;
|
s += 3;
|
||||||
|
|
||||||
if (bpp == 4)
|
if (bpp == 4)
|
||||||
*d++ = *s++;
|
*d++ = *s++;
|
||||||
else if (argp->new_layerp)
|
else if (argp->new_layerp)
|
||||||
@ -533,6 +548,7 @@ pluginCore (piArgs *argp)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gimp_pixel_rgn_set_rect (&dstPr, dst, sel_x1, sel_y1, width, height);
|
gimp_pixel_rgn_set_rect (&dstPr, dst, sel_x1, sel_y1, width, height);
|
||||||
|
|
||||||
g_free (src);
|
g_free (src);
|
||||||
@ -552,11 +568,11 @@ pluginCore (piArgs *argp)
|
|||||||
|
|
||||||
gimp_displays_flush ();
|
gimp_displays_flush ();
|
||||||
|
|
||||||
return retval;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint
|
static gboolean
|
||||||
pluginCoreIA (piArgs *argp)
|
plugin_dialog (piArgs *argp)
|
||||||
{
|
{
|
||||||
GtkWidget *dlg;
|
GtkWidget *dlg;
|
||||||
GtkWidget *hbox;
|
GtkWidget *hbox;
|
||||||
@ -632,10 +648,7 @@ pluginCoreIA (piArgs *argp)
|
|||||||
|
|
||||||
gtk_widget_destroy (dlg);
|
gtk_widget_destroy (dlg);
|
||||||
|
|
||||||
if (run)
|
return run;
|
||||||
return pluginCore (argp);
|
|
||||||
else
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Reference in New Issue
Block a user