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

Graphics to Bitmaps

    Date: Tue, 16 Apr 91 20:36:06 +0900
    From: kddlab!atr-la.atr.co.jp!myers@uunet.UU.NET (John K. Myers)

Inside the body of tv:with-output-to-bitmap-stream, you can ask the
stream for its bitmap with :bitmap-and-edges.  Use that where you would
have used your personal array.  You may also need to move the
with-output-to-bitmap-stream out of the drawing loop and into the
top-level setup.  That's more efficient anyway.  Use :clear-window to
reset it if you need between drawing sequences.

Use the :bitblt-to-sheet method to copy the bits.

      Bonus problem:  How to draw a bitmap at your current place in a Lisp Listener.
    (graphics:wih-room-for-graphics (stream)
      (graphics:with-graphics-scale (stream 1.0 -1.0)
	 (graphics:draw-image my-bitmap 0 0 :stream stream)))
    almost works but runs into the infamous "ha ha, you left the cursor up
    at the top of with-room-for-graphics" problem, it prints a white line and
    wipes out part of the bitmap.   I forget the magic to take care of this.
    Is there a clean way around it or a cleaner way of doing it?

The above code draws the bitmap above the zero line, which isn't the
place you allocated.  The complete idiom (from which you can take out
what you don't need) is:
(let ((height (- bottom top)))
  (graphics:with-room-for-graphics (stream (ceiling (* height scale)))
    (graphics:draw-image raster 0 (- height) 
			 :scale scale :scale-y -1
			 :image-left left :image-top top :image-right right :image-bottom bottom
			 :stream stream)))