enum

Cairo::Operator

Inherits Enum / Comparable / Value / Object

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/.

Constants

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 methods

add?

Returns true if this enum value equals Add

Source
atop?

Returns true if this enum value equals Atop

Source
clear?

Returns true if this enum value equals Clear

Source
color_burn?

Returns true if this enum value equals ColorBurn

Source
color_dodge?

Returns true if this enum value equals ColorDodge

Source
darken?

Returns true if this enum value equals Darken

Source
dest?

Returns true if this enum value equals Dest

Source
dest_atop?

Returns true if this enum value equals DestAtop

Source
dest_in?

Returns true if this enum value equals DestIn

Source
dest_out?

Returns true if this enum value equals DestOut

Source
dest_over?

Returns true if this enum value equals DestOver

Source
difference?

Returns true if this enum value equals Difference

Source
exclusion?

Returns true if this enum value equals Exclusion

Source
hard_light?

Returns true if this enum value equals HardLight

Source
hsl_color?

Returns true if this enum value equals HslColor

Source
hsl_hue?

Returns true if this enum value equals HslHue

Source
hsl_luminosity?

Returns true if this enum value equals HslLuminosity

Source
hsl_saturation?

Returns true if this enum value equals HslSaturation

Source
in?

Returns true if this enum value equals In

Source
lighten?

Returns true if this enum value equals Lighten

Source
multiply?

Returns true if this enum value equals Multiply

Source
out?

Returns true if this enum value equals Out

Source
over?

Returns true if this enum value equals Over

Source
overlay?

Returns true if this enum value equals Overlay

Source
saturate?

Returns true if this enum value equals Saturate

Source
screen?

Returns true if this enum value equals Screen

Source
soft_light?

Returns true if this enum value equals SoftLight

Source
source?

Returns true if this enum value equals Source

Source
xor?

Returns true if this enum value equals Xor

Source