98 GtkWidget* button_quit;
99 GtkWidget* button_select_input;
100 GtkWidget* button_select_output;
101 GError** error = NULL;
104 window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
106 hbox1 = gtk_box_new( GTK_ORIENTATION_HORIZONTAL, 10 );
108 vbox1 = gtk_box_new( GTK_ORIENTATION_VERTICAL, 10 );
109 vbox2 = gtk_box_new( GTK_ORIENTATION_VERTICAL, 10 );
111 pCtxt->
pixbuf_input = gdk_pixbuf_new_from_file( image_filename, error );
120 gtk_container_add( GTK_CONTAINER( hbox1 ), pCtxt->
image );
122 gtk_container_add( GTK_CONTAINER( hbox1 ), vbox2 );
124 button_select_input = gtk_button_new_with_label(
"Input" );
125 button_select_output = gtk_button_new_with_label(
"Output" );
127 g_signal_connect( button_select_input,
"clicked",
130 g_signal_connect( button_select_output,
"clicked",
133 gtk_container_add( GTK_CONTAINER( vbox2 ), button_select_input );
134 gtk_container_add( GTK_CONTAINER( vbox2 ), button_select_output );
136 button_quit = gtk_button_new_with_label(
"Quitter" );
138 g_signal_connect( button_quit,
"clicked",
139 G_CALLBACK( gtk_main_quit ),
142 gtk_container_add( GTK_CONTAINER( vbox1 ), hbox1 );
143 gtk_container_add( GTK_CONTAINER( vbox1 ), button_quit );
145 gtk_container_add( GTK_CONTAINER( window ), vbox1 );
148 gtk_widget_show_all( window );
159 int n_channels = gdk_pixbuf_get_n_channels( pixbuf );
160 int has_alpha = gdk_pixbuf_get_has_alpha( pixbuf );
161 int bits_per_sample = gdk_pixbuf_get_bits_per_sample( pixbuf );
162 guchar* data = gdk_pixbuf_get_pixels( pixbuf );
163 int width = gdk_pixbuf_get_width( pixbuf );
164 int height = gdk_pixbuf_get_height( pixbuf );
165 int rowstride = gdk_pixbuf_get_rowstride( pixbuf );
166 printf(
"n_channels = %d\n", n_channels );
167 printf(
"has_alpha = %d\n", has_alpha );
168 printf(
"bits_per_sa= %d\n", bits_per_sample );
169 printf(
"width = %d\n", width );
170 printf(
"height = %d\n", height );
171 printf(
"data = %p\n", (
void*)data );
172 printf(
"rowstride = %d\n", rowstride );
174 printf(
"sizeof(Pixel)=%ld\n",
sizeof(
Pixel) );
175 size_t diff = ((guchar*) (pixel+1)) - (guchar*) pixel;
176 printf(
"(pixel+1) - pixel=%ld\n", diff );
177 assert( n_channels == 3 );
178 assert( has_alpha == FALSE );
179 assert( bits_per_sample == 8 );
180 assert(
sizeof(
Pixel) == 3 );
GdkPixbuf * pixbuf_output