Next Prev Up Top Contents Index

ensure- <command>

Function
Summary

Return a color specification for a given model. The model depends on the particular function called

Package

color

Signature
ensure-rgb color-spec
 => color-spec
ensure-hsv color-spec
 => color-spec
ensure-gray color-spec
 => color-spec
ensure-model-color color-spec model
 => color-spec
ensure-color color-spec match-color-spec
 => color-spec
Arguments

For all functions:

color-spec

A color specification.

match-color-spec

A color specification.

model

A color-model ( :rgb , :hsv or :gray ).

Values

color-spec

A color specification.

Description

These functions all return a color-spec, given (at least) a color-spec as argument.

ensure-rgb , ensure-hsv and ensure-gray all return a color-spec in the appropriate model. If the color-spec given as an argument is in the same model, it is just returned. Otherwise a new color-spec for that model is calculated. Thus, ensure-rgb returns a color-spec in the RGB color-model, whatever color-model is used in the color-spec given as an argument.

ensure-model-color is similar to the above three functions, except that a color-model model is explicitly passed as an argument to the function. The color-spec returned is in the color-model specified by model .

ensure-color returns a color-spec for color-spec , in the color-model specified by match-color-spec . Thus, color-specs may be converted from one model to another with having to explicitly state the color-model.

Example 1
COLOR 36 > (ensure-hsv (color:make-rgb 0.70s0 0.90s0 0.99s0))
#(:HSV 4.31033S0 0.707069S0 0.99S0)
COLOR 37 > (ensure-gray (color:make-rgb 0.70s0 0.90s0 0.99s0))
#(:GRAY 0.863331S0)
Example 2
COLOR 39 > (ensure-model-color (color:make-rgb 0.70s0 0.90s0 0.99s0) :hsv)
#(:HSV 4.31033S0 0.707069S0 0.99S0)
Example 3
COLOR 43 > (ensure-color (make-hsv 0.70s0 0.90s0 0.99s0) (make-rgb 0.70s0 0.90s0 0.99s0))
#(:RGB 0.99S0 0.890999S0 0.92069924)
See also
convert-color
colors=

LispWorks Reference Manual (Windows version) - 14 Dec 2001

Next Prev Up Top Contents Index