[Pixman] Help Needed: To draw an image with soft-mask

Søren Sandmann sandmann at cs.au.dk
Thu May 24 13:50:39 PDT 2012


balbir kumar <balbir.kumar.cs at gmail.com> writes:

> Hi All,
>
>     I am trying to draw an image [Ht: 576, Wt: 575, DeviceRGB, Data...] with
> an 
>     image-soft-mask [Ht: 576, Wt: 575, DeviceGray, Data...]. So, far I am
> unable 
>     to figure out how to use pixman to do it. Could someone please give me
> some 
>     pointers? Actually I want to make a cairo_image_surface as a result of
> applying
>     this soft-mask on source-image.

You are not giving a lot of detail, but applying a mask to a pixman
image, and then storing the result in some other image can be done like
this:

    pixman_image_composite32 (PIXMAN_OP_SRC, source, mask, destination,
                              0, 0, 0, 0, 0, 0, width, height);

where source is the source image, mask is the soft-mask you want to use,
and destination is the image where you want to store the result.

If DeviceGray is an 8-bit alpha mask, you will want to use PIXMAN_a8 as
the format.


Søren


More information about the Pixman mailing list