We are trying to save the pixbuf to an image.
We are facing an issue when we try to save the pixbuf after resizing the window.
Here is the code snippet.
I have also attached the screen shots of the window and the images that gets saved.
_theCanvas= getWidget(GRAPH_CANVAS);// get the GtkDrawingArea from glade XML
gtk_widget_set_app_paintable( _theCanvas, TRUE);
gtk_widget_set_double_buffered( _theCanvas, FALSE);
int canvasWidth= 0;
int canvasHeight= 0;
gdk_drawable_get_size( gtk_widget_get_window( _theCanvas), &canvasWidth, &canvasHeight);
std::cout<<"Height: "<<canvasHeight<<"Width: "<<canvasHeight<<std::endl;
GdkPixbuf *pixbuf= gdk_pixbuf_get_from_drawable( NULL,
0, 0, 0, 0,
GdkPixbuf *rotatedPixbuf= gdk_pixbuf_rotate_simple( pixbuf, GDK_PIXBUF_ROTATE_COUNTERCLOCKWISE);
gdk_pixbuf_save( rotatedPixbuf, "/suhas/png/temp.png", "png", &error, NULL, "100", NULL);
Normal Window without Resizing
File comment: This is a Gtk Window without resizing, I am able to successfully save the image.
normal_window.JPG [ 52.53 KiB | Viewed 224 times ]
This is how the image is saved.This is how we want even when the window is resized.
File comment: This is how the image gets saved.
normal_image.png [ 14.27 KiB | Viewed 224 times ]
Resized Gtk window and the corresponding saved image screen shot
resized.jpg [ 97.48 KiB | Viewed 224 times ]