[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Simple novice questions
- To: email@example.com
- Subject: Re: Simple novice questions
- From: "Mark A. Tapia" <firstname.lastname@example.org>
- Date: Fri, 20 Aug 1993 09:37:32 -0400
- Cc: email@example.com
On Thu Aug 19 18:27:44, Bill Coderre writes:
what is the "best" way to plot a pixel in a window?
I've got one that says:
(defun dot (window color point)
(move-to window point)
(set-fore-color window color)
(line-to window point))
Is there a simpler/faster/better way?
Your code will do exactly what you want but it won't change the
pixel permanently. As soon as you cover any portion of the window
containing the pixel with another window, it will be blank.
If you want the change to be permanent, you'll need to define
a view-draw-contents method for the window.
Even if you'll willing to accept the temporary nature of your
code, it would be better to use a defmethod:
(defmethod window-dot ((self window) &key color point)
(when (and (numberp color) (numberp point)) ; you can do more checking
; including checking that the window is color
(#_PenNormal) ;; same as (pen-normal self)
(#_moveto :long point) ;; same as (move-to self point)
(#_lineTo :long point))))