[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Fast Graphics on 3653
To get fast graphics, I do something which is very non-portable.
I get my hand on the screen array and call the lowest level
routines I can find to do line and circle drawing.
You can get the screen array of a dynamic window by:
(send window :screen-array)
Then use TV:%DRAW-LINE-INTERNAL to draw lines and
GRAPHICS:DRAW-UNFILLED-CIRCLE-DRIVER to draw circles.
Here are some typical calls:
(defun 1FAST-DRAW-LINE
0 (x1 y1 x2 y2
array top-margin-size left-margin-size inside-height inside-width)
(if (and ( x1 0) (< x1 inside-width)
( y1 0) (< y1 inside-height)
( x2 0) (< x2 inside-width)
( y2 0) (< y2 inside-height))
(tv:%draw-line-internal (+ x1 left-margin-size)
(+ y1 top-margin-size)
(+ x2 left-margin-size)
(+ y2 top-margin-size)
tv:alu-xor
t
array)))
(defun 1FAST-DRAW-CIRCLE
0 (x y radius
array top-margin-size left-margin-size inside-height inside-width)
(if (and ( (- x radius) 0)
( (- y radius) 0)
(< (+ x radius) inside-width)
(< (+ y radius) inside-height))
(graphics:draw-unfilled-circle-driver
(+ x left-margin-size)
(+ y top-margin-size)
radius
#'(lambda (x y) (setf (aref array y x) (1- (aref array y x)))))))
There are a couple of gotchas that you should know about this method:
1. It is fast. I use it to do real time animation at about 20 frames
per second on a 3640 and about 60 frames per second on an XL1200.
2. No clipping is done, if the figure falls even partially outside the
screen it is not drawn.
3. Will crash if window is deexposed, resized or moved since I am
writting directly to the screen array.
4. Will crash if given arguments of wrong type.
5. You must take into account the window borders yourself, as I have
done.
6. non-portable.
Enjoy,
Jeff