Update of /cvsroot/scsh/scx/scheme/xlib
In directory usw-pr-cvs1:/tmp/cvs-serv19271
Modified Files:
color.scm
Log Message:
fixed make-color bug. added comments.
Index: color.scm
===================================================================
RCS file: /cvsroot/scsh/scx/scheme/xlib/color.scm,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** color.scm 2001/07/09 13:49:38 1.2
--- color.scm 2001/07/16 13:08:08 1.3
***************
*** 1,10 ****
;; Author: David Frese
! ;; r,g,b should be values between 0.0 to 1.0 inclusive.
(define (make-color r g b)
! (create-color (floor (* r 65535))
! (floor (* g 65535))
! (floor (* b 65535))))
(define (color-rgb-values color)
--- 1,18 ----
;; Author: David Frese
! ;; make-color creates a color with the given r,g,b values, which should be
! ;; values between 0.0 to 1.0 inclusive.
+ (define (my-floor v)
+ (if (exact? v)
+ (floor v)
+ (my-floor (inexact->exact v))))
+
(define (make-color r g b)
! (create-color (my-floor (* r 65535))
! (my-floor (* g 65535))
! (my-floor (* b 65535))))
!
! ;; color-rgb-values returns a list of the rgb-values (see make-color).
(define (color-rgb-values color)
***************
*** 13,17 ****
(extract-rgb-values color)))
! ;; ...
(define (query-color colormap pixel)
--- 21,26 ----
(extract-rgb-values color)))
! ;; query-color returns the color of the given pixel in the given colormap.
! ;; See XQueryColor.
(define (query-color colormap pixel)
***************
*** 24,28 ****
"Query_Color")
! ;; ...
(define (query-colors colormap pixels)
--- 33,38 ----
"Query_Color")
! ;; query-colors does the same as query-color but on vectors of pixels and
! ;; colors. See XQueryColors.
(define (query-colors colormap pixels)
***************
*** 36,40 ****
"Query_Colors")
! ;; ...
(define (lookup-color colormap color-name)
--- 46,53 ----
"Query_Colors")
! ;; lookup-color takes the name of a color (a string or symbol) looks it up in
! ;; the colormap and returns a pair of colors: the exact color and the closest
! ;; color provided by the screen associated to the colormap. If the color-name
! ;; can't be found an error is raised. See XLookupColor.
(define (lookup-color colormap color-name)
|