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

Drawing into Bitmaps



Try this.

(defmacro draw-into-bitmap-new ((stream-var my-bitmap) &rest body)
  `(let ((,stream-var (make-instance 'tv:bitmap :buffer ,my-bitmap)))
     . ,body))

(setq bitmap-1 (graphics:make-raster-array-with-correct-width 100 100 :element-type 'bit))

(draw-into-bitmap-new (stream bitmap-1)
  (graphics:draw-polygon '(25 25  25 50  50 25) :stream stream :filled T)
  (graphics:draw-line 25 25 50 50 :stream stream :alu :flip)		  
  )

(setq bitmap-2 (graphics:make-raster-array-with-correct-width 100 100 :element-type 'bit))

(draw-into-bitmap-new (stream bitmap-2)
  (graphics:draw-rectangle 10 10 90 90 :filled t :stream stream)
  (graphics:draw-circle 50 50 40 :gray-level .5 :filled t :opaque t :stream stream)
  )