GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Fri Nov 28, 2014 8:32 am

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: change depth bpp in gtk
PostPosted: Thu Apr 04, 2013 6:31 am 
Offline
Familiar Face

Joined: Tue Apr 02, 2013 9:40 am
Posts: 5
Hi All,

I am working on real time screen capture , I am using gtk with some code like:

GdkPixbuf * get_screenshot(){
GdkPixbuf *screenshot;
GdkWindow *root_window;
gint x_orig, y_orig;
gint width, height;
root_window = gdk_get_default_root_window ();
gdk_drawable_get_size (root_window, &width, &height);
gdk_window_get_origin (root_window, &x_orig, &y_orig);

screenshot = gdk_pixbuf_get_from_drawable (NULL, root_window, NULL,
x_orig, y_orig, 0, 0, width, height);
return screenshot;
}

I know that gtk get screen in 24bpp, is there function or way to change screenshot into 16bpp or 8bpp?

Best Regards,
DrCode


Top
 Profile  
 
 Post subject: Re: change depth bpp in gtk
PostPosted: Sun Apr 07, 2013 11:21 pm 
Offline
Never Seen the Sunlight

Joined: Thu Mar 24, 2011 2:10 pm
Posts: 328
Location: Sydney, Australia
GdkPixbuf afaik only supports 8 bits per colour.
If you want other formats, e.g. a 5/6/5 then this looks like it isn't possible in gdk and you would have to delve to lower levels.
In cairo; however, there is a lot more supported formats (in fact you won't actually have a true 24bit packing).
Set up an image surface as CAIRO_FORMAT_RGB16_565 if you want 16 bit colour (haven't seen anything for 8 bit) though you could make a hack with A8 possibly.
http://cairographics.org/manual/cairo-Image-Surfaces.html
Oh and you may want to look into saving the window as a vector graphic (it can often be a much smaller size when in svg)


Top
 Profile  
 
 Post subject: Re: change depth bpp in gtk
PostPosted: Wed Apr 10, 2013 6:02 pm 
Offline
Familiar Face

Joined: Tue Apr 02, 2013 9:40 am
Posts: 5
Hi,

Thank You Again,

Dose cairo have support for real time?

Svg picture format can be set by gtk?

DrCode


Top
 Profile  
 
 Post subject: Re: change depth bpp in gtk
PostPosted: Wed Apr 10, 2013 8:46 pm 
Offline
Never Seen the Sunlight

Joined: Thu Mar 24, 2011 2:10 pm
Posts: 328
Location: Sydney, Australia
Not sure. Don't see how real time real time has anything to do with the rendering itself but how you implement it. It's part of the main gtk stack so will behave as just another part of the whole. Gtk has moved to using cairo in preference to gdk since the latter versions of gtk2.
svg is one of the backends available to cairo. It's in a different header (cairo-svg.h) than the main library so needs to be included separately


Top
 Profile  
 
 Post subject: Re: change depth bpp in gtk
PostPosted: Sun Apr 14, 2013 2:28 pm 
Offline
Familiar Face

Joined: Tue Apr 02, 2013 9:40 am
Posts: 5
Dear Paul,

I am using gdk_drawable_get_image with and image->mem, do I need to use pixbuf for better performance?

how can I convert gdk_drawable_get_image to 8bpp or 16bpp with image->mem?

Thank You again
DrCode


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC


Who is online

Users browsing this forum: Google Adsense [Bot], Yahoo [Bot] and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group