hopefully fixed gimp_file_load_thumbnail PDB function

--Sven
This commit is contained in:
Sven Neumann 2000-01-18 21:39:03 +00:00
parent cc58abd365
commit c961fdd870
7 changed files with 53 additions and 27 deletions

View File

@ -1,3 +1,17 @@
Tue Jan 18 22:34:30 CET 2000 Sven Neumann <sven@gimp.org>
* app/fileops_cmds.c
* tools/pdbgen/pdb/fileops.pdb: hopefully fixed
gimp_file_load_thumbnail () PDB function
* app/gimage_cmds.c
* tools/pdbgen/pdb/gimage.pdb: in gimp_image_get_thumbnail changed
a variable name from num_pixels to num_bytes, since that`s what it
contains
* tools/pdbgen/pdbgen.pl: arrays need a length argument again since
the PDB relies on it
Tue Jan 18 21:46:25 CET 2000 Sven Neumann <sven@gimp.org>
* plug-ins/common/gauss_iir.c

View File

@ -201,6 +201,7 @@ file_load_thumbnail_invoker (Argument *args)
gchar *filename;
gint32 width = 0;
gint32 height = 0;
gint32 num_bytes = 0;
guint8 *thumb_data = NULL;
gchar *pname;
gchar *fname;
@ -226,7 +227,8 @@ file_load_thumbnail_invoker (Argument *args)
if (raw_thumb)
{
thumb_data = g_malloc (3 * width * height);
num_bytes = 3 * width * height;
thumb_data = g_malloc (num_bytes);
for (i=0; i<width*height; i++)
{
@ -247,7 +249,8 @@ file_load_thumbnail_invoker (Argument *args)
{
return_args[1].value.pdb_int = width;
return_args[2].value.pdb_int = height;
return_args[3].value.pdb_pointer = thumb_data;
return_args[3].value.pdb_int = num_bytes;
return_args[4].value.pdb_pointer = thumb_data;
}
return return_args;
@ -274,6 +277,11 @@ static ProcArg file_load_thumbnail_outargs[] =
"height",
"The height of the thumbnail"
},
{
PDB_INT32,
"thumbnail_data_count",
"The number of bytes in thumbnail data"
},
{
PDB_INT8ARRAY,
"thumb_data",
@ -288,11 +296,11 @@ static ProcRecord file_load_thumbnail_proc =
"This procedure tries to load a thumbnail that belongs to the file with the given filename. This name is a full pathname. The returned data is an array of colordepth 3 (RGB), regardless of the image type. Width and height of the thumbnail are also returned. Don't use this function if you need a thumbnail of an already opened image, use gimp_image_thumbnail instead.",
"Adam D. Moss, Sven Neumann",
"Adam D. Moss, Sven Neumann",
"1999",
"1999-2000",
PDB_INTERNAL,
1,
file_load_thumbnail_inargs,
3,
4,
file_load_thumbnail_outargs,
{ { file_load_thumbnail_invoker } }
};

View File

@ -2369,7 +2369,7 @@ image_thumbnail_invoker (Argument *args)
gint32 width = 0;
gint32 height = 0;
gint32 bpp = 0;
gint32 num_pixels = 0;
gint32 num_bytes = 0;
guint8 *thumbnail_data = NULL;
gimage = pdb_id_to_image (args[0].value.pdb_int);
@ -2403,13 +2403,13 @@ image_thumbnail_invoker (Argument *args)
buf = gimp_image_construct_composite_preview (gimage,
req_width,
req_height);
num_pixels = buf->height * buf->width * buf->bytes;
thumbnail_data = g_new (guint8, num_pixels);
g_memmove (thumbnail_data, temp_buf_data (buf), num_pixels);
num_bytes = buf->height * buf->width * buf->bytes;
thumbnail_data = g_new (guint8, num_bytes);
g_memmove (thumbnail_data, temp_buf_data (buf), num_bytes);
width = buf->width;
height = buf->height;
bpp = buf->bytes;
temp_buf_free(buf);
temp_buf_free (buf);
}
}
@ -2420,7 +2420,7 @@ image_thumbnail_invoker (Argument *args)
return_args[1].value.pdb_int = width;
return_args[2].value.pdb_int = height;
return_args[3].value.pdb_int = bpp;
return_args[4].value.pdb_int = num_pixels;
return_args[4].value.pdb_int = num_bytes;
return_args[5].value.pdb_pointer = thumbnail_data;
}
@ -2466,7 +2466,7 @@ static ProcArg image_thumbnail_outargs[] =
{
PDB_INT32,
"thumbnail_data_count",
"The number of pixels in thumbnail data"
"The number of bytes in thumbnail data"
},
{
PDB_INT8ARRAY,

View File

@ -167,7 +167,7 @@ instead.
HELP
$author = $copyright = 'Adam D. Moss, Sven Neumann';
$date = '1999';
$date = '1999-2000';
@inargs = (
{ name => 'filename', type => 'string',
@ -180,7 +180,10 @@ HELP
{ name => 'height', type => 'int32', init => 1,
desc => 'The height of the thumbnail' },
{ name => 'thumb_data', type => 'int8array', init => 1,
desc => 'The thumbnail data', array => undef },
desc => 'The thumbnail data',
array => { name => 'thumbnail_data_count',
desc => 'The number of bytes in thumbnail data',
alias => 'num_bytes', init => 1 } },
);
%invoke = (
@ -200,7 +203,8 @@ HELP
if (raw_thumb)
{
thumb_data = g_malloc (3 * width * height);
num_bytes = 3 * width * height;
thumb_data = g_malloc (num_bytes);
for (i=0; i<width*height; i++)
{

View File

@ -1296,8 +1296,8 @@ HELP
{ name => 'thumbnail_data', type => 'int8array',
desc => 'The thumbnail data', init => 1,
array => { name => 'thumbnail_data_count',
desc => 'The number of pixels in thumbnail data',
alias => 'num_pixels', init => 1 } }
desc => 'The number of bytes in thumbnail data',
alias => 'num_bytes', init => 1 } }
);
%invoke = (
@ -1321,13 +1321,13 @@ HELP
buf = gimp_image_construct_composite_preview (gimage,
req_width,
req_height);
num_pixels = buf->height * buf->width * buf->bytes;
thumbnail_data = g_new (guint8, num_pixels);
g_memmove (thumbnail_data, temp_buf_data (buf), num_pixels);
num_bytes = buf->height * buf->width * buf->bytes;
thumbnail_data = g_new (guint8, num_bytes);
g_memmove (thumbnail_data, temp_buf_data (buf), num_bytes);
width = buf->width;
height = buf->height;
bpp = buf->bytes;
temp_buf_free(buf);
temp_buf_free (buf);
}
}
CODE

View File

@ -1296,8 +1296,8 @@ HELP
{ name => 'thumbnail_data', type => 'int8array',
desc => 'The thumbnail data', init => 1,
array => { name => 'thumbnail_data_count',
desc => 'The number of pixels in thumbnail data',
alias => 'num_pixels', init => 1 } }
desc => 'The number of bytes in thumbnail data',
alias => 'num_bytes', init => 1 } }
);
%invoke = (
@ -1321,13 +1321,13 @@ HELP
buf = gimp_image_construct_composite_preview (gimage,
req_width,
req_height);
num_pixels = buf->height * buf->width * buf->bytes;
thumbnail_data = g_new (guint8, num_pixels);
g_memmove (thumbnail_data, temp_buf_data (buf), num_pixels);
num_bytes = buf->height * buf->width * buf->bytes;
thumbnail_data = g_new (guint8, num_bytes);
g_memmove (thumbnail_data, temp_buf_data (buf), num_bytes);
width = buf->width;
height = buf->height;
bpp = buf->bytes;
temp_buf_free(buf);
temp_buf_free (buf);
}
}
CODE

View File

@ -156,7 +156,7 @@ sub arrayexpand {
my $newargs;
foreach (@$$args) {
if (exists $_->{array} && defined $_->{array}) {
if (exists $_->{array}) {
my $arg = $_->{array};
$arg->{name} = 'num_' . $_->{name} unless exists $arg->{name};