The
cairo-operator-t enumeration is used to set the compositing
operator for all Cairo drawing operations. The default operator is
: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
Cairo's Compositing Operators.
(defcenum cairo-operator-t
:clear
:source
:over
:in
:out
:atop
:dest
:dest-over
:dest-in
:dest-out
:dest-atop
:xor
:add
:saturate
:multiply
:screen
:overlay
:darken
:lighten
:color-dodge
:color-burn
:hard-light
:soft-ligth
:difference
:exclusion
:hsl-hue
:hsl-saturation
:hsl-color
:hsl-luminosity)
- :clear
- Clear destination layer (bounded).
- :source
- Replace destination layer (bounded).
- :over
- Draw source layer on top of destination layer (bounded).
- :in
- Draw source where there was destination content (unbounded).
- :out
- Draw source where there was no destination content (unbounded).
- :atop
- Draw source on top of destination content and only there.
- :dest
- Ignore the source.
- :dest-over
- Draw destination on top of source.
- :dest-in
- Leave destination only where there was source content (unbounded).
- :dest-out
- Leave destination only where there was no source content.
- :dest-atop
- Leave destination on top of source content and only there (unbounded).
- :xor
- Source and destination are shown where there is only one of them.
- :add
- Source and destination layers are accumulated.
- :saturate
- Like over, but assuming source and dest are disjoint geometries.
- :multiply
- Source and destination layers are multiplied. This causes the result to be at least as dark as the darker inputs.
- :screen
- Source and destination are complemented and multiplied. This causes the result to be at least as light as the lighter inputs.
- :overlay
- Multiplies or screens, depending on the lightness of the destination color.
- :darken
- Replaces the destination with the source if it is darker, otherwise keeps the source.
- :lighten
- Replaces the destination with the source if it is lighter, otherwise keeps the source.
- :dodge
- Brightens the destination color to reflect the source color.
- :burn
- Darkens the destination color to reflect the source color.
- :hard-light
- Multiplies or screens, dependent on source color.
- :soft-light
- Darkens or lightens, dependent on source color.
- :difference
- Takes the difference of the source and destination color.
- :exclusion
- Produces an effect similar to difference, but with lower contrast.
- :hsl-hue
- Creates a color with the hue of the source and the saturation and luminosity of the target.
- :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 produces no change.
- :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.
- :hsl-luinosity
- Creates a color with the luminosity of the source
and the hue and saturation of the target. This produces an inverse effect to :hsl-color.