[cairo] How to write to a CAIRO_FORMAT_A8 image surface?
manfred.kogler at gmail.com
Fri Oct 5 07:24:50 PDT 2012
Interesting idea... I've tried to do that in several ways now,
unfortunately without any success. Would you be so kind to sketch up some
lines of code on how this could be done?
On Thu, Oct 4, 2012 at 11:00 PM, Arjen Nienhuis <a.g.nienhuis at gmail.com>wrote:
> Maybe you can create a 1x1 A8 surface, write a byte to the data, and use
> it as a source.
> On Oct 2, 2012 11:33 AM, "Manfred Kogler" <manfred.kogler at gmail.com>
>> 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,
>> cairo mailing list
>> cairo at cairographics.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cairo