Sei sulla pagina 1di 5

PDF 32000-1:2008

NOTE 3

In contexts where a PDF page is treated as a piece of artwork to be placed on some other page it is treated not as a page but as a group, whose backdrop may be defined differently from that of a page.

11.3 Basic Compositing Computations


11.3.1 General

This sub-clause describes the basic computations for compositing a single object with its backdrop. These computations are extended in 11.4, "Transparency Groups," to cover groups consisting of multiple objects. 11.3.2 Basic Notation for Compositing Computations

In general, variable names in this clause consisting of a lowercase letter denote a scalar quantity, such as an opacity. Uppercase letters denote a value with multiple scalar components, such as a colour. In the descriptions of the basic colour compositing computations, colour values are generally denoted by the letter C, with a mnemonic subscript indicating which of several colour values is being referred to; for instance, Cs stands for source colour. Shape and opacity values are denoted respectively by the letters f (for form factor) and q (for opaqueness)again with a mnemonic subscript, such as qs for source opacity. The symbol (alpha) stands for a product of shape and opacity values. In certain computations, one or more variables may have undefined values; for instance, when opacity is equal to zero, the corresponding colour is undefined. A quantity can also be undefined if it results from division by zero. In any formula that uses such an undefined quantity, the quantity has no effect on the ultimate result because it is subsequently multiplied by zero or otherwise cancelled out. It is significant that while any arbitrary value may be chosen for such an undefined quantity, the computation shall not malfunction because of exceptions caused by overflow or division by zero. The further convention that 0 0 = 0 should also be adopted. 11.3.3 Basic Compositing Formula

The primary change in the imaging model to accommodate transparency is in how colours are painted. In the transparent model, the result of painting (the result colour) is a function of both the colour being painted (the source colour) and the colour it is painted over (the backdrop colour). Both of these colours may vary as a function of position on the page; however, this sub-clause focuses on some fixed point on the page and assumes a fixed backdrop and source colour. This computation uses two other parameters: alpha, which controls the relative contributions of the backdrop and source colours, and the blend function, which specifies how they shall be combined in the painting operation. The resulting basic colour compositing formula (or just basic compositing formula for short) shall determine the result colour produced by the painting operation:

s s C r = 1 ----- C b + ----- [ ( 1 b ) C s + b B ( C b , C s ) ] r r
where the variables have the meanings shown in Table 135. Table 135 Variables used in the basic compositing formula
Variable Meaning Backdrop colour Source colour Result colour

Cb Cs Cr

322

Adobe

Systems Incorporated 2008 All rights reserved

PDF 32000-1:2008

Table 135 Variables used in the basic compositing formula (continued)


Variable Meaning Backdrop alpha Source alpha Result alpha Blend function

b s r
B ( Cb , Cs )

This formula represents a simplified form of the compositing formula in which the shape and opacity values are combined and represented as a single alpha value; the more general form is presented later. This function is based on the over operation defined in the article Compositing Digital Images, by Porter and Duff (see the Bibliography), extended to include a blend mode in the region of overlapping coverage. The following subclauses elaborate on the meaning and implications of this formula. 11.3.4 Blending Colour Space

The compositing formula shown in 11.3.3, "Basic Compositing Formula," represents a vector function: the colours it operates on are represented in the form of n-element vectors, where n denotes the number of components required by the colour space in used in the compositing process. The ith component of the result colour Cr shall be obtained by applying the compositing formula to the ith components of the constituent colours Cb , Cs , and B (Cb, Cs ). The result of the computation thus depends on the colour space in which the colours are represented. For this reason, the colour space used for compositing, called the blending colour space, is explicitly made part of the transparent imaging model. When necessary, backdrop and source colours shall be converted to the blending colour space before the compositing computation. Of the PDF colour spaces described in Section 8.6, the following shall be supported as blending colour spaces: DeviceGray DeviceRGB DeviceCMYK CalGray CalRGB ICCBased colour spaces equivalent to the preceding (including calibrated CMYK)

The Lab space and ICCBased spaces that represent lightness and chromaticity separately (such as L*a*b*, L*u*v*, and HSV) shall not be used as blending colour spaces because the compositing computations in such spaces do not give meaningful results when applied separately to each component. In addition, an ICCBased space used as a blending colour space shall be bidirectional; that is, the ICC profile shall contain both AToB and BToA transformations. The blending colour space shall be consulted only for process colours. Although blending may also be done on individual spot colours specified in a Separation or DeviceN colour space, such colours shall not be converted to a blending colour space (except in the case where they first revert to their alternate colour space, as described under Section 8.6.6.4 and DeviceN Colour Spaces). Instead, the specified colour components shall be blended individually with the corresponding components of the backdrop. The blend functions for the various blend modes are defined such that the range for each colour component shall be 0.0 to 1.0 and that the colour space shall be additive. When performing blending operations in

Adobe

Systems Incorporated 2008 All rights reserved

323

PDF 32000-1:2008

subtractive colour spaces (DeviceCMYK, Separation, and DeviceN), the colour component values shall be complemented (subtracted from 1.0) before the blend function is applied and the results of the function shall then be complemented back before being used.
NOTE This adjustment makes the effects of the various blend modes numerically consistent across all colour spaces. However, the actual visual effect produced by a given blend mode still depends on the colour space. Blending in a device colour space produces device-dependent results, whereas in a CIE-based space it produces results that are consistent across all devices. See 11.7, "Colour Space and Rendering Issues," for additional details concerning colour spaces.

11.3.5

Blend Mode

