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

Re: Grayscale pixels, anyone?



In article <3k7tdi$pnm@news.ccit.arizona.edu>, WF Vaughn
<vaughn@aruba.ccit.arizona.edu> wrote:

|Hi LISPERS,
|Using GET-PIXEL, I can tell if a given pixel's on or off.
|I'm wondering if there's any way to get a pixel's 4-bit 
|grayscale value in a similar way. Any ideas?

;;;;Untested code.  I don't have a clue what it would do in a B/W window, but
;;;;I sure wouldn't try it without saving first. :-)

(defun get-c-pixel (h &optional v)
   "h &optional v
Returns the RGB color of the pixel in question in the current color grafport."
   (let* ((point (make-point h v))
          (h (point-h point))
          (v (point-v point)))
      (rlet ((rgb :RGBColor))
         (#_GetCPixel h v rgb)
         ;or would (values (%get-byte rgb) (%get-byte rgb 2) (%get-byte rgb 4))
         ;be better?
         (make-color (%get-byte rgb) (%get-byte rgb 2) (%get-byte rgb 4)))))

-- 
-- 
--
-- "TANSTAAFL"  Rich lynch@ils.nwu.edu