NextPrevUpTopContentsIndex

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
 => result
ensure-hsv color-spec
 => result
ensure-gray color-spec
 => result
ensure-model-color color-spec model
 => result
ensure-color color-spec match-color-spec
 => result
Arguments

For all functions:

color-spec

A color specification.

match-color-spec

A color specification.

model

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

Values

result

A color specification.

Description

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

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

If color-spec has an alpha component, then result has that same alpha component.

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 specification for color-spec , in the color model specified by match-color-spec . Thus, color specifications may be converted from one model to another with having to explicitly state the color model.

Example
COLOR 36 > (ensure-hsv (make-rgb 0.70s0 0.90s0 0.99s0))
#(:HSV 4.31033S0 0.707069S0 0.99S0)
COLOR 37 > (ensure-gray (make-rgb 0.70s0 0.90s0 0.99s0))
#(:GRAY 0.863331S0)
COLOR 39 > (ensure-model-color (make-rgb 0.70s0 0.90s0 0.99s0) :hsv)
#(:HSV 4.31033S0 0.707069S0 0.99S0)
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 CAPI Reference Manual - 17 Mar 2008

NextPrevUpTopContentsIndex