CLIM mail archive


Interaction of with-room-for-graphics and with-translation

   Date: Fri, 24 Sep 93 15:39:57 EDT
   From: Mike Harper <mlh@BBN.COM>

   I am just beginning to use the stream transformation facilities and do not
   have a very good model of how they work. I am attempting to use with-translation
   inside a call to with-room-for-graphics and the with-translation appears to
   have no effect. Why is this? Does using with-room-for-graphics preclude the use
   of the other transformation facilities?

You don't give a complete description of how to reproduce what you
see, but I'll take a guess.

The current doc for with-room-for-graphics does a poor job of
explaining what it does.  As well as giving you a y-upward coordinate
system, it takes the bounding box of THE INK THAT YOU DRAW, and puts
that on the left margin at the current cursorpos, more or less.

So, for instance, if you try

(with-room-for-graphics (s)
  (draw-rectangle* s 0 0 20 20))

and then

(with-room-for-graphics (s)
  (with-translation (s 30 0)
    (draw-rectangle* s 0 0 20 20)))

you will see the same thing in both cases.  However if you put down
some ink outside the translation, you should see that the translation
is happening after all.  Try, e.g.

(with-room-for-graphics (s)
  (draw-point* s 0 0)
  (with-translation (s 30 0)
    (draw-rectangle* s 0 0 20 20)))

You can usually use this technique to get the effect that you want.
Try drawing the point in +background+ (CLIM 1) or +background-ink+
(CLIM 2) so it doesn't show up.


Main Index | Thread Index