The OpenD Programming Language

cairo_operator_t

cairo_operator_t is used to set the compositing operator for all cairo drawing operations.

The default operator is CAIRO_OPERATOR_OVER.

The operators marked as unbounded modify their destination even outside of the mask layer (that is, their effect is not bound by the mask layer). However, their effect can still be limited by way of clipping.

To keep things simple, the operator descriptions here document the behavior for when both source and destination are either fully transparent or fully opaque. The actual implementation works for translucent layers too. For a more detailed explanation of the effects of each operator, including the mathematical definitions, see http://cairographics.org/operators/.

Values

ValueMeaning
CAIRO_OPERATOR_CLEAR

clear destination layer (bounded)

CAIRO_OPERATOR_SOURCE

replace destination layer (bounded)

CAIRO_OPERATOR_OVER

draw source layer on top of destination layer (bounded)

CAIRO_OPERATOR_IN

draw source where there was destination content (unbounded)

CAIRO_OPERATOR_OUT

draw source where there was no destination content (unbounded)

CAIRO_OPERATOR_ATOP

draw source on top of destination content and only there

CAIRO_OPERATOR_DEST

ignore the source

CAIRO_OPERATOR_DEST_OVER

draw destination on top of source

CAIRO_OPERATOR_DEST_IN

leave destination only where there was source content (unbounded)

CAIRO_OPERATOR_DEST_OUT

leave destination only where there was no source content

CAIRO_OPERATOR_DEST_ATOP

leave destination on top of source content and only there (unbounded)

CAIRO_OPERATOR_XOR

source and destination are shown where there is only one of them

CAIRO_OPERATOR_ADD

source and destination layers are accumulated

CAIRO_OPERATOR_SATURATE

like over, but assuming source and dest are disjoint geometries

CAIRO_OPERATOR_MULTIPLY

source and destination layers are multiplied. This causes the result to be at least as dark as the darker inputs.

CAIRO_OPERATOR_SCREEN

source and destination are complemented and multiplied. This causes the result to be at least as light as the lighter inputs.

CAIRO_OPERATOR_OVERLAY

multiplies or screens, depending on the lightness of the destination color.

CAIRO_OPERATOR_DARKEN

replaces the destination with the source if it is darker, otherwise keeps the source.

CAIRO_OPERATOR_LIGHTEN

replaces the destination with the source if it is lighter, otherwise keeps the source.

CAIRO_OPERATOR_COLOR_DODGE

brightens the destination color to reflect the source color.

CAIRO_OPERATOR_COLOR_BURN

darkens the destination color to reflect the source color.

CAIRO_OPERATOR_HARD_LIGHT

Multiplies or screens, dependant on source color.

CAIRO_OPERATOR_SOFT_LIGHT

Darkens or lightens, dependant on source color.

CAIRO_OPERATOR_DIFFERENCE

Takes the difference of the source and destination color.

CAIRO_OPERATOR_EXCLUSION

Produces an effect similar to difference, but with lower contrast.

CAIRO_OPERATOR_HSL_HUE

Creates a color with the hue of the source and the saturation and luminosity of the target.

CAIRO_OPERATOR_HSL_SATURATION

Creates a color with the saturation of the source and the hue and luminosity of the target. Painting with this mode onto a gray area prduces no change.

CAIRO_OPERATOR_HSL_COLOR

Creates a color with the hue and saturation of the source and the luminosity of the target. This preserves the gray levels of the target and is useful for coloring monochrome images or tinting color images.

CAIRO_OPERATOR_HSL_LUMINOSITY

Creates a color with the luminosity of the source and the hue and saturation of the target. This produces an inverse effect to CAIRO_OPERATOR_HSL_COLOR.

Meta