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

[no subject]



Regarding mail last week concerning colors, here are a few simple functions
that work in  the 0-255
range for each color,  rather than the color quickdraw 16 bit values for
each color.
:8o)
Dave

(defun rgb_color (r g b)
  "mimics make-color.  r,b and b are clipped 0-255"
  (let ((mask (byte 8 0)))
    (logior (lsh (logand mask r) 16)
            (lsh (logand mask g) 8) 
            (logand mask b))))

(defun color_red (clr)
  (ldb (byte 8 16) clr))

(defun color_green (clr)
  (ldb (byte 8 8) clr))

(defun color_blue (clr)
  (ldb (byte 8 0) clr))
-------------------------------------------------------------
David S. Bright                        bright@enh.nist.gov  
Microanalysis Research Group 
Chem. A113                                  
National Institute of Standards & Technology (NIST, formerly NBS)
Gaithersburg, MD 20899-0001                                          
USA
301-975-3911 - voice, 301-216-1134 - fax