Skip to content

PDF Spec 11 Model

Marc Jones edited this page Dec 30, 2025 · 1 revision

11.1-11.3 Transparency Model

Part of: PDF-Spec-11-Transparency

Navigation: ← Previous | PDF-Spec-Index | PDF-Spec-11-Groups


11.1 General

The PDF imaging model includes the notion of transparency . Transparent objects do not necessarily obey a strict opaque painting model but may blend (composite) in interesting ways with other overlapping objects. This clause describes the general transparency model but does not cover how it is implemented. At various points it uses implementation-like descriptions to describe how things work, for the purpose of elucidating the behaviour of the model. The actual implementation will almost certainly be different from what these descriptions might imply.

NOTE Transparency was added to PDF in version 1.4

The clause is organized as follows:

  • 11.2, "Overview of Transparency," introduces the basic concepts of the transparency model and its associated terminology.
  • 11.3, "Basic Compositing Computations," describes the mathematics involved in compositing a single object with its backdrop.
  • 11.4, "Transparency Groups," introduces the concept of transparency groups and describes their properties and behaviour.
  • 11.5, "Soft Masks," covers the creation and use of masks to specify position-dependent shape and opacity.
  • 11.6, "Specifying Transparency in PDF," describes how transparency properties are represented in a PDF document.
  • 11.7, "Colour Space and Rendering Issues," deals with some specific interactions between transparency and other aspects of colour specification and rendering.

11.2 Overview of Transparency

The original PDF imaging model paints objects (fills, strokes, text, and images), possibly clipped by a path, opaquely onto a page. The colour of the page at any point shall be that of the topmost enclosing object, disregarding any previous objects it may overlap. This effect may be-and often is-realized simply by rendering objects directly to the page in the order in which they are specified, with each object completely overwriting any others that it overlaps.

Under the transparent imaging model, all of the objects on a page may potentially contribute to the result. Objects at a given point may be thought of as forming a transparency stack (or stack for short). The objects shall be arranged from bottom to top in the order in which they are specified. The colour of the page at each point shall be determined by combining the colours of all enclosing objects in the stack according to compositing rules defined by the transparency model.

  • NOTE 1 The order in which objects are specified determines the stacking order but not necessarily the order in which the objects are actually painted onto the page. In particular, the transparency model does not require a conforming reader to rasterize objects immediately or to commit to a raster representation at any time before rendering the entire stack onto the page. This is important, since rasterization often causes significant loss of information and precision that is best avoided during intermediate stages of the transparency computation.

A given object shall be composited with a backdrop . Ordinarily, the backdrop consists of the stack of all objects that have been specified previously. The result of compositing shall then be treated as the backdrop for the next object. However, within certain kinds of transparency groups (see 'Transparency Groups'), a different backdrop may be chosen.

During the compositing of an object with its backdrop, the colour at each point shall be computed using a specified blend mode , which is a function of both the object's colour and the backdrop colour. The blend mode shall determine how colours interact; different blend modes may be used to achieve a variety of useful effects. A single blend mode shall be in effect for compositing all of a given object, but different blend modes may be applied to different objects.

Two scalar quantities called shape and opacity mediate compositing of an object with its backdrop. Conceptually, for each object, these quantities shall be defined at every point in the plane, just as if they were additional colour components. (In actual practice, they may be obtained from auxiliary sources rather than being intrinsic to the object.)

Both shape and opacity vary from 0.0 (no contribution) to 1.0 (maximum contribution). At any point where either the shape or the opacity of an object is equal to 0.0, its colour shall be undefined. At points where the shape is equal to 0.0, the opacity shall also be undefined. The shape and opacity shall be subject to compositing rules; therefore, the stack as a whole also has a shape and opacity at each point.

An object's opacity, in combination with the backdrop's opacity, shall determine the relative contributions of the backdrop colour, the object's colour, and the blended colour to the resulting composite colour. The object's shape shall then determine the degree to which the composite colour replaces the backdrop colour. Shape values of 0.0 and 1.0 identify points that lie outside and inside a conventional sharp-edged object; intermediate values are useful in defining soft-edged objects.

