Re: rendering-cleanup



Hi,

At Mon, 2 Aug 2010 22:14:05 -0400,
Havoc Pennington wrote:
> 
> On Mon, Aug 2, 2010 at 9:21 PM, Yasushi SHOJI <yashi atmark-techno com> wrote:
> > what am I missing? or what should I do to port a RGB565 application to
> > new 3.0 platform?
> >
> 
> What are you doing with the RGB565 data? GdkImage only has three
> operations really: get from drawable, draw to drawable, and manually
> mess with the pixels.

I'm just tring to draw something on screen. to do that, I just get a
GdkImage from a drawable, check GdkVisual to see the format;
visual->depth and visual->red_mask and so on.

if visual seems to be a RGB565, ask a server, renderer or whatever to
send/render the data in RBG565 format, and draw it.  otherwise, get it
in RGB888 format.

> If you want to continue to manually mess with the pixels in RGB565
> format, just use g_malloc() to make yourself a pixel buffer and go for
> it.

Yup.  that's what I want to do.  but don't know how.  Could you
enlighten me a bit?

I assume I can't do the following:

	pixbuf = gdk_pixbuf_get_from_drawable(NULL,window,NULL, ...);
	draw_RGB565_image_to_pixbuf_buffer(gdk_pixbuf_get_pixels(pixbuf));
	cairo_t cr = gdk_cairo_craete(window);
	gdk_cai_set_source_pixbuf(cr, pixbuf, x, y);
	cairo_paint(cr);
	cairo_destroy(cr);

because, cairo and pixbuf assume that data is in RGB888?

> To draw to or from a drawable, the options are probably 1) convert
> to/from an 888 format when rendering or 2) write a bit of Xlib code to
> use XImage directly.
> 
> the best approach probably depends on details of your app and why it's
> using RGB565

it just that my hardware platform does not have a powerful CPU like
desktop nor server.  and if I know that X is RBG565 format, I want to
use the exact same format to save some cpu cycle.

Thanks,
-- 
           yashi


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