Commit 509b65a5 authored by Manish Singh's avatar Manish Singh Committed by Manish Singh
Browse files

Generate valid names for aux channels that do not have names defined.

2005-08-08  Manish Singh  <yosh@gimp.org>

        * plug-ins/common/psd.c: Generate valid names for aux channels that
        do not have names defined. Fixes bug #312963.
parent cd63b6b7
2005-08-08 Manish Singh <yosh@gimp.org>
* plug-ins/common/psd.c: Generate valid names for aux channels that
do not have names defined. Fixes bug #312963.
2005-08-09 Sven Neumann <sven@gimp.org> 2005-08-09 Sven Neumann <sven@gimp.org>
* app/core/gimplayer.c (gimp_layer_transform_color): take image * app/core/gimplayer.c (gimp_layer_transform_color): take image
......
...@@ -398,6 +398,7 @@ static gchar* getstring(size_t n, FILE * fd, gchar *why); ...@@ -398,6 +398,7 @@ static gchar* getstring(size_t n, FILE * fd, gchar *why);
static void throwchunk(size_t n, FILE * fd, gchar *why); static void throwchunk(size_t n, FILE * fd, gchar *why);
static void dumpchunk(size_t n, FILE * fd, gchar *why); static void dumpchunk(size_t n, FILE * fd, gchar *why);
static void seek_to_and_unpack_pixeldata(FILE* fd, gint layeri, gint channeli); static void seek_to_and_unpack_pixeldata(FILE* fd, gint layeri, gint channeli);
static void validate_aux_channel_name(gint aux_index);
MAIN () MAIN ()
...@@ -1604,6 +1605,19 @@ gboolean psd_layer_has_alpha(PSDlayer* layer) ...@@ -1604,6 +1605,19 @@ gboolean psd_layer_has_alpha(PSDlayer* layer)
return FALSE; return FALSE;
} }
static
void validate_aux_channel_name(gint aux_index)
{
if (psd_image.aux_channel[aux_index].name == NULL)
{
if (aux_index == 0)
psd_image.aux_channel[aux_index].name = g_strdup ("Aux channel");
else
psd_image.aux_channel[aux_index].name =
g_strdup_printf ("Aux channel #%d", aux_index);
}
}
static static
void extract_data_and_channels(guchar* src, gint gimpstep, gint psstep, void extract_data_and_channels(guchar* src, gint gimpstep, gint psstep,
gint32 image_ID, GimpDrawable* drawable, gint32 image_ID, GimpDrawable* drawable,
...@@ -1647,7 +1661,7 @@ void extract_data_and_channels(guchar* src, gint gimpstep, gint psstep, ...@@ -1647,7 +1661,7 @@ void extract_data_and_channels(guchar* src, gint gimpstep, gint psstep,
aux_data = g_malloc (width * height); aux_data = g_malloc (width * height);
{ {
int pix, chan; int pix, chan, aux_index;
gint32 channel_ID; gint32 channel_ID;
GimpDrawable* chdrawable; GimpDrawable* chdrawable;
GimpRGB colour; GimpRGB colour;
...@@ -1660,8 +1674,12 @@ void extract_data_and_channels(guchar* src, gint gimpstep, gint psstep, ...@@ -1660,8 +1674,12 @@ void extract_data_and_channels(guchar* src, gint gimpstep, gint psstep,
{ {
aux_data [pix] = src [pix * psstep + chan]; aux_data [pix] = src [pix * psstep + chan];
} }
aux_index = chan - gimpstep;
validate_aux_channel_name (aux_index);
channel_ID = gimp_channel_new (image_ID, channel_ID = gimp_channel_new (image_ID,
psd_image.aux_channel[chan-gimpstep].name, psd_image.aux_channel[aux_index].name,
width, height, width, height,
100.0, &colour); 100.0, &colour);
gimp_image_add_channel (image_ID, channel_ID, 0); gimp_image_add_channel (image_ID, channel_ID, 0);
...@@ -1703,7 +1721,7 @@ extract_channels(guchar* src, gint num_wanted, gint psstep, ...@@ -1703,7 +1721,7 @@ extract_channels(guchar* src, gint num_wanted, gint psstep,
aux_data = g_malloc(width * height); aux_data = g_malloc(width * height);
{ {
int pix, chan; int pix, chan, aux_index;
gint32 channel_ID; gint32 channel_ID;
GimpDrawable* chdrawable; GimpDrawable* chdrawable;
GimpRGB colour; GimpRGB colour;
...@@ -1717,8 +1735,11 @@ extract_channels(guchar* src, gint num_wanted, gint psstep, ...@@ -1717,8 +1735,11 @@ extract_channels(guchar* src, gint num_wanted, gint psstep,
aux_data [pix] = src [pix * psstep + chan]; aux_data [pix] = src [pix * psstep + chan];
} }
aux_index = chan - (psstep - num_wanted);
validate_aux_channel_name (aux_index);
channel_ID = gimp_channel_new (image_ID, channel_ID = gimp_channel_new (image_ID,
psd_image.aux_channel[chan-(psstep-num_wanted)].name, psd_image.aux_channel[aux_index].name,
width, height, width, height,
100.0, &colour); 100.0, &colour);
gimp_image_add_channel (image_ID, channel_ID, 0); gimp_image_add_channel (image_ID, channel_ID, 0);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment