Enumeration

NSCompositingOperation

Compositing operators, described in terms of having source and destination images, each having an opaque and transparent region.

Declaration

typedef enum NSCompositingOperation : NSUInteger {
    ...
} NSCompositingOperation;

Overview

The final output is determined by the type of operation, the source image, and the destination image.

These compositing operators are defined in and used by compositeToPoint:fromRect:operation:, compositeToPoint:operation:, compositeToPoint:fromRect:operation:fraction:, compositeToPoint:operation:fraction:, drawAtPoint:fromRect:operation:fraction:, and drawInRect:fromRect:operation:fraction:. They are also used by drawing methods in other classes that take a compositing operator.

The equations after each constant represent the mathematical formulas used to calculate the color value of the resulting pixel. Table 1 lists the meaning of each placeholder value in the equations.

Table 1

Placeholder values for compositing equations

Placeholder

Meaning

R

The premultiplied result color.

S

The source color.

D

The destination color.

Sa

The alpha value of the source color.

Da

The alpha value of the destination color.

Topics

Compositing Operations

NSCompositingOperationClear

Transparency everywhere.

NSCompositingOperationSourceOver

The source image wherever it is opaque, and the destination image elsewhere.

NSCompositingOperationSourceIn

The source image wherever both images are opaque, and transparent elsewhere.

NSCompositingOperationSourceOut

The source image wherever it is opaque and the destination image is transparent, and transparent elsewhere.

NSCompositingOperationSourceAtop

The source image wherever both images are opaque, the destination image wherever it is opaque but the source image is transparent, and transparent elsewhere

NSCompositingOperationDestinationOver

The destination image wherever it is opaque, and the source image elsewhere.

NSCompositingOperationDestinationIn

The destination image wherever both images are opaque, and transparent elsewhere.

NSCompositingOperationDestinationOut

The destination image wherever it is opaque and the source image is transparent, and transparent elsewhere.

NSCompositingOperationDestinationAtop

The destination image wherever both images are opaque, the source image wherever it is opaque and the destination image is transparent, and transparent elsehwere.

NSCompositingOperationXOR

Exclusive OR of the source and destination images.

NSCompositingOperationPlusDarker

The sum of the source and destination images, with color values approach 0 as a limit.

NSCompositingOperationPlusLighter

The sum of the source and destination images, with color values approach 1 as a limit.

NSCompositingOperationMultiply

The source color is multiplied by the destination color.

NSCompositingOperationScreen

Multiplies the complement of the destination and source color values, and then complements the result.

NSCompositingOperationOverlay

Source colors overlay the destination.

NSCompositingOperationDarken

Use the darker of the source and destination colors.

NSCompositingOperationLighten

Use the lighter of the source and destination colors.

NSCompositingOperationColorDodge

Brightens the destination to reflect the source.

NSCompositingOperationColorBurn

Darkens the destination color to reflect the source.

NSCompositingOperationSoftLight

Darkens or lightens colors, with the effect of shining a diffused spotlight on the destination.

NSCompositingOperationHardLight

Multiplies or screens colors, with the effect of shining a spotlight on the destination.

NSCompositingOperationDifference

Subtracts the darker value from the lighter value.

NSCompositingOperationExclusion

Subtracts the darker value from the lighter value, except lower in contrast.

NSCompositingOperationHue

Uses the hue of the source and the saturation and luminosity of the destination.

NSCompositingOperationSaturation

Uses the saturation value of the source and the hue and luminosity of the destination.

NSCompositingOperationColor

Uses the hue and saturation of the source and the luminosity of the destination.

NSCompositingOperationLuminosity

Uses the luminosity of the source and the hue and saturation of the destination.

Deprecated Compositing Modes

NSCompositeClear

Transparent. (R = 0)

Deprecated
NSCompositeCopy

Source image. (R = S)

Deprecated
NSCompositeSourceOver

Source image wherever source image is opaque, and destination image elsewhere. (R = S + D*(1 - Sa))

Deprecated
NSCompositeSourceIn

Source image wherever both images are opaque, and transparent elsewhere. (R = S*Da)

Deprecated
NSCompositeSourceOut

Source image wherever source image is opaque but destination image is transparent, and transparent elsewhere. (R = S*(1 - Da))

Deprecated
NSCompositeSourceAtop

Source image wherever both images are opaque, destination image wherever destination image is opaque but source image is transparent, and transparent elsewhere. (R = S*Da + D*(1 - Sa))

Deprecated
NSCompositeDestinationOver

Destination image wherever destination image is opaque, and source image elsewhere. (R = S*(1 - Da) + D)

Deprecated
NSCompositeDestinationIn

Destination image wherever both images are opaque, and transparent elsewhere. (R = D*Sa)

Deprecated
NSCompositeDestinationOut

Destination image wherever destination image is opaque but source image is transparent, and transparent elsewhere. (R = D*(1 - Sa))

Deprecated
NSCompositeDestinationAtop

Destination image wherever both images are opaque, source image wherever source image is opaque but destination image is transparent, and transparent elsewhere. (R = S*(1 - Da) + D*Sa)

Deprecated
NSCompositeXOR

Exclusive OR of source and destination images. (R = S*(1 - Da) + D*(1 - Sa))

Deprecated
NSCompositePlusDarker

Sum of source and destination images, with color values approaching 0 as a limit. (R = MAX(0, (1 - D) + (1 - S)))

Deprecated
NSCompositeHighlight

Source image wherever source image is opaque, and destination image elsewhere.

Deprecated
NSCompositePlusLighter

Sum of source and destination images, with color values approaching 1 as a limit. (R = MIN(1, S + D))

Deprecated
NSCompositingOperationHighlight

The source image wherever it is opaque, and the destination image elsewhere.

Deprecated
NSCompositeHueDeprecated

See Also

Configuring Rendering Options

compositingOperation

The receiver’s global compositing operation setting.

imageInterpolation

A constant that specifies the receiver’s interpolation (image smoothing) behavior.

NSImageInterpolation

Interpolations used by the imageInterpolation property.

shouldAntialias

A Boolean value indicating whether the receiver uses antialiasing.

patternPhase

The amount to offset the pattern color when filling the receiver.