Re: Transparent binary bitmap outside a window



On Wed, 2005-11-23 at 01:37 -0500, Martin Bailey wrote:
> Hi,
> 
> Sorry for asking such a basic question; I'm simply unable to unable to 
> find my answer in the documentation and this is my first attempt at gtkmm.
> 
> I'd like draw a Bitmap outside a Window. That is, I would like to draw 
> an irregular black shape (from a bitmap matrix) directly in the display, 
> over any other programs.
> I don't want to draw inside a Window because I don't want my application 
> to receive any events; just draw over other applications, or in a way 
> hide some parts of them with a binary bitmap.
> For example, with a 1024x768 resolution, I want a background PDF viewer 
> to remain visible while I can draw anything over it in the same 1024x768 
> region.
> 
> So as I understand, I must create a Bitmap in the same way that I create 
> a Window, and then create a GC to draw inside my bitmap.
> Is that right?
> What C++ code do I need to get these elements created properly?

it doesn't work this way.

all drawing goes to a window. no exceptions.

what you can do is to use Gtk::Window::shape_combine_mask() to change
the shape of the window from rectangular to the outline of your bitmap.
you will need to experiment with shape_combine_mask() - i have used it
long ago, and its slightly more complex than it appears. google may even
find some postings of my (and others') code.

the other thing you might look at for insight is a program called
gromit, which allows the user to scribble directly on the display,
although AFAIK it also uses the shape_combine_mask() trick. i use gromit
for presentations when i want to be able to draw over the top of (e.g)
an openoffice slide show.

--p





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