Re: CAIRO_FORMAT_A1 image source color

sthustfo <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <CAEA28T_hY0S8O2EF9RwWSifUnFhLgTgAj6YmaYc9+eskNQQsVg@mail.gmail.com>
Looking through the cairo source for cairo_surface_write_to_png(), I see
that the surface data is coerced to CAIRO_FORMAT_A8 (using pixmap routine).
But still unable to identify where in png routines, the data is converted
to monochrome? The data returned by cairo_image_surface_get_data() is all
0xff's. Any pointers would be appreciated.

Is there any other way to accomplish this?

Thanks.



On Mon, Mar 31, 2014 at 5:36 PM, sthustfo <[email protected]> wrote:

> 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 <[email protected]> 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
>>
>
>

-- 
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.