In principle, any function of the backdrop and source colours that yields another colour, Cr, for the result may be used as a blend function B (Cb , Cs), in the compositing formula to customize the blending operation. PDF defines a standard set of named blend functions, or blend modes, listed in Tables 136 and 137. Figures L.18 and L.19 in Annex L illustrate the resulting visual effects for RGB and CMYK colours, respectively. A blend mode is termed separable if each component of the result colour is completely determined by the corresponding components of the constituent backdrop and source coloursthat is, if the blend mode function B is applied separately to each set of corresponding components:

cr = B ( cb , cs )
where the lowercase variables cr, cb , and cs denote corresponding components of the colours Cr , Cb , and Cs , expressed in additive form. A separable blend mode may be used with any colour space, since it applies independently to any number of components. Only separable blend modes shall be used for blending spot colours.
NOTE 1 Theoretically, a blend mode could have a different function for each colour component and still be separable; however, none of the standard PDF blend modes have this property.

Table 136 lists the standard separable blend modes available in PDF and the algorithms/formulas that shall be used in the calculation of blended colours. Table 136 Standard separable blend modes
Name Normal Result

B ( cb , cs ) = cs
NOTE Selects the source colour, ignoring the backdrop.

Compatible Multiply

Same as Normal. This mode exists only for compatibility and should not be used.

B ( cb , cs ) = cb cs
NOTE 1 NOTE 2 Multiplies the backdrop and source colour values. The result colour is always at least as dark as either of the two constituent colours. Multiplying any colour with black produces black; multiplying with white leaves the original colour unchanged. Painting successive overlapping objects with a colour other than black or white produces progressively darker colours.

324

Adobe

Systems Incorporated 2008 All rights reserved

PDF 32000-1:2008

Table 136 Standard separable blend modes (continued)


Name Screen Result

B ( cb , cs ) = 1 [ ( 1 cb ) ( 1 cs ) ] = cb + cs ( cb cs )
NOTE 3 Multiplies the complements of the backdrop and source colour values, then complements the result. The result colour is always at least as light as either of the two constituent colours. Screening any colour with white produces white; screening with black leaves the original colour unchanged. The effect is similar to projecting multiple photographic slides simultaneously onto a single screen.

NOTE 4

Overlay

B(c b, c s) = HardLight(c s, c b)
NOTE 5 Multiplies or screens the colours, depending on the backdrop colour value. Source colours overlay the backdrop while preserving its highlights and shadows. The backdrop colour is not replaced but is mixed with the source colour to reflect the lightness or darkness of the backdrop.

Darken

B ( c b , c s ) = min ( cb , c s )
NOTE 6 NOTE 7 Selects the darker of the backdrop and source colours. The backdrop is replaced with the source where the source is darker; otherwise, it is left unchanged.

Lighten

B ( c b , c s ) = max ( c b , c s )
NOTE 8 NOTE 9 Selects the lighter of the backdrop and source colours. The backdrop is replaced with the source where the source is lighter; otherwise, it is left unchanged.

ColorDodge

min(1, c b ( 1 c s )) B ( c b, c s ) = 1
NOTE 10

if c s < 1 if c s =

Brightens the backdrop colour to reflect the source colour. Painting with black produces no changes.

ColorBurn

1 min(1, ( 1 c b ) c s) B ( c b, c s ) = 0
NOTE 11

if c s > 0 if c s =

Darkens the backdrop colour to reflect the source colour. Painting with white produces no change.

HardLight

Multiply(c b, 2 c s) B ( c b, c s ) = Screen(c b, 2 c s 1)
NOTE 12

if c s 0.5 if c s > 0.5

Multiplies or screens the colours, depending on the source colour value. The effect is similar to shining a harsh spotlight on the backdrop.

Adobe

Systems Incorporated 2008 All rights reserved

325

PDF 32000-1:2008

Table 136 Standard separable blend modes (continued)


Name SoftLight Result

cb ( 1 2 cs ) cb ( 1 cb ) B(c b, c s) = c b + ( 2 c s 1 ) ( D(c b) c b )
where

if c s 0.5 if c s > 0.5

( ( 16 x 12 ) x + 4 ) x D(x) = x
NOTE 13

if x 0.25 if x > 0.25

Darkens or lightens the colours, depending on the source colour value. The effect is similar to shining a diffused spotlight on the backdrop.

Difference

B ( cb , cs ) = cb cs
NOTE 14 Subtracts the darker of the two constituent colours from the lighter colour: Painting with white inverts the backdrop colour; painting with black produces no change.

NOTE 15 Exclusion

B(c b, c s) = c b + c s 2 c b c s
NOTE 16 Produces an effect similar to that of the Difference mode but lower in contrast. Painting with white inverts the backdrop colour; painting with black produces no change.

Table 137 lists the standard nonseparable blend modes. Since the nonseparable blend modes consider all colour components in combination, their computation depends on the blending colour space in which the components are interpreted. They may be applied to all multiple-component colour spaces that are allowed as blending colour spaces (see Blending Colour Space).
NOTE 2 All of these blend modes conceptually entail the following steps: a) Convert the backdrop and source colours from the blending colour space to an intermediate HSL (huesaturation-luminosity) representation. b) Create a new colour from some combination of hue, saturation, and luminosity components selected from the backdrop and source colours. c) Convert the result back to the original (blending) colour space. However, the following formulas given do not actually perform these conversions. Instead, they start with whichever colour (backdrop or source) is providing the hue for the result; then they adjust this colour to have the proper saturation and luminosity.

The nonseparable blend mode formulas make use of several auxiliary functions. These functions operate on colours that are assumed to have red, green, and blue components. Blending of CMYK colour spaces requires special treatment, as described in this sub-clause. These functions shall have the following definitions:

Lum(C) = 0.3 C red + 0.59 C green + 0.11 C blue

326

Adobe

Systems Incorporated 2008 All rights reserved

Potrebbero piacerti anche