app/pdb/fileops_cmds.c this change should fix file_load_thumbnail() for

2003-05-16  Sven Neumann  <sven@gimp.org>

	* app/pdb/fileops_cmds.c
	* tools/pdbgen/pdb/fileops.pdb: this change should fix
	file_load_thumbnail() for images with alpha channel by blending
	the resulting tempbuf on a checkerboard (bug #113033).
This commit is contained in:
Sven Neumann 2003-05-15 22:05:37 +00:00 committed by Sven Neumann
parent 6a4e950198
commit 6d347d385a
3 changed files with 139 additions and 20 deletions

View File

@ -1,3 +1,58 @@
2003-05-16 Sven Neumann <sven@gimp.org>
* app/pdb/fileops_cmds.c
* tools/pdbgen/pdb/fileops.pdb: this change should fix
file_load_thumbnail() for images with alpha channel by blending
the resulting tempbuf on a checkerboard (bug #113033).
2003-05-15 Michael Natterer <mitch@gimp.org>
* tools/pdbgen/app.pl (declare_args): removed generation of
includes for enums since including "pdb-types.h" is sufficient
now.
* app/pdb/brush_select_cmds.c
* app/pdb/brushes_cmds.c
* app/pdb/channel_cmds.c
* app/pdb/color_cmds.c
* app/pdb/convert_cmds.c
* app/pdb/drawable_cmds.c
* app/pdb/edit_cmds.c
* app/pdb/guides_cmds.c
* app/pdb/image_cmds.c
* app/pdb/layer_cmds.c
* app/pdb/message_cmds.c
* app/pdb/misc_tools_cmds.c
* app/pdb/paint_tools_cmds.c
* app/pdb/procedural_db_cmds.c
* app/pdb/selection_cmds.c
* app/pdb/selection_tools_cmds.c
* app/pdb/text_tool_cmds.c
* app/pdb/transform_tools_cmds.c: regenerated.
2003-05-15 Michael Natterer <mitch@gimp.org>
* tools/pdbgen/pdb/paths.pdb: removed PDB access to the old paths
and ported everything to GimpVectors. Note that everything except
gimp_path_set_points() is untested and that
gimp_path_get_point_at_dist() is currently unimplemented. Changed
order of the generated functions and fixed some help texts.
* tools/pdbgen/app.pl: removed $tools_eek and $paint_eek hacks
because pdb/ doesn't include stuff from tools/ any more and paint/
no longer depends on GTK+.
* app/pdb/paint_tools_cmds.c
* app/pdb/paths_cmds.c
* libgimp/gimppaths_pdb.[ch]: regenerated.
2003-05-15 Sven Neumann <sven@gimp.org>
* app/core/gimpdrawable-transform.c
(gimp_drawable_transform_tiles_affine): fixed typo: use x1 instead
of the uninitialized variable x.
2003-05-15 Michael Natterer <mitch@gimp.org>
* tools/pdbgen/app.pl (declare_args): removed generation of

View File

@ -248,18 +248,50 @@ file_load_thumbnail_invoker (Gimp *gimp,
g_object_unref (imagefile);
}
if (temp_buf && temp_buf->bytes != 3)
{
g_warning ("FIXME: handle thumbnails with bpp != 3");
temp_buf_free (temp_buf);
temp_buf = NULL;
}
if (temp_buf)
{
width = temp_buf->width;
height = temp_buf->height;
width = temp_buf->width;
height = temp_buf->height;
switch (temp_buf->bytes)
{
case 3:
break;
case 4:
{
#define INT_MULT(a,b,t) ((t) = (a) * (b) + 0x80, ((((t) >> 8) + (t)) >> 8))
#define INT_BLEND(a,b,alpha,t) (INT_MULT((a)-(b), alpha, t) + (b))
TempBuf *checks = temp_buf_new_check (width, height,
GIMP_SMALL_CHECKS,
GIMP_GRAY_CHECKS);
guchar *src = temp_buf_data (temp_buf);
guchar *dest = temp_buf_data (checks);
num_bytes = width * height;
while (num_bytes--)
{
register glong t;
dest[0] = INT_BLEND (src[0] , dest[0] , src[3], t);
dest[1] = INT_BLEND (src[1] , dest[1] , src[3], t);
dest[2] = INT_BLEND (src[2] , dest[2] , src[3], t);
src += 4;
dest += 3;
}
temp_buf_free (temp_buf);
temp_buf = checks;
}
break;
default:
g_assert_not_reached ();
break;
}
num_bytes = 3 * width * height;
thumb_data = g_memdup (temp_buf_data (temp_buf), num_bytes);

View File

@ -207,18 +207,50 @@ HELP
g_object_unref (imagefile);
}
if (temp_buf && temp_buf->bytes != 3)
{
g_warning ("FIXME: handle thumbnails with bpp != 3");
temp_buf_free (temp_buf);
temp_buf = NULL;
}
if (temp_buf)
{
width = temp_buf->width;
height = temp_buf->height;
width = temp_buf->width;
height = temp_buf->height;
switch (temp_buf->bytes)
{
case 3:
break;
case 4:
{
#define INT_MULT(a,b,t) ((t) = (a) * (b) + 0x80, ((((t) >> 8) + (t)) >> 8))
#define INT_BLEND(a,b,alpha,t) (INT_MULT((a)-(b), alpha, t) + (b))
TempBuf *checks = temp_buf_new_check (width, height,
GIMP_SMALL_CHECKS,
GIMP_GRAY_CHECKS);
guchar *src = temp_buf_data (temp_buf);
guchar *dest = temp_buf_data (checks);
num_bytes = width * height;
while (num_bytes--)
{
register glong t;
dest[0] = INT_BLEND (src[0] , dest[0] , src[3], t);
dest[1] = INT_BLEND (src[1] , dest[1] , src[3], t);
dest[2] = INT_BLEND (src[2] , dest[2] , src[3], t);
src += 4;
dest += 3;
}
temp_buf_free (temp_buf);
temp_buf = checks;
}
break;
default:
g_assert_not_reached ();
break;
}
num_bytes = 3 * width * height;
thumb_data = g_memdup (temp_buf_data (temp_buf), num_bytes);