Index: layersel/layersel.c =================================================================== --- layersel/layersel.c (revision 8484) +++ layersel/layersel.c (revision 8485) @@ -64,6 +64,47 @@ return image; } +static +GtkWidget *test_pixbuf_pixel_manipulated() +{ + GdkPixbuf *pixbuf; + GtkWidget *image; + gint width, height; + guchar *pixels; + guint32 color = 0x00ff00ff; /* Green */ + guint r, g, b, a; + guint w, h; + guchar *p; + + pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, 16, 16); + width = gdk_pixbuf_get_width(pixbuf); /* 16 here, obviously */ + height = gdk_pixbuf_get_height(pixbuf); + pixels = gdk_pixbuf_get_pixels(pixbuf); + /* Fill the whole rectangle with color */ + r = (color & 0xff000000) >> 24; + g = (color & 0x00ff0000) >> 16; + b = (color & 0x0000ff00) >> 8; + a = (color & 0x000000ff); + + while (height--) { + w = width; + p = pixels; + while (w--) { + p[0] = r; + p[1] = g; + p[2] = b; + p[3] = a; + p += 4; + } + pixels += gdk_pixbuf_get_rowstride(pixbuf); + } + + image = gtk_image_new_from_pixbuf(pixbuf); + g_object_unref(pixbuf); + + return image; +} + /** Main widget building function */ GtkWidget *pcb_gtk_layersel_build(GtkWidget * mainwin) { @@ -76,6 +117,9 @@ gtk_box_pack_start(GTK_BOX(box), label, FALSE, FALSE, 0); image = test_gdk_pixbuf_fill(); gtk_box_pack_start(GTK_BOX(box), image, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(box), gtk_vseparator_new(), FALSE, FALSE, 2); + image = test_pixbuf_pixel_manipulated(); + gtk_box_pack_start(GTK_BOX(box), image, FALSE, FALSE, 0); gtk_container_add(GTK_CONTAINER(mainwin), box); gtk_widget_show_all(mainwin);