[mcclim-devel] opacity / translucency

nik gaffney nik at fo.am
Mon Jun 27 16:45:42 UTC 2005


> 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





More information about the mcclim-devel mailing list