tools/pdbgen/pdb/drawable.pdb raised the maximum size for thumbnails from
2004-06-30 Sven Neumann <sven@gimp.org> * tools/pdbgen/pdb/drawable.pdb * libgimp/gimppixbuf.c: raised the maximum size for thumbnails from 256 to 512 pixels. * app/pdb/drawable_cmds.c * libgimp/gimpdrawable_pdb.c: regenerated. * plug-ins/gfig/gfig-preview.c * plug-ins/gfig/gfig.c: redone Bill's fix using gimp_image_get_thumbnail(). A lot simpler, renders the alpha checkerboard and also works for grayscale images.
This commit is contained in:
committed by
Sven Neumann
parent
4022980314
commit
adab09fd45
14
ChangeLog
14
ChangeLog
@ -1,3 +1,17 @@
|
||||
2004-06-30 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* tools/pdbgen/pdb/drawable.pdb
|
||||
* libgimp/gimppixbuf.c: raised the maximum size for thumbnails
|
||||
from 256 to 512 pixels.
|
||||
|
||||
* app/pdb/drawable_cmds.c
|
||||
* libgimp/gimpdrawable_pdb.c: regenerated.
|
||||
|
||||
* plug-ins/gfig/gfig-preview.c
|
||||
* plug-ins/gfig/gfig.c: redone Bill's fix using
|
||||
gimp_image_get_thumbnail(). A lot simpler, renders the alpha
|
||||
checkerboard and also works for grayscale images.
|
||||
|
||||
2004-06-30 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
Fixed a 1.2 -> 2.0 regression that was forgotten:
|
||||
|
||||
@ -2021,11 +2021,11 @@ drawable_thumbnail_invoker (Gimp *gimp,
|
||||
success = FALSE;
|
||||
|
||||
req_width = args[1].value.pdb_int;
|
||||
if (req_width <= 0 || req_width > 256)
|
||||
if (req_width <= 0 || req_width > 512)
|
||||
success = FALSE;
|
||||
|
||||
req_height = args[2].value.pdb_int;
|
||||
if (req_height <= 0 || req_height > 256)
|
||||
if (req_height <= 0 || req_height > 512)
|
||||
success = FALSE;
|
||||
|
||||
if (success)
|
||||
@ -2134,7 +2134,7 @@ static ProcRecord drawable_thumbnail_proc =
|
||||
{
|
||||
"gimp_drawable_thumbnail",
|
||||
"Get a thumbnail of a drawable.",
|
||||
"This function gets data from which a thumbnail of a drawable preview can be created. Maximum x or y dimension is 256 pixels. The pixels are returned in the RGB[A] format. The bpp return value gives the number of bytes in the image. The alpha channel is also returned if the drawable has one.",
|
||||
"This function gets data from which a thumbnail of a drawable preview can be created. Maximum x or y dimension is 512 pixels. The pixels are returned in the RGB[A] format. The bpp return value gives the number of bytes in the image. The alpha channel is also returned if the drawable has one.",
|
||||
"Andy Thomas",
|
||||
"Andy Thomas",
|
||||
"1999",
|
||||
|
||||
@ -1117,7 +1117,7 @@ gimp_drawable_offset (gint32 drawable_ID,
|
||||
* Get a thumbnail of a drawable.
|
||||
*
|
||||
* This function gets data from which a thumbnail of a drawable preview
|
||||
* can be created. Maximum x or y dimension is 256 pixels. The pixels
|
||||
* can be created. Maximum x or y dimension is 512 pixels. The pixels
|
||||
* are returned in the RGB[A] format. The bpp return value gives the
|
||||
* number of bytes in the image. The alpha channel is also returned if
|
||||
* the drawable has one.
|
||||
|
||||
@ -39,8 +39,8 @@ static GdkPixbuf * gimp_pixbuf_from_data (guchar *data,
|
||||
/**
|
||||
* gimp_image_get_thumbnail:
|
||||
* @image_ID: the image ID
|
||||
* @width: the requested thumbnail width (<= 256 pixels)
|
||||
* @height: the requested thumbnail height (<= 256 pixels)
|
||||
* @width: the requested thumbnail width (<= 512 pixels)
|
||||
* @height: the requested thumbnail height (<= 512 pixels)
|
||||
* @alpha: how to handle an alpha channel
|
||||
*
|
||||
* Retrieves a thumbnail pixbuf for the image identified by @image_ID.
|
||||
@ -62,8 +62,8 @@ gimp_image_get_thumbnail (gint32 image_ID,
|
||||
gint data_size;
|
||||
guchar *data;
|
||||
|
||||
g_return_val_if_fail (width > 0 && width <= 256, NULL);
|
||||
g_return_val_if_fail (height > 0 && height <= 256, NULL);
|
||||
g_return_val_if_fail (width > 0 && width <= 512, NULL);
|
||||
g_return_val_if_fail (height > 0 && height <= 512, NULL);
|
||||
|
||||
if (! _gimp_image_thumbnail (image_ID,
|
||||
width, height,
|
||||
@ -82,8 +82,8 @@ gimp_image_get_thumbnail (gint32 image_ID,
|
||||
/**
|
||||
* gimp_drawable_get_thumbnail:
|
||||
* @drawable_ID: the drawable ID
|
||||
* @width: the requested thumbnail width (<= 256 pixels)
|
||||
* @height: the requested thumbnail height (<= 256 pixels)
|
||||
* @width: the requested thumbnail width (<= 512 pixels)
|
||||
* @height: the requested thumbnail height (<= 512 pixels)
|
||||
* @alpha: how to handle an alpha channel
|
||||
*
|
||||
* Retrieves a thumbnail pixbuf for the drawable identified by
|
||||
@ -106,8 +106,8 @@ gimp_drawable_get_thumbnail (gint32 drawable_ID,
|
||||
gint data_size;
|
||||
guchar *data;
|
||||
|
||||
g_return_val_if_fail (width > 0 && width <= 256, NULL);
|
||||
g_return_val_if_fail (height > 0 && height <= 256, NULL);
|
||||
g_return_val_if_fail (width > 0 && width <= 512, NULL);
|
||||
g_return_val_if_fail (height > 0 && height <= 512, NULL);
|
||||
|
||||
if (! _gimp_drawable_thumbnail (drawable_ID,
|
||||
width, height,
|
||||
|
||||
@ -341,12 +341,22 @@ gfig_preview_realize (GtkWidget *widget)
|
||||
}
|
||||
|
||||
static void
|
||||
draw_background ()
|
||||
draw_background (void)
|
||||
{
|
||||
if (back_pixbuf)
|
||||
gdk_draw_pixbuf (gfig_preview->window,
|
||||
static GdkPixbuf *pixbuf = NULL;
|
||||
|
||||
if (! pixbuf)
|
||||
pixbuf = gimp_image_get_thumbnail (gfig_image,
|
||||
preview_width, preview_height,
|
||||
GIMP_PIXBUF_LARGE_CHECKS);
|
||||
|
||||
if (pixbuf)
|
||||
gdk_draw_pixbuf (gfig_preview->window,
|
||||
gfig_preview->style->fg_gc[GTK_STATE_NORMAL],
|
||||
back_pixbuf, 0, 0, 0, 0, -1, -1,
|
||||
pixbuf, 0, 0,
|
||||
0, 0,
|
||||
gdk_pixbuf_get_width (pixbuf),
|
||||
gdk_pixbuf_get_height (pixbuf),
|
||||
GDK_RGB_DITHER_NONE, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
@ -313,16 +313,15 @@ static void brush_list_button_callback (BrushDesc *bdesc);
|
||||
|
||||
/* globals */
|
||||
|
||||
static gint gfig_run;
|
||||
GdkGC *gfig_gc;
|
||||
static gint gfig_run;
|
||||
GdkGC *gfig_gc;
|
||||
|
||||
/* Stuff for the preview bit */
|
||||
static gint sel_x1, sel_y1, sel_x2, sel_y2;
|
||||
static gint sel_width, sel_height;
|
||||
gint preview_width, preview_height;
|
||||
gdouble scale_x_factor, scale_y_factor;
|
||||
GdkPixbuf *back_pixbuf = NULL;
|
||||
static gdouble org_scale_x_factor, org_scale_y_factor;
|
||||
static gint sel_x1, sel_y1, sel_x2, sel_y2;
|
||||
static gint sel_width, sel_height;
|
||||
gint preview_width, preview_height;
|
||||
gdouble scale_x_factor, scale_y_factor;
|
||||
static gdouble org_scale_x_factor, org_scale_y_factor;
|
||||
|
||||
MAIN ()
|
||||
|
||||
@ -406,7 +405,7 @@ run (const gchar *name,
|
||||
pheight = MIN (sel_height, PREVIEW_SIZE);
|
||||
pwidth = sel_width * pheight / sel_height;
|
||||
}
|
||||
|
||||
|
||||
|
||||
preview_width = MAX (pwidth, 2); /* Min size is 2 */
|
||||
preview_height = MAX (pheight, 2);
|
||||
@ -2878,30 +2877,9 @@ gfig_dialog (void)
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *notebook;
|
||||
GtkWidget *page;
|
||||
gint tmpwidth, tmpheight;
|
||||
gint bpp, rowstride;
|
||||
guchar *back_data;
|
||||
|
||||
gimp_ui_init ("gfig", TRUE);
|
||||
|
||||
tmpwidth = preview_width;
|
||||
tmpheight = preview_height;
|
||||
|
||||
back_data = gimp_image_get_thumbnail_data (gfig_image,
|
||||
&tmpwidth, &tmpheight, &bpp);
|
||||
|
||||
rowstride = tmpwidth * bpp;
|
||||
|
||||
/* we only handle RGB because GdkPixbuf doesn't do grayscale */
|
||||
if (bpp == 3)
|
||||
back_pixbuf = gdk_pixbuf_new_from_data (back_data, GDK_COLORSPACE_RGB, FALSE,
|
||||
8, tmpwidth, tmpheight, rowstride,
|
||||
NULL, NULL);
|
||||
else if (bpp == 4)
|
||||
back_pixbuf = gdk_pixbuf_new_from_data (back_data, GDK_COLORSPACE_RGB, TRUE,
|
||||
8, tmpwidth, tmpheight, rowstride,
|
||||
NULL, NULL);
|
||||
|
||||
gfig_stock_init ();
|
||||
|
||||
gfig_path = gimp_gimprc_query ("gfig-path");
|
||||
|
||||
@ -565,7 +565,7 @@ sub drawable_thumbnail {
|
||||
|
||||
$help = <<'HELP';
|
||||
This function gets data from which a thumbnail of a drawable preview can be
|
||||
created. Maximum x or y dimension is 256 pixels. The pixels are returned
|
||||
created. Maximum x or y dimension is 512 pixels. The pixels are returned
|
||||
in the RGB[A] format. The bpp return value gives the number of bytes in
|
||||
the image. The alpha channel is also returned if the drawable has one.
|
||||
HELP
|
||||
@ -575,9 +575,9 @@ HELP
|
||||
|
||||
@inargs = (
|
||||
&drawable_arg,
|
||||
{ name => 'width', type => '0 < int32 <= 256',
|
||||
{ name => 'width', type => '0 < int32 <= 512',
|
||||
desc => 'The thumbnail width', alias => 'req_width' },
|
||||
{ name => 'height', type => '0 < int32 <= 256',
|
||||
{ name => 'height', type => '0 < int32 <= 512',
|
||||
desc => 'The thumbnail height', alias => 'req_height' }
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user