Re: How to write to a CAIRO_FORMAT_A8 image surface?
Arjen Nienhuis <[email protected]>
| Newsgroups | gmane.comp.lib.cairo |
|---|---|
| Message-ID | <CAG6W84KiZtrQr9KCMwGmYCDkTrRkXKCG7ioYJrJJBRkxX--EiQ@mail.gmail.com> |
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" <[email protected]> wrote: > 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 > -- cairo mailing list [email protected] http://lists.cairographics.org/mailman/listinfo/cairo