[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: seedFill -- need example
- To: email@example.com, firstname.lastname@example.org, email@example.com
- Subject: Re: seedFill -- need example
- From: firstname.lastname@example.org (Bill St. Clair)
- Date: Wed, 20 Jan 1993 18:56:42 -0600
- Cc: email@example.com
I was working on this one at the same time as John. He beat me to it,
but here's my version anyway.
; An example of using the #_SeedFill trap.
; Note that #_SeedFill will not work in place the way that #_CopyBits does:
; you really need to use two different bitmaps or two disjoint sections
; of one bitmap. This doesn't really need to allocate two bitmaps.
; Instead it could #_SeedFill directly from the window's bitmap
; to a single off-screen bitmap. This version will work correctly
; on color windows however, while the single bitmap version won't.
; Note that this will not work correctly if any part of the image
; is obscured by another window. If you're writing a paint program,
; you'll need to store the image off-screen.
(defun seed-fill-window (window h &optional v)
"Flood the region at h,v with paint."
(let ((size (view-size window))
(wptr (wptr window))
(rlet ((rect :rect :topleft #@(0 0) :botright size))
(setq src-bitmap (make-bitmap rect)
dst-bitmap (make-bitmap rect))
(copy-bits (pref wptr :windowRecord.port.portbits)
(let* ((h (if v h (point-h h)))
(v (if v v (point-v h)))
(srcptr (pref src-bitmap :bitmap.baseaddr))
(dstptr (pref dst-bitmap :bitmap.baseaddr))
(srcrow (pref src-bitmap :bitmap.rowbytes))
(dstrow (pref dst-bitmap :bitmap.rowbytes))
(height (point-v size))
(words (ceiling (point-h size) 16)))
(#_seedFill srcptr dstptr srcrow dstrow height words h v))
(pref wptr :windowRecord.port.portbits)
(setq *w* (make-instance 'window))
(frame-rect *w* 20 20 100 100)
(seed-fill-window *w* 50 50) ; flood the rectangle w/ paint
(invalidate-view *w* t)
(frame-oval *w* 20 20 100 100)
(seed-fill-window *w* 50 50) ; flood the circle w/ paint