All Manuals > CAPI User Guide and Reference Manual > 15 The Color System

NextPrevUpTopContentsIndex

15.1 Introduction

The LispWorks Color System allows applications to use keyword symbols as aliases for colors in Graphics Ports drawing functions. They can also be used for backgrounds and foregrounds of windows and CAPI objects.

For example, the call

(gp:draw-line my-port x1 y1 x2 y2 
    :foreground :navyblue)

uses the keyword symbol :navyblue for the color of the line.

Colors are looked up in a color database. The LispWorks image is delivered with a large color database already loaded (approximately 660 entries.) The color database contains color-specs which define the colors in terms of a standard color model. When the drawing function is executed, the color-spec is converted into a colormap index (or "pixel" value).

The LispWorks Color System has facilities for:

It is accessible from the color package, and all symbols mentioned in this chapter are assumed to be external to this package unless otherwise stated. You can qualify them all explicitly in your code, for example apropos-color-names.

However it is more convenient to create a package which has the color package on its package-use-list:

(defpackage "MY-PACKAGE"
	(:add-use-defaults t)
	(:use "COLOR" "CAPI") 
)

This creates a package in which all the color symbols (and for convenience, capi as well) are accessible. To run the examples in this chapter, evaluate the form above and then:

(in-package "MY-PACKAGE")

The color-models available by default are RGB, HSV and GRAY.

15.1.1 Rendering of colors

Some colors do not render exactly as expected in some CAPI classes such as title-pane - it depends on the palette provided by the rendering system.

However, output-pane and its subclasses support non-standard palettes.


CAPI User Guide and Reference Manual (Windows version) - 25 Feb 2015

NextPrevUpTopContentsIndex