[Ipe-discuss] Transparency/background color and iperender -png

Martin Lambers marlam at marlam.de
Tue Nov 2 09:10:30 CET 2010


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



More information about the Ipe-discuss mailing list