Shape and opacity are conceptually very similar. In fact, they can usually be combined into a single value, called alpha , which controls both the colour compositing computation and the fading between an object and its backdrop. However, there are a few situations in which they shall be treated separately; see 11.4.6, "Knockout Groups."

  • NOTE 2 Raster-based implementations may need to maintain a separate shape parameter to do anti-aliasing properly; it is therefore convenient to have shape as an explicit part of the model.

One or more consecutive objects in a stack may be collected together into a transparency group (often referred to hereafter simply as a group ). The group as a whole may have various properties that modify the compositing behaviour of objects within the group and their interactions with its backdrop. An additional blend mode, shape, and opacity may also be associated with the group as a whole and used when compositing it with its backdrop. Groups may be nested within other groups, forming a tree-structured hierarchy.

  • EXAMPLE Figure L.16 in Annex L illustrates the effects of transparency grouping. In the upper two figures, three coloured circles are painted as independent objects with no grouping. At the upper left, the three objects are painted opaquely (opacity = 1.0); each object completely replaces its backdrop (including previously painted objects) with its own colour. At the upper right, the same three independent objects are painted with an opacity of 0.5, causing them to composite with each other and with the gray and white backdrop. In the lower two figures, the three objects are combined as a transparency group. At the lower left, the individual objects have an opacity of 1.0 within the group, but the group as a whole is painted in the Normal blend mode with an opacity of 0.5. The objects thus completely overwrite each other within the group, but the resulting group then composites transparently with the gray and white backdrop. At the lower right, the objects have an opacity of 0.5 within the group and thus composite with each other. The group as a whole is painted against the backdrop with an opacity of 1.0 but in a different blend mode ( HardLight ), producing a different visual effect.

The colour result of compositing a group may be converted to a single-component luminosity value and treated as a soft mask . Such a mask may then be used as an additional source of shape or opacity values for subsequent compositing operations. When the mask is used as a shape, this technique is known as soft clipping ; it is a generalization of the current clipping path in the opaque imaging model (see 'Clipping Path Operators').

The notion of current page is generalized to refer to a transparency group consisting of the entire stack of objects placed on the page, composited with a backdrop that is pure white and fully opaque. Logically, this entire stack shall then be rasterized to determine the actual pixel values to be transmitted to the output device.

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, C s stands for 'source colour.' Shape and opacity values are denoted respectively by the letters f (for ' f orm factor') and q (for 'opa q ueness')-again with a mnemonic subscript, such as q s 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:

where the variables have the meanings shown in Table 135.

Table 135 - Variables used in the basic compositing formula

Variable Meaning
C b Backdrop colour
C s Source colour
C r Result colour

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

Variable Meaning
α b Backdrop alpha
α s Source alpha
α r Result alpha
B C b C s , ( ) Blend function

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 i th component of the result colour C r shall be obtained by applying the compositing formula to the i th components of the constituent colours C b , C s , and B ( C b , C s ). 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 Lab* , Luv* , 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

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, C r , for the result may be used as a blend function B ( C b , C s ), 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 colours-that is, if the blend mode function B is applied separately to each set of corresponding components:

where the lowercase variables c r , c b , and c s denote corresponding components of the colours C r , C b , and C s , 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 Result
Normal NOTE Selects the source colour, ignoring the backdrop. B c b c s , ( ) c s =
Compatible Same as Normal. This mode exists only for compatibility and should not be used.
Multiply NOTE 1 Multiplies the backdrop and source colour values. NOTE 2 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. B c b c s , ( ) c b c s × =

Table 136 - Standard separable blend modes (continued)

