[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Graphics clipping question



    Date: Thu, 02 Mar 89 14:24:35 -0500
    From: kanderso@DINO.BBN.COM

    I am trying to convert some graph drawing software to use GRAPHICS:
    functions rather than window operations, and one thing i'm having
    trouble with is clipping.  I need to be able to clip drawing
    operations to the rectangular outline of the graph.  My old software
    modified the TV:CLIPPING-REGION instance variable of the stream being
    drawn on, and that worked fine.  This doesn't work with GRAPHICS:
    functions because the stream you think you are drawing on often has
    nothing to do with the steam you are actually drawing on because you
    are in a maze of twistly little continuations all alike.

Try:

(graphics:with-room-for-graphics ()
  (graphics:with-clipping-path (t #'(lambda (s)
				      (graphics:draw-rectangle 100 100 200 200 :stream s :filled nil)))
    (graphics:draw-circle 100 100 50)))

You can construct an arbitrary clipping region by drawing a path that
surrounds it.