Re: Desktop screenshot





On Mon, Apr 26, 2010 at 1:47 PM, Claudio Saavedra <csaavedra gnome org> wrote:
On Mon, 2010-04-26 at 13:37 +0200, Andy Bell wrote:
> Hi,
>
>
> I am trying to get a screenshot of the desktop by using a transparent
> GtkWidget and then using gdk_pixbuf_get_from_drawable.   When I check
> the saved GdkPixbuf I am getting a valid image, but the image does not
> include the background of the desktop but just the GtkWidget itself.
> Is there any way of working around this?

Why not simply doing something like this?

window = gdk_get_default_root_window ();
gdk_drawable_get_size (window, &width, &height);
image = gdk_pixbuf_get_from_drawable (NULL, window,
                                     gdk_drawable_get_colormap(window),
                                     0, 0,
                                     0, 0,
                                     width, height);



I just found that method and it works, thanks for quick reply!!

Andy 


Hi Claudio,

The function worked to get the background of the screen but it isn't the technique I need.  

What I have is a Flash plugin container I have coded which I am using to embed the Flash plugin on Ubuntu Linux.  Everything works great but I want now I want to support a transparent background.  The problem is that the Flash plugin only accepts RGB or 24 bit pixmaps to paint to.  As I want to support transparency in the GTK application I have been forced to just replace a color with Alpha using gdk_pixbuf_add_alpha.  I had thought what I could do is just get the background of the GtkWidget and then paint this to the GtkPixmap and then pass this to the plugin to paint on top.  This seems to be a waste as I am copying from the server side to the client side and then back to the server side, isn't there a better way to do this?

Thanks, Andy


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]