Name Result
Screen NOTE 3 Multiplies the complements of the backdrop and source colour values, then complements the result. NOTE 4 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. B c b c s , ( ) 1 1 c b - ( ) 1 c s - ( ) × [ ] - = c b c s c b c s × ( ) - + =
Overlay 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. B c b c s , ( ) HardLight c s c b , ( ) =
Darken NOTE 6 Selects the darker of the backdrop and source colours. NOTE 7 The backdrop is replaced with the source where the source is darker; otherwise, it is left unchanged. B c b c s , ( ) min c b c s , ( ) =
Lighten NOTE 8 Selects the lighter of the backdrop and source colours. NOTE 9 The backdrop is replaced with the source where the source is lighter; B c b c s , ( ) max c b c s , ( ) =
ColorDodge B c b c s , ( ) min 1 c b 1 c s - ( ) ⁄ , ( ) if c s 1 < 1 if c s = ⎩ ⎨ ⎧ =
ColorBurn NOTE 11 Darkens the backdrop colour to reflect the source colour. Painting with white produces no change. B c b c s , ( ) 1 min 1 1 c b - ( ) c s ⁄ , ( ) - if c s 0 > 0 if c s = ⎩ ⎨ ⎧ =
HardLight NOTE 12 Multiplies or screens the colours, depending on the source colour value. The effect is similar to shining a harsh spotlight on the backdrop. B c b c s , ( ) Multiply c b 2 c s × , ( ) if c s 0.5 ≤ Screen c b 2 c s 1 - × , ( ) if c s 0.5 > ⎩ ⎨ ⎧ =

Table 136 - Standard separable blend modes (continued)

Name Result
SoftLight where NOTE 13 Darkens or lightens the colours, depending on the source colour value. The effect is similar to shining a diffused spotlight on the backdrop. B c b c s , ( ) c b 1 2 c s × - ( ) c b 1 c b - ( ) × × - if c s 0.5 ≤ c b 2 c s 1 - × ( ) D c b ( ) c b - ( ) × + if c s 0.5 > ⎩ ⎨ ⎧ = D x ( ) 16 x 12 - × ( ) x 4 + × ( ) x × if x 0.25 ≤ x if x 0.25 > ⎩ ⎨ ⎧ =
Difference NOTE 14 Subtracts the darker of the two constituent colours from the lighter colour: NOTE 15 Painting with white inverts the backdrop colour; painting with black produces no change. B c b c s , ( ) c b c s - =
Exclusion 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. B c b c s , ( ) c b c s 2 c b c × × s - + =

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:

SetLum C l , ( ) let d l Lum C ( ) C red -C red d C green + C green d C blue + C blue d returnClipColor C ( ) + = = = = ClipColor C ( ) let l Lum C ( ) let n min C red C green C blue , , ( ) let x max C red C green C blue , , ( ) if n 0.0 C red < l C red l -( ) l × ( ) l n -( ) / ( ) C green + l C green l -( ) l × ( ) l n -( ) / ( ) C blue + l C blue l -( ) l × ( ) l n -( ) / ( ) if x 1.0 C red > + l C red l -( ) 1 l -( ) × ( ) x l -( ) / ( ) C green + l C green l -( ) 1 l -( ) × ( ) x l -( ) / ( ) C blue + l C blue l -( ) 1 l -( ) × ( ) x l -( ) / ( ) return C + = = = = = = = = =

The subscripts min , mid , and max (in the next function) refer to the colour components having the minimum, middle, and maximum values upon entry to the function.

SetSat C s , ( ) if C max C min C mid > C mid C min -( ) s × ( ) C max C min -( ) / ( ) C max s else C mid C max 0.0 C min 0.0 return C = = = = =

Table 137 - Standard nonseparable blend modes

Name Result
Hue NOTE 1 Creates a colour with the hue of the source colour and the saturation and luminosity of the backdrop colour. B C b C s , ( ) SetLum SetSat C s Sat C b ( ) , ( ) Lum C b ( ) , ( ) =
Saturation NOTE 2 Creates a colour with the saturation of the source colour and the hue and luminosity of the backdrop colour. Painting with this mode in an area of the backdrop that is a pure gray (no saturation) produces no change. B C b C s , ( ) SetLum SetSat C b Sat C s ( ) , ( ) Lum C b ( ) , ( ) =

Table 137 - Standard nonseparable blend modes (continued)

| Name | Result |


Navigation: ← Previous | PDF-Spec-Index | PDF-Spec-11-Groups

Clone this wiki locally