Re: xor
Hi Carlos,
The problem is that Cocoa itself do not support the XOR mode.
As a possible alternative, you can see the capi:pinboard-layout and
capi:pinboard-object technique in the LW doc (there is also some code
examples in the LW library).
For myself, I have implemented a category of objects derived that the
system create automatically when the user want to to move something in
the pane or to make a selection area. Before drawing itself, the
object make some image(s) with the region of the port it will cover
and restore it after. This procedure calls gp:make-image-from-port to
make the image, capi:draw-image to restore the port, and gp:free-image
to free the image object.
This is naturally more complex than the XOR mode, but also more
powerfull (because your can keep any apparence, color or transparency,
you want for the object during the movment). I really didn't find any
other solution, even after some contact with the LW support.
Denis
2007/10/25, Carlos Agon <Carlos.Agon@ircam.fr>:
>
> hi
>
> I try to draw a rectangle for selecting objects inside.
>
> I work on mac and I see in the documentation that the keyword
> 'operation' in 'with-graphics-state' is not supported for cocoa. So i
> suppose that for this reason this macro (taked from the examples)
> doesn't work
>
> (defmacro with-xor ((port) &body body)
> `(gp:with-graphics-state (,port
> :foreground (gp:compute-xor-pixel ,port)
> :operation boole-xor)
> ,@body))
>
> There is another way to draw and erase my rectangle ?
>
> thanks again
>
> Carlos Agon
>
>