[cairo] CAIRO_FORMAT_A1 image source color

sthustfo sthustfo at gmail.com
Mon Mar 31 05:06:38 PDT 2014


Thanks, the example works perfectly.

However, I have a further query. You mentioned earlier that

>Please note that CAIRO_FORMAT_A1 and CAIRO_FORMAT_A8 are *not* monochrome
>images. They describe images without any colors at all which only contain
an
>alpha channel. Only when generating a PNG are these images interpreted as
>monochrome.

Now suppose I want to get access to the raw A1 (monochrome) data using
cairo_image_surface_get_data(), then this is not possible because as you
mentioned it contains only alpha channel. The interpretation happens during
PNG writing. Is there any way around this? One option I can think of is to
take a look at how cairo_surface_write_to_png() operates on the data (alpha
channel), and similarly implement the same to get access to raw data.

Thanks.



On Sun, Mar 30, 2014 at 5:01 PM, Uli Schlachter <psychon at znc.in> wrote:

> On 29.03.2014 19:48, Uli Schlachter wrote:
> [...]
> > Anyway, attached is a quick example for this.
> [...]
>
> I hate it when this happens. Now with attachment and, just because I can,
> the
> resulting PNG!
>
> Uli
> --
> A learning experience is one of those things that say,
> 'You know that thing you just did? Don't do that.'
>                      -- Douglas Adams
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cairographics.org/archives/cairo/attachments/20140331/fd7d0710/attachment.html>


More information about the cairo mailing list