Mercurial > emacs
comparison src/nsfns.m @ 104372:c1f72ea59c48
(Fxw_color_values): Return 3-element list. Doc fix.
author | YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> |
---|---|
date | Thu, 20 Aug 2009 09:44:06 +0000 |
parents | 901ce8956103 |
children | 767bf46c924d |
comparison
equal
deleted
inserted
replaced
104371:a6ffc3555448 | 104372:c1f72ea59c48 |
---|---|
2230 return ns_lisp_to_color (color, &col) ? Qnil : Qt; | 2230 return ns_lisp_to_color (color, &col) ? Qnil : Qt; |
2231 } | 2231 } |
2232 | 2232 |
2233 | 2233 |
2234 DEFUN ("xw-color-values", Fxw_color_values, Sxw_color_values, 1, 2, 0, | 2234 DEFUN ("xw-color-values", Fxw_color_values, Sxw_color_values, 1, 2, 0, |
2235 doc: /* Return a description of the color named COLOR. | 2235 doc: /* Internal function called by `color-values', which see. */) |
2236 The value is a list of integer RGBA values--(RED GREEN BLUE ALPHA). | |
2237 These values appear to range from 0 to 65280; white is (65280 65280 65280 0). | |
2238 The optional argument FRAME is currently ignored. */) | |
2239 (color, frame) | 2236 (color, frame) |
2240 Lisp_Object color, frame; | 2237 Lisp_Object color, frame; |
2241 { | 2238 { |
2242 NSColor * col; | 2239 NSColor * col; |
2243 float red, green, blue, alpha; | 2240 float red, green, blue, alpha; |
2244 Lisp_Object rgba[4]; | |
2245 | 2241 |
2246 check_ns (); | 2242 check_ns (); |
2247 CHECK_STRING (color); | 2243 CHECK_STRING (color); |
2248 | 2244 |
2249 if (ns_lisp_to_color (color, &col)) | 2245 if (ns_lisp_to_color (color, &col)) |
2250 return Qnil; | 2246 return Qnil; |
2251 | 2247 |
2252 [[col colorUsingColorSpaceName: NSCalibratedRGBColorSpace] | 2248 [[col colorUsingColorSpaceName: NSCalibratedRGBColorSpace] |
2253 getRed: &red green: &green blue: &blue alpha: &alpha]; | 2249 getRed: &red green: &green blue: &blue alpha: &alpha]; |
2254 rgba[0] = make_number (lrint (red*65280)); | 2250 return list3 (make_number (lrint (red*65280)), |
2255 rgba[1] = make_number (lrint (green*65280)); | 2251 make_number (lrint (green*65280)), |
2256 rgba[2] = make_number (lrint (blue*65280)); | 2252 make_number (lrint (blue*65280))); |
2257 rgba[3] = make_number (lrint (alpha*65280)); | |
2258 | |
2259 return Flist (4, rgba); | |
2260 } | 2253 } |
2261 | 2254 |
2262 | 2255 |
2263 DEFUN ("xw-display-color-p", Fxw_display_color_p, Sxw_display_color_p, 0, 1, 0, | 2256 DEFUN ("xw-display-color-p", Fxw_display_color_p, Sxw_display_color_p, 0, 1, 0, |
2264 doc: /* Return t if the Nextstep display supports color. | 2257 doc: /* Return t if the Nextstep display supports color. |