SunshinePHP 2016

The CairoOperator class


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

The default operator is CairoOperator::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

Class synopsis

CairoOperator {
/* Constants */
const integer CairoOperator::CLEAR = 0 ;
const integer CairoOperator::SOURCE = 1 ;
const integer CairoOperator::OVER = 2 ;
const integer CairoOperator::IN = 3 ;
const integer CairoOperator::OUT = 4 ;
const integer CairoOperator::ATOP = 5 ;
const integer CairoOperator::DEST = 6 ;
const integer CairoOperator::DEST_OVER = 7 ;
const integer CairoOperator::DEST_IN = 8 ;
const integer CairoOperator::DEST_OUT = 9 ;
const integer CairoOperator::DEST_ATOP = 10 ;
const integer CairoOperator::XOR = 11 ;
const integer CairoOperator::ADD = 12 ;
const integer CairoOperator::SATURATE = 13 ;

Predefined Constants

CairoOperator Node Types


Clear destination layer (bounded)


Replace destination layer (bounded)


Draw source layer on top of destination layer (bounded)


Draw source where there was destination content (unbounded)


Draw source where there was no destination content (unbounded)


Draw source on top of destination content and only there


Ignore the source


Draw destination on top of source


Leave destination only where there was source content (unbounded)


Leave destination only where there was no source content


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


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


Source and destination layers are accumulated


Like CairoOperator::OVER, but assuming source and dest are disjoint geometries

add a note add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top