Re: drawing an RGB bitmap or pixbuf
- From: Andreas Stricker <andreas stricker fela ch>
- To: gtk-app-devel-list gnome org
- Subject: Re: drawing an RGB bitmap or pixbuf
- Date: Tue, 13 Dec 2005 12:57:20 +0100
Matt Hull schrieb:
I am new to gtk and trying to draw a bitmap to the screen. the bitmap is
about 200 by 300 pixels with 8 bit rgb, total is 24 bits. alpha is
optional at the moment.
But important is only that it should be in a file format supported
by GTK (png, xpm, etc.)
for now it is 0xff. i have tried many different
examples from the internet but none seem to work. can anyone give me an
example ? maybe just draw it once to get me started or put it in a timer
loop to be called when idle ?
Not, it's not needed, it redraw itself.
Please have a look at the docs!
Cheers,
Andy
Here a short example without error checking (!).
#include <gtk/gtk.h>
int main(int argc, char *argv[]) {
GtkWidget *w, *p;
gtk_init(&argc, &argv);
w = gtk_window_new(GTK_WINDOW_TOPLEVEL);
g_signal_connect(G_OBJECT(w), "destroy",
G_CALLBACK(gtk_main_quit), NULL);
p = gtk_image_new_from_file("test.png");
gtk_widget_show(GTK_WIDGET(p)); /* dont forget show() */
gtk_container_add(GTK_CONTAINER(w), GTK_WIDGET(p));
gtk_widget_show(GTK_WIDGET(w)); /* dont forget show() */
gtk_main();
return 0;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]