[gtkmm] pixmaps+alpha mask and drawingarea widget



Hello :-)

(My first post to the mailing list :P) We're making a cross-platform
tracker (music dev app) called freePsycle (the free means made with free
tools). We're using gtkmm for the UI (the obvious choice I think). I've
got two questions, if anyone would help that'd be great :>.

1. One of the displays is an area where machines (boxes) can be placed.
(machines like synth, reverb etc) You can move the machines about by
dragging them around the window. You can connect wires between them. I
would like to use events to discover which machine has been clicked on. At
the moment the machine screen is a DrawingArea, the machines are pixmaps
that are drawn on the drawinarea. Can I define subareas of a drawingarea
that will fire unique events, or should I determine which machine has been
clcked on by keeping a list of the locations of the machines and searching
the list when clicking on the drawing area? (The former would be neater)
Perhaps there's a better alternative to using the drawingarea widget?

2. I've made a bitmapped font engine (for speed and pixel clarity). It
uses a pixbuf to load the bitmapped font image, and draws the letter onto
a drawable. I've read that the pixbuf keeps it's data on the server, and
that drawing from pixmaps is faster (it keeps it on clientside). I've
tried to use pixmap but the result is garbled pixels, I think there might
be an error in my process. What I am doing is as follows (unfortunately I
don't have the code here)

The font image has a transparent background. I'm creating a pixmap and a
bitmap (of equal size) (using a char array of equal length to the number
of pixels for the data parameter). I then use render pixmap and alpha to
draw the pixbuf onto the pixmap and the alpha onto the bitmap. I create a
GC from the pixmap and set the clipping mask to the bitmap, then draw the
new pixmap onto my drawingarea widget using the GC (with the mask). If I
draw without using the bitmap GC it comes out correctly but without
transparency. with the GC what comes out is some garbled pixels.

Is this correct in theory?

Thanks in advance for any suggestion

all the best

Jim


________________________________________________________________

DISCLAIMER:

This e-mail and any files transmitted with it are confidential
and intended solely for the use of the individual or entity to
whom it is addressed.  If you are not the intended recipient
you are prohibited from using any of the information contained
in this e-mail.  In such a case, please destroy all copies in
your possession and notify the sender by reply e-mail.  Heriot
Watt University does not accept liability or responsibility
for changes made to this e-mail after it was sent, or for
viruses transmitted through this e-mail.  Opinions, comments,
conclusions and other information in this e-mail that do not
relate to the official business of Heriot Watt University are
not endorsed by it.
________________________________________________________________



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