enum Cairo::Operator

Overview

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

The default operator is 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 https://cairographics.org/operators/.

Defined in:

cairo/operator.cr

Enum Members

Clear = 0

Clear destination layer (bounded).

Source = 1

Replace destination layer (bounded).

Over = 2

Draw source layer on top of destination layer.

In = 3

Draw source where there was destination content (unbounded).

Out = 4

Draw source where there was no destination content (unbounded).

Atop = 5

Draw source on top of destination content and only there.

Dest = 6

Ignore the source.

DestOver = 7

Draw destination on top of source.

DestIn = 8

Leave destination only where there was source content (unbounded).

DestOut = 9

Leave destination only where there was no source content.

DestAtop = 10

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

Xor = 11

Source and destination are shown where there is only one of them.

Add = 12

Source and destination layers are accumulated.

Saturate = 13

Like over, but assuming source and dest are disjoint geometries.

Multiply = 14

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

Screen = 15

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

Overlay = 16

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

Darken = 17

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

Lighten = 18

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

ColorDodge = 19

Brightens the destination color to reflect the source color.

ColorBurn = 20

Darkens the destination color to reflect the source color.

HardLight = 21

Multiplies or screens, dependent on source color.

SoftLight = 22

Darkens or lightens, dependent on source color.

Difference = 23

Takes the difference of the source and destination color.

Exclusion = 24

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

HslHue = 25

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

HslSaturation = 26

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.

HslColor = 27

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.

HslLuminosity = 28

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

Instance Method Summary

Instance Method Detail

def add? #

[View source]
def atop? #

[View source]
def clear? #

[View source]
def color_burn? #

[View source]
def color_dodge? #

[View source]
def darken? #

[View source]
def dest? #

[View source]
def dest_atop? #

[View source]
def dest_in? #

[View source]
def dest_out? #

[View source]
def dest_over? #

[View source]
def difference? #

[View source]
def exclusion? #

[View source]
def hard_light? #

[View source]
def hsl_color? #

[View source]
def hsl_hue? #

[View source]
def hsl_luminosity? #

[View source]
def hsl_saturation? #

[View source]
def in? #

[View source]
def lighten? #

[View source]
def multiply? #

[View source]
def out? #

[View source]
def over? #

[View source]
def overlay? #

[View source]
def saturate? #

[View source]
def screen? #

[View source]
def soft_light? #

[View source]
def source? #

[View source]
def xor? #

[View source]