All Manuals > CLIM 2.0 User Guide > 5 Drawing in Color

5.2 CLIM Operators for Drawing in Color

The following functions create colors. These functions produce objects that have equivalent effects and are indistinguishable when drawn; the only difference is in how the color components are specified. Whether these functions use the specified values exactly or approximate them because of limited color resolution is unspecified. Whether these functions create a new object or return an existing object with equivalent color component values is also unspecified.

make-rgb-color Function

make-rgb-color red green blue

Summary: Returns a member of the class color. The red, green, and blue arguments are real numbers between 0 and 1 (inclusive) that specify the values of the corresponding color components.

make-ihs-color Function

make-ihs-color intensity hue saturation

Summary: Returns a member of class color. The intensity argument is a real number between 0 and (inclusive). The hue and saturation arguments are real numbers between 0 and 1 (inclusive).

make-gray-color Function

make-gray-color luminance

Summary: Returns a member of class color. luminance is a real number between 0 and 1 (inclusive). On a black-on-white display device, 0 means black, 1 means white, and the other values are shades of gray. On a white-on-black display device, 0 means white, 1 means black, and the other values are shades of gray.

make-contrasting-inks Function

make-contrasting-inks n &optional k

Summary: If k is not supplied, this returns a vector of n designs with recognizably different appearance. Elements of the vector are guaranteed to be acceptable values for the :ink argument to the drawing functions, and will not include +foreground-ink+, +background-ink+, or nil. Their class is otherwise unspecified. The vector is a fresh object that may be modified.

If k is supplied, it must be an integer between 0 and n – 1 (inclusive), in which case make-contrasting-inks returns the kth design rather than returning a vector of designs.

CLIM supports at least 8 different contrasting inks. If n is greater than the number of contrasting inks, make-contrasting-inks signals an error.

The rendering of the design may be a color or a stippled pattern, depending on whether the output medium supports color.

contrasting-inks-limit Generic Function

contrasting-inks-limit port

Summary: Returns the number of contrasting colors (or stipple patterns if port is monochrome or grayscale) that can be rendered on any medium on the port port. All classes that obey the medium protocol implement a method for this generic function.

The following two functions comprise the color protocol. Both of them return the components of a color. All subclasses of color implement methods for these generic functions.

color-rgb Generic Function

color-rgb color

Summary: Returns three values, the red, green, and blue components of the color color. The values are real numbers between 0 and 1 (inclusive).

color-ihs Generic Function

color-ihs color

Summary: Returns three values, the intensity, hue, and saturation components of the color color. The first value is a real number between 0 and (inclusive). The second and third values are real numbers between 0 and 1 (inclusive).


CLIM 2.0 User Guide - 01 Dec 2021 19:38:57