Re: drawing a png, honoring transparency



On Wed, 2005-01-26 at 17:40 +0100, Akos Maroy wrote:
> Hi,
> 
> I'm trying to draw a PNG image, which has some transparent parts, by 
> calling Gdk::Pixbuf::render_to_drawable().
> 
> The documentation of this function says that this call will not honor 
> transparency, or that's how I understand the following:
> 
> 
> "Note that this function will ignore the opacity information for images 
> with an alpha channel; the GC must already have the clipping mask set if 
> you want transparent regions to show through."
> 
> 
> now, how would I generate the clipping mask for a transparent PNG image? 
> I see functions like Gdk::Pixbuf::render_pixmap_and_mask(), but I just 
> don't know how to use them.. (and there's no documentation for them 
> either :(

Gdk::Pixbuf::render_to_drawable_alpha(...) has a parameter that lets you
set the threshold for the alpha.  Basically your only option is on/off,
no alpha blending-ish rendering is supported ATM.

Basically render_to_drawable_alpha uses the threshold and the alpha
channel to create the GC clipping mask, then renders using that, I
believe.

Regards,
Carl




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]