Issue with Cairo mask function in a Gtk Window

Hi !
I’m trying to do smth a little tricky that is explain only in one
tutorial I found on the net (and it’s a C tuto) It’s to use a pixbuf, or
eventually a png file as a mask. All seems to work well, except the last
line.

If I use
mask = Cairo::ImageSurface.from_png(“my image_filepath.png”)
cr.mask_surface(mask, x, y).
The interpreter said there is no mask_surface method for Cairo::Context
object.

If I use
mask = Cairo::ImageSurface.from_png(“my image_filepath.png”)
cr.mask(mask)
It says that mask is not a Cairo pattern. And it’s the same when I tried
all I could have imagined to set the mask from a pixbuf.

So has anyone an idea of how I can solve this problem ?
I attach my code to the message if it could be of any help.

Hi,

In [email protected]
“[ruby-gnome2-devel-en] issue with Cairo mask function in a Gtk
Window” on Sat, 12 Oct 2013 13:50:48 +0200,
“67Daidalos …” [email protected] wrote:

If I use
mask = Cairo::ImageSurface.from_png(“my image_filepath.png”)
cr.mask_surface(mask, x, y).
The interpreter said there is no mask_surface method for Cairo::Context
object.

Try:

cr.mask(mask, x, y)

Cairo::Context#mask accepts both pattern and surface.

Thanks,

kou

Kouhei S. wrote in post #1124423:

Try:

cr.mask(mask, x, y)

Cairo::Context#mask accepts both pattern and surface.

Thanks,

kou

Thank you ! It works great !

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs