Hi guys,
I'm having some problems with clipping regions (or I just don't understand the concept, which is still entirely possible).
In the clim-listener, in the package clim-user, I do the following:
(with-room-for-graphics (t) (draw-rectangle* *standard-output* -10 -10 10 10))
This gives a black, filled rectangle. Great, just as expected. Now, I want to try to define a clipping region:
(with-room-for-graphics (t) (draw-rectangle* *standard-output* -10 -10 10 10 :clipping-region (make-rectangle* -5 -5 5 5)))
What I expect is that it displays a smaller rectangle, namely the rectangle with side 20 clipped down to a side of 10. However, I don't see anything.
So, I try the following:
(with-room-for-graphics (t) (draw-rectangle* *standard-output* -10 -10 10 10 :clipping-region (make-rectangle* -20 -20 20 20)))
Since the clipping region is _larger_ than the actual drawing, I expect to see the same as in the first sexp, where I didn't define any clipping region. Nevertheless, I see... NOTHING!
Is this a bug, a feature, or am I hopelessly ignorant and should just give up ever trying to do anything remotely complicated in clim?
Thanks, Sumant
Sumant Oemrawsingh soemraws@xs4all.nl writes:
In the clim-listener, in the package clim-user, I do the following:
(with-room-for-graphics (t) (draw-rectangle* *standard-output* -10 -10 10 10))
This gives a black, filled rectangle. Great, just as expected. Now, I want to try to define a clipping region:
(with-room-for-graphics (t) (draw-rectangle* *standard-output* -10 -10 10 10 :clipping-region (make-rectangle* -5 -5 5 5)))
What I expect is that it displays a smaller rectangle, namely the rectangle with side 20 clipped down to a side of 10. However, I don't see anything.
So, I try the following:
(with-room-for-graphics (t) (draw-rectangle* *standard-output* -10 -10 10 10 :clipping-region (make-rectangle* -20 -20 20 20)))
Since the clipping region is _larger_ than the actual drawing, I expect to see the same as in the first sexp, where I didn't define any clipping region. Nevertheless, I see... NOTHING!
Is this a bug, a feature, or am I hopelessly ignorant and should just give up ever trying to do anything remotely complicated in clim?
Sorry for the huge quote, but I thought some context would be good. Looking at http://www.mikemac.com/mikemac/clim/drawing-options.html, it sounds like you're doing the right thing: RECTANGLE is a subclass of POLYGON which is a subclass of AREA, and that's what :CLIPPING-REGION expects.
So I suspect it's a bug or unimplemented feature.
Sumant Oemrawsingh soemraws@xs4all.nl writes:
(with-room-for-graphics (t) (draw-rectangle* *standard-output* -10 -10 10 10 :clipping-region (make-rectangle* -5 -5 5 5)))
What I expect is that it displays a smaller rectangle, namely the rectangle with side 20 clipped down to a side of 10. However, I don't see anything.
Without looking at the code, my suspicion is that the with-room-for-graphics is at fault -- or at least, it's not transforming the clipping region.
Doing (draw-rectangle* *standard-output* 90 90 100 100 :clipping-region (make-rectangle* 95 95 120 120)) at the Listener gives me a 5-pixel rectangle, as one might expect.
So clipping works at least partially; I don't know exactly what is at fault.
Cheers,
Christophe
On Wed, Jul 08, 2009 at 04:39:48PM +0100, Christophe Rhodes wrote:
Sumant Oemrawsingh soemraws@xs4all.nl writes:
(with-room-for-graphics (t) (draw-rectangle* *standard-output* -10 -10 10 10 :clipping-region (make-rectangle* -5 -5 5 5)))
What I expect is that it displays a smaller rectangle, namely the rectangle with side 20 clipped down to a side of 10. However, I don't see anything.
Without looking at the code, my suspicion is that the with-room-for-graphics is at fault -- or at least, it's not transforming the clipping region.
Doing (draw-rectangle* *standard-output* 90 90 100 100 :clipping-region (make-rectangle* 95 95 120 120)) at the Listener gives me a 5-pixel rectangle, as one might expect.
So clipping works at least partially; I don't know exactly what is at fault.
Cheers,
Christophe
So it does. Weird... I thought that with-room-for-graphics was just a macro that encloses the body in a transformation. In that case, how can the clipping region, which is still created inside the body, fall outside of the transformation?
So I guess that with-room-for-graphics wrongly deterimines the size of the graphic after clipping, and just clips the whole thing, or so...
Well, I'm not versed in lisp enough to dive into the actual mcclim source code (but I'll try anyway), so I don't expect I'll find the problem that fast.
Thanks for the help, Sumant