hello,
after some basic experimentation with setting the 'opacity' of various inks, and attempting to compose-in/compose-over, im unable to find an obvious way to blend freshly drawn pixels (eg. using draw-line*) over previously drawn pixels.
is it at all possible using the x11 (or potentially the beagle) backend to draw transparent/translucent objects in mcclim panes? the clim reference suggests it should be, . ..
if such blending is not currently supported, could anyone suggest a method to simulate it? (a partially flipping +flipping-ink+ ??)
thanks, nik
On Wednesday, June 22, 2005, at 05:11 pm, nik gaffney wrote:
hello,
after some basic experimentation with setting the 'opacity' of various inks, and attempting to compose-in/compose-over, im unable to find an obvious way to blend freshly drawn pixels (eg. using draw-line*) over previously drawn pixels.
is it at all possible using the x11 (or potentially the beagle) backend to draw transparent/translucent objects in mcclim panes? the clim reference suggests it should be, . ..
With regards only to Beagle...
Beagle doesn't support this. Theoretically you should only need to set the 'colour' of the line you're overdrawing with to have some sort of opacity and it should work; however I don't think there's an implemented method in McCLIM (yet) to set the opacity of an ink (this is what compose-in etc. are for), except when the ink is totally transparent or totally opaque and seemingly no method to get an opacity from a design (unless that design is actually an instance of an 'opacity' object, which is how transparent parts of icons etc. work).
Certainly this functionality could be implemented quickly (in Beagle; in fact, Cocoa pretty much forces you to supply an alpha value in order to construct a valid NSColor object) but at the moment there are more... fundamental issues I need to address ;-)
if such blending is not currently supported, could anyone suggest a method to simulate it? (a partially flipping +flipping-ink+ ??)
Flipping ink is one of the fundamental things I was talking about earlier, at least as far as Beagle is concerned (it works in CLX, for solid designs at least). I don't think you will be able to achieve the effect you're looking for (but am looking forward to being wrong ;-) with McCLIM or either of the back ends as they stand.
-Duncan
thanks, nik
mcclim-devel mailing list mcclim-devel@common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/mcclim-devel
after some basic experimentation with setting the 'opacity' of various inks, and attempting to compose-in/compose-over, im unable to find an obvious way to blend freshly drawn pixels (eg. using draw-line*) over previously drawn pixels.
well, i manged a quick hack to create inks which have variable opacity, but it only works using an alpha blend of the current foreground color. from my understanding of how clim considers opacity to work, this is almost certainly the wrong way to do it (but im also uncertain as to what the _right_ way would be. ..)
(defmethod medium-gcontext ((medium clx-medium) (ink opacity)) (let* ((gc (medium-gcontext medium (medium-background medium))) (port (port medium)) (alpha (opacity-value ink)) (blend (round (* alpha (X-pixel port (medium-foreground medium)))))) (setf (xlib:gcontext-function gc) boole-and) (setf (xlib:gcontext-foreground gc) blend) (setf (xlib:gcontext-background gc) blend) gc))
in attmepting to get this to work more correctly, im stuck with what is more likly a CLOS issue, in that im not sure how to define a method which handles the following ->
(#<CLIM-INTERNALS::UNIFORM-COMPOSITUM :INK #<CLIM-INTERNALS::NAMED-COLOR "Unnamed color"> :MASK #<CLIM-INTERNALS::STANDARD-OPACITY 0.5>>).
all my attmepts have so far ended in a choked sbcl.. , any suggestions?
nik