How to write to a CAIRO_FORMAT_A8 image surface?

Manfred Kogler <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <CAMfrEkjXhUKq+NmfSKid2dxq4tPzTG_KLK1GY496dwA_DNVckg@mail.gmail.com>
Hi,

Currently I am rendering postscript commands using Cairo to a
CAIRO_FORMAT_RGB24 image surface. This image then I have to transfer/map to
the framebuffer of a display device. One pixel in that display framebuffer
is an 8-bit index into a predefined color table. Hence, when transferring
the CAIRO_FORMAT_RGB24 image surface into the 8-bit display framebuffer
each RGB-pixel is mapped to the respective 8-bit color index and this index
value is written to the framebuffer at the respective position. This works
fine, only it is a bit slow since rendering a frame always involves
copying/transferring the whole image into that 8-bit framebuffer.

To get rid of copying/transferring the image I thought of using
cairo_image_surface_create_for_data(frame_buffer, CAIRO_FORMAT_A8, ...). My
plan is to not write an intermediary RGB image anymore but to somehow
directly write the RGB-mapped color-index-table-values to that
A8-byte-buffer. I tried several approaches but could not figure out how to
write one byte (color index) to that CAIRO_FORMAT_A8 image surface and am
not sure whether it is possible at all.

Effectively, my question reduces to the following point:
Is there a way to write (stroke/fill/paint/...) some byte unchanged to a
CAIRO_FORMAT_A8 image surface?

Is there some way to do what I want?

Many thanks and best regards,
Fred

-- 
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.