Shape Combine Mask

I posted something a while back about custom shaped windows. now i know
how to do it sort of. i can make a custom shaped window by using
shape_combine_region on a Gdk::Window. problem is, that method is very
tedious, it basically has me plotting several points on the widow grid
to make a custom shape i want, here is the example:

require 'gtk2' require 'win32/sound' include Win32 include Gtk

region =[[0, 0], [100, 50], [400, 50], [450, 0], [400,
[400, 700], [450, 800], [400, 750], [50, 750], [0, 800], [50, 700],
[50, 100]], Gdk::Region::WINDING_RULE)
attribute =, 800, Gdk::Window::INPUT_OUTPUT,
window =, attribute, Gdk::Window::WA_TITLE)
window.shape_combine_region(region, 5, 5)


this works fine, (if anyone runs this, i know the shape is still funny
looking, im still playing with it.)

but i would like to use an image as the shape, there is a function to do
so by using shape_combine_mask on the Gdk::Window. but it calls for a
bitmap (pixmap, depth == 1) which they call a shape mask. i have tried
making one. drawing random shapes in paint and gimp, even tried making
the background transparent, as well as trying saving the files as bmp,
xbm, and xpm.

require 'gtk2' require 'win32/sound' include Win32 include Gtk

white =, 0, 0)
black =, 65000, 65000)
pixmap = Gdk::Pixmap.create_from_data(nil, “XFolders/RF/circle.xbm”,
200, 200)
attribute =, 500, Gdk::Window::INPUT_OUTPUT,
window =, attribute, Gdk::Window::WA_TITLE)
window.shape_combine_mask(pixmap, 5, 5)



the colors are there because the “pixmap =
Gdk::Pixmap.create_from_data(nil, “XFolders/RF/circle.xbm”, 200, 200)”
command has optional arguments for the fg and bg, and i was playing with
them a bit. this runs, but the output is hard to explain, but i will
try. its like a channel on your tv that is purely static, and the black
dots are part of the window and and the white parts are transparent and
you can click on whatever is behind the window. like i said hard to
expplain. would be easier if you tried to run it and see what happens,
hopefully you can recreate the issue.

any help is appreciated, thanks in advance.


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