Re: Transparency/background color and iperender -png

Martin Lambers <[email protected]>
Newsgroups gmane.comp.graphics.ipe.general
Message-ID <[email protected]>
Hello Otfried!

On 02/11/10 07:57, Otfried Cheong wrote:
>> I would like to generate some PNG icons from IPE files using iperender.
>> However, it seems that iperender always uses some kind of
>> half-transparent background pattern (a mixture of transparent and white
>> pixels).
>>
>> To reproduce, just draw a simple rectangle (stroke only, black), and use
>> iperender -png rectangle.ipe rectangle.png
>>
>> Is there some way to get a completely transparent background?
> 
> I don't understand how you achieved a half-transparent background.  The
> background should be filled with white before drawing anything - and
> I've never seen anything transparent.
> 
> Changing this is a good idea - I'll add a flag -transparent to make the
> background transparent.
> 
> If you can recompile iperender, you can easily achieve this by changing
> the line
> 
>       *p++ = 0xffffffff;
> 
> in iperender.cpp to:
> 
>       *p++ = 0x00ffffff;

Thank you very much for this pointer!

I think the correct value to use is 0x00000000 since cairo uses
pre-multiplied alpha:
http://cairographics.org/manual/cairo-Image-Surfaces.html#cairo-format-t

Using 0x0000000 works perfectly for me, while using 0x00ffffff gives a
transparent background, but still some white in antialiased pixels.

I think a -transparent flag would be very nice, thanks for implementing
this.

I still don't understand why I get a mixture of white and transparent
pixels with the original version (I just double-checked this with Gimp).
Maybe it's a bug in this particular version of cairo...

Best regards
Martin
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.