Re: images with gtk 1.2
- From: Arren <jianling xiang sw-linux com>
- To: Giovanni Manenti <linux euromatic-automazione it>
- Cc: Gtk Mailing List <gtk-app-devel-list gnome org>
- Subject: Re: images with gtk 1.2
- Date: Thu, 07 Apr 2005 09:23:14 +0800
GtkWidget *
image_new_from_file_at_size (const char *filename, gint width, gint height)
{
GtkWidget *image = NULL;
GdkPixbuf *pixbuf;
GError *error;
const gchar *st = "icon_size";
g_return_val_if_fail (filename != NULL, NULL);
error = NULL;
pixbuf = gdk_pixbuf_new_from_file (filename, &error);
if (error != NULL) {
g_warning (G_STRLOC ": cannot open %s: %s",
filename, error->message);
g_error_free (error);
}
if (pixbuf != NULL) {
#if DEBUG
debug (D_STATUS, "pixbuf new from file %s\n", filename);
#endif
GdkPixbuf *scaled = gdk_pixbuf_scale_simple (pixbuf,
width,
height,
GDK_INTERP_BILINEAR);
image = gtk_image_new ();
gtk_image_set_from_pixbuf (GTK_IMAGE (image), scaled);
g_object_unref (G_OBJECT (scaled));
g_object_unref (G_OBJECT (pixbuf));
} else {
#if DEBUG
debug (D_STATUS, "pixbuf new from file %s failed !\n",
filename);
#endif
GtkIconSize icon_size = gtk_icon_size_register (st,
width, height);
image = gtk_image_new_from_stock
(GTK_STOCK_MISSING_IMAGE, icon_size);
}
return image;
}
Giovanni Manenti wrote:
Hi,I'm using gtk 1.2. How I can insert images in my application?
Please send me some examples.
Giovanni
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]