Re: Displaying bmp/jpg Images
- From: MALHERBE <malherbe hugues wanadoo fr>
- To: RTD RTD <d_ravu hotmail com>
- Cc: gtk-list gnome org, gtk-app-devel-list gnome org
- Subject: Re: Displaying bmp/jpg Images
- Date: Sat, 03 May 2003 12:43:30 +0200
Here is a small code that shows how to display a jpeg file in a window.
include <gtk/gtk.h>
/* when invoked (via signal delete_event), terminates the application.
*/
gint close_application( GtkWidget *widget,
GdkEvent *event,
gpointer data )
{
gtk_main_quit ();
return FALSE;
}
int main( int argc,
char *argv[] )
{
/* GtkWidget is the storage type for widgets */
GtkWidget *window;
GtkWidget *image;
GtkWidget *hbox;
/* create the main window, and attach delete_event signal to terminating
the application */
gtk_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
g_signal_connect (G_OBJECT (window), "delete_event",
G_CALLBACK (close_application), NULL);
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
gtk_widget_show (window);
image = gtk_image_new_from_file ("image.jpg");
hbox = gtk_hbox_new(TRUE,10);
gtk_container_add (GTK_CONTAINER (hbox), image);
gtk_container_add (GTK_CONTAINER (window), hbox);
gtk_widget_show (hbox);
gtk_widget_show (image);
gtk_main ();
return 0;
}
I hope it can help you.
Hugues.
RTD RTD wrote:
Hello,
I'm quite new to glade and this may be a stupid question, but I searched
anything I could find and did´t find an answer:
I have a picture from a frame grabber and want to display it. How do
I do this?
I tried quite a lot but the only thing I managed to do was displaying
a gdk-bitmap generated with gdk_image_new_bitmap() with gtk_set_image()
in a GtkImage widget. But since a bitmap is just black and white this
was not quite what I wanted. All the other things I tried like the
draw and rgb functions required a Gdk-graphics-context I didn't know
where to get from.
Can anyone tell me how to solve this or point me where I find a solution?
Ravindra T. Dolas,
Pune-INDIA
_________________________________________________________________
Hot picks. Free downloads. http://www.msn.co.in/musicnew/musicshop
Visit music shop
_______________________________________________
gtk-list mailing list
gtk-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]