All Manuals > CAPI User Guide and Reference Manual > 13 Drawing - Graphics Ports

13.7 Combining source and target pixels

This section describes how new drawings are combined with the existing pixel values in the target of the drawing to generate the result, according to graphics state parameters compositing-mode or operation.

Note: The full set of graphics state parameters is described under graphics-state.

13.7.1 Combining pixels with :compatible drawing

When the port's drawing-mode is :compatible the graphics state parameter operation determines how the colors are combined, and compositing-mode is ignored.

The allowed values of operation are the values of the Common Lisp constants boole-1, boole-and and so on. These are the allowed values of the first argument to the Common Lisp function boole. See the specification of boole in the ANSI Common Lisp standard for the full list of operations.

The color combination corresponds to the logical operation defined there, as if by calling:

(boole operation new-pixel screen-pixel)

For example, passing :operation boole-andc2 provides a graphics-state where graphics ports drawing functions draw with the bitwise AND of the foreground color and the complement of the existing color of each pixel.

Note: Graphics State operation is not supported by Cocoa/Core Graphics so this parameter is ignored on Cocoa.

13.7.2 Combining pixels with :quality drawing

When the port's drawing-mode is :quality the graphics state parameter compositing-mode determines how the colors are combined, and operation is ignored.

compositing-mode :over means draw over the existing values, blending alpha values if they exist.

compositing-mode :copy means that the source is written to the destination ignoring the existing values. If the source has alpha and the target does not, that has the effect of converting semi-transparent source to solid. :copy is especially useful for creating transparent and semi-transparent pixmap ports, which can be displayed directly or converted to images by make-image-from-port.

Further compositing-mode values are supported on later versions of Cocoa and GTK+.


CAPI User Guide and Reference Manual (Windows version) - 01 Dec 2021 19:33:53