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

Any size cursor



In general, flicker is often caused by erasing an object in its old
position before drawing it in its new position. 

One common trick that solves this is called "double-buffering", in 
which you use an offscreen buffer. First, this offscreen buffer contains 
a copy of the affected portion of the screen, but without the object 
(your cursor). Next, draw the object into this buffer, in its new position.
Instead of erasing the old region, you copy the new image over the old one.

This requires doing more work and it takes up more memory, but it 
avoids the flicker. I think there might be some double-buffer code in
Alan Ruttenberg's GWorlds tools, on the cd-rom under 
"Collected Works:Alanr's Contribution:"

 >Date: Wed, 19 May 93 10:36:42 -0400
 >From: jipan@gmuvax2.gmu.edu (Jiqian Pan)
 >To: info-mcl@cambridge.apple.com
 >Subject: Any size cursor
 >
 >As you might know, a system cursor is limited with the size of 16 x 16.
 >To have a cursor with any size, I used the following way to that:
 >
 >(defmethod window-update-cursor ((wnd my-window) where)
 >  (empty-cursor)                       ;; make an arrow cursor invisible
 >  (copy-image where *current-cursor*)  ;; copy my cursor with 32 x 24 to 
 >                                       ;; the mouse location
 >  (when (or (/= (point-h where) (point-h *last-position*))
 >            (/= (point-v where) (point-v *last-position*)))
 >    (white-area *last-position* (view-size *current-cursor*) )
 >    (copy-image new-where *current-cursor*)
 >    (setf *last-position* where)))
 >
 >But the moving of my cursor is not smooth, that is, flickering problem.
 >I use the Max IIfx computer.  Does anyone know this problem and/or
 >other ways to implement this process?
 >
 >Thanks in advance.
 >
 >jipan@gmuvax2.gmu.edu
 >
 >