scx/scheme/xlib/colormap.scm

36 lines
1.2 KiB
Scheme
Raw Normal View History

2001-06-11 11:28:32 -04:00
;; Author: David Frese
2001-07-16 09:37:28 -04:00
;; alloc-color returns the pixel closest to the specified color supported by the
;; hardware. See XAllocColor.
2001-06-11 11:28:32 -04:00
(define (alloc-color colormap color)
(let ((Xpixel (%alloc-color (colormap-Xcolormap colormap)
(color-Xcolor color)
(display-Xdisplay (colormap-display colormap)))))
(if Xpixel
(make-pixel Xpixel)
Xpixel)))
2001-07-09 09:49:38 -04:00
(import-lambda-definition %alloc-color (Xcolormap Xcolor Xdisplay)
2001-06-11 11:28:32 -04:00
"Alloc_Color")
2001-07-16 09:37:28 -04:00
;; alloc-named-color looks up the named color with respect to the screen that
;; is associated with the specified colormap. It returns both the exact database
;; definition and the closest color supported by the screen (as a pair).
;; See XAllocNamedColor.
2001-06-11 11:28:32 -04:00
(define (alloc-named-color colormap color-name)
(let ((Xres (%alloc-named-color (colormap-Xcolormap colormap)
(if (symbol? color-name)
(symbol->string color-name)
color-name)
(display-Xdisplay
(colormap-display colormap)))))
2001-06-11 11:28:32 -04:00
(if Xres
(list (make-pixel (car Xres))
(apply create-color (cadr Xres))
(apply create-color (caddr Xres)))
2001-06-11 11:28:32 -04:00
Xres)))
(import-lambda-definition %alloc-named-color (Xcolormap name Xdisplay)
"Alloc_Named_Color")