Skip to content

PDF Spec 11 Groups

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

11.4 Transparency Groups

Part of: PDF-Spec-11-Transparency

Navigation: PDF-Spec-11-Model | PDF-Spec-Index | PDF-Spec-11-Soft-Masks


|------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | Color | NOTE 3 Creates a colour with the hue and saturation of the source colour and the luminosity of the backdrop colour. This preserves the gray levels of the backdrop and is useful for colouring monochrome images or tinting colour images. B C b C s , ( ) SetLum C s Lum C b ( ) , ( ) = | | Luminosity | NOTE 4 Creates a colour with the luminosity of the source colour and the hue and saturation of the backdrop colour. This produces an inverse effect to that of the Color mode. B C b C s , ( ) SetLum C b Lum C s ( ) , ( ) = |

The formulas in this sub-clause apply to RGB spaces. Blending in CMYK spaces (including both DeviceCMYK and ICCBased calibrated CMYK spaces) shall be handled in the following way:

  • The C , M , and Y components shall be converted to their complementary R , G , and B components in the usual way. The preceding formulas shall be applied to the RGB colour values. The results shall be converted back to C , M , and Y .
  • For the K component, the result shall be the K component of C b for the Hue , Saturation , and Color blend modes; it shall be the K component of C s for the Luminosity blend mode.

11.3.6 Interpretation of Alpha

The colour compositing formula

produces a result colour that is a weighted average of the backdrop colour, the source colour, and the blended B ( C b , C s ) term, with the weighting determined by the backdrop and source alphas α β and α s . For the simplest blend mode, Normal , defined by

the compositing formula collapses to a simple weighted average of the backdrop and source colours, controlled by the backdrop and source alpha values. For more interesting blend functions, the backdrop and source alphas control whether the effect of the blend mode is fully realized or is toned down by mixing the result with the backdrop and source colours.

The result alpha, α ρ , actually represents a computed result, described in 11.3.7, "Shape and Opacity Computations." The result colour shall be normalized by the result alpha, ensuring that when this colour and alpha are subsequently used together in another compositing operation, the colour's contribution is correctly represented.

NOTE 1 If α ρ is zero, the result colour is undefined.

  • NOTE 2 The preceding formula represents a simplification of the following formula, which presents the relative contributions of backdrop, source, and blended colours in a more straightforward way:

(The simplification requires a substitution based on the alpha compositing formula, which is presented in the next sub-clause.) Thus, mathematically, the backdrop and source alphas control the influence of the backdrop and source colours, respectively, while their product controls the influence of the blend function. An alpha value of α s = 0.0 or α β = 0.0 results in no blend mode effect; setting α s = 1.0 and α β = 1.0 results in maximum blend mode effect.

11.3.7 Shape and Opacity Computations

11.3.7.1 General

As stated earlier, the alpha values that control the compositing process shall be defined as the product of shape and opacity:

This sub-clause examines the various shape and opacity values individually. Once again, keep in mind that conceptually these values are computed for every point on the page.

11.3.7.2 Source Shape and Opacity

Shape and opacity values may come from several sources. The transparency model provides for three independent sources for each. However, the PDF representation imposes some limitations on the ability to specify all of these sources independently (see 'Specifying Shape and Opacity').

  • Object shape . Elementary objects such as strokes, fills, and text have an intrinsic shape, whose value shall be 1.0 for points inside the object and 0.0 outside. Similarly, an image with an explicit mask (see 'Explicit Masking') has a shape that shall be 1.0 in the unmasked portions and 0.0 in the masked portions. The shape of a group object shall be the union of the shapes of the objects it contains.
  • NOTE 1 Mathematically, elementary objects have 'hard' edges, with a shape value of either 0.0 or 1.0 at every point. However, when such objects are rasterized to device pixels, the shape values along the boundaries may be anti-aliased, taking on fractional values representing fractional coverage of those pixels. When such antialiasing is performed, it is important to treat the fractional coverage as shape rather than opacity.
  • Mask shape . Shape values for compositing an object may be taken from an additional source, or soft mask , independent of the object itself, as described in 11.5, "Soft Masks."

NOTE 2 The use of a soft mask to modify the shape of an object or group, called soft clipping , can produce effects such as a gradual transition between an object and its backdrop, as in a vignette.

  • Constant shape . The source shape may be modified at every point by a scalar shape constant .

NOTE 3 This is merely a convenience, since the same effect could be achieved with a shape mask whose value is the same everywhere.

  • Object opacity . Elementary objects have an opacity of 1.0 everywhere. The opacity of a group object shall be the result of the opacity computations for all of the objects it contains.
  • Mask opacity . Opacity values, like shape values, may be provided by a soft mask independent of the object being composited.
  • Constant opacity . The source opacity may be modified at every point by a scalar opacity constant .
  • NOTE 4 It is useful to think of this value as the 'current opacity,' analogous to the current colour used when painting elementary objects.

All of the shape and opacity inputs shall have values in the range 0.0 to 1.0 (inclusive), with a default value of 1.0.

The three shape inputs shall be multiplied together, producing an intermediate value called the source shape.

The three opacity inputs shall be multiplied together, producing an intermediate value called the source opacity.

Where the variables have the meanings shown in Table 138.

Table 138 - Variables used in the source shape and opacity formulas

Variable Meaning
f s Source shape
f j Object shape
f m Mask shape
f k Constant shape
q s Source opacity
q j Object opacity
q m Mask opacity
q k Constant opacity

NOTE 5 The effect of each of these inputs is that the painting operation becomes more transparent as the input values decreases.

When an object is painted with a tiling pattern, the object shape and object opacity for points in the object's interior are determined by those of corresponding points in the pattern, rather than being 1.0 everywhere (see 'Patterns and Transparency').

11.3.7.3 Result Shape and Opacity

In addition to a result colour, the painting operation also shall compute an associated result shape and result opacity . These computations shall be based on the union function

where b and s shall be the backdrop and source values to be composited.

NOTE 1 This is a generalization of the conventional concept of union for opaque shapes, and it can be thought of as an 'inverted multiplication'-a multiplication with the inputs and outputs complemented. The result tends toward 1.0: if either input is 1.0, the result is 1.0.

The result shape and opacity shall be given by

where the variables have the meanings shown in Table 139.

Table 139 - Variables used in the result shape and opacity formulas

Variable Meaning
f r Result shape
f b Backdrop shape
f s Source shape
q r Result opacity
q b Backdrop opacity
q s Source opacity

These formulas shall be interpreted as follows:

  • The result shape shall be the union of the backdrop and source shapes.
  • The result opacity shall be the union of the backdrop and source opacities, weighted by their respective shapes. The result shall then be divided by (normalized by) the result shape.

NOTE 2 Since alpha is just the product of shape and opacity, it can easily be shown that

This formula can be used whenever the independent shape and opacity are not needed.

11.3.8 Summary of Basic Compositing Computations

This sub-clause is a summary of all the computations presented in this sub-clause. They are given in an order such that no variable is used before it is computed; also, some of the formulas have been rearranged to simplify them. See Tables 135, 138, and 139 for the meanings of the variables used in these formulas.

11.4 Transparency Groups

11.4.1 General

A transparency group is a sequence of consecutive objects in a transparency stack that shall be collected together and composited to produce a single colour, shape, and opacity at each point. The result shall then be treated as if it were a single object for subsequent compositing operations. Groups may be nested within other groups to form a tree-structured group hierarchy.

NOTE This facilitates creating independent pieces of artwork, each composed of multiple objects, and then combining them, possibly with additional transparency effects applied during the combination.

The objects contained within a group shall be treated as a separate transparency stack called the group stack . The objects in the stack shall be composited against an initial backdrop (discussed later), producing a composite colour, shape, and opacity for the group as a whole. The result is an object whose shape is the union of the shapes of its constituent objects and whose colour and opacity are the result of the compositing operations. This object shall then be composited with the group's backdrop in the usual way.

In addition to its computed colour, shape, and opacity, the group as a whole may have several further attributes:

  • All of the input variables that affect the compositing computation for individual objects may also be applied when compositing the group with its backdrop. These variables include mask and constant shape, mask and constant opacity, and blend mode.
  • The group may be isolated or non-isolated , which shall determine the initial backdrop against which its stack is composited.
  • The group may be knockout or non-knockout , which shall determine whether the objects within its stack are composited with one another or only with the group's backdrop.
  • An isolated group may specify its own blending colour space, independent of that of the group's backdrop.
  • Instead of being composited onto the current page, a group's results may be used as a source of shape or opacity values for creating a soft mask (see 'Soft Masks').

11.4.2 Notation for Group Compositing Computations

This sub-clause introduces some notation for dealing with group compositing. Subsequent sub-clauses describe the group compositing formulas for a non-isolated, non-knockout group and the special properties of isolated and knockout groups.

Since we are now dealing with multiple objects at a time, it is useful to have some notation for distinguishing among them. Accordingly, the variables introduced earlier are altered to include a second-level subscript denoting an object's position in the transparency stack.

stands for the source colour of the i th object in the stack. The subscript 0 represents the initial backdrop; subscripts 1 to n denote the bottommost to topmost objects in an n-element stack. In addition, the subscripts b and r are dropped from the variables C b , f β , q β , α β , C r , f ρ , q ρ , and α ρ ; other variables retain their mnemonic subscripts. Cs i

These conventions permit the compositing formulas to be restated as recurrence relations among the elements of a stack. For instance, the result of the colour compositing computation for object i is denoted by C i (formerly C r ). This computation takes as one of its inputs the immediate backdrop colour, which is the result of the colour compositing computation for object i -1; this is denoted by C i -1 (formerly C b ).

The revised formulas for a simple n -element stack (not including any groups) shall be, for i = 1, … , n :

where the variables have the meanings shown in Table 140.

NOTE Compare these formulas with those shown in 11.3.8, "Summary of Basic Compositing Computations."

Table 140 - Revised variables for the basic compositing formulas

Variable Meaning
f s i Source shape for object i
f j i Object shape for object i
f m i Mask shape for object i
f k i Constant shape for object i
f i Result shape after compositing object i

Table 140 - Revised variables for the basic compositing formulas (continued)

Variable Meaning
q s i Source opacity for object i
q j i Object opacity for object i
q m i Mask opacity for object i
q k i Constant opacity for object i
q i Result opacity after compositing object i
α s i Source alpha for object i
α i Result alpha after compositing object i
C s i Source colour for object i
C i Result colour after compositing object i
B i C i 1 - C s i , ( ) Blend function for object i

11.4.3 Group Structure and Nomenclature

As stated earlier, the elements of a group shall be treated as a separate transparency stack, referred to as the group stack. These objects shall be composited against a selected initial backdrop and the resulting colour, shape, and opacity shall then be treated as if they belonged to a single object. The resulting object is in turn composited with the group's backdrop in the usual way.

NOTE

This computation entails interpreting the stack as a tree. For an n -element group that begins at position i in the stack, it treats the next n objects as an n -element substack, whose elements are given an independent numbering of 1 to n . These objects are then removed from the object numbering in the parent (containing) stack and replaced by the group object, numbered i , followed by the remaining objects to be painted on top of the group, renumbered starting at i + 1. This operation applies recursively to any nested subgroups.

The term element (denoted E i ) refers to a member of some group; it can be either an individual object or a contained subgroup.

From the perspective of a particular element in a nested group, there are three different backdrops of interest:

  • The group backdrop is the result of compositing all elements up to but not including the first element in the group. (This definition is altered if the parent group is a knockout group; see 11.4.6, "Knockout Groups")
  • The initial backdrop is a backdrop that is selected for compositing the group's first element. This is either the same as the group backdrop (for a non-isolated group) or a fully transparent backdrop (for an isolated group).
  • The immediate backdrop is the result of compositing all elements in the group up to but not including the current element.

When all elements in a group have been composited, the result shall be treated as if the group were a single object, which shall then be composited with the group backdrop. This operation shall occur whether the initial

backdrop chosen for compositing the elements of the group was the group backdrop or a transparent backdrop. A conforming reader shall ensure that the backdrop's contribution to the overall result is applied only once.

11.4.4 Group Compositing Computations

The colour and opacity of a group shall be defined by the group compositing function :

where the variables have the meanings shown in Table 141.

Table 141 - Arguments and results of the group compositing function

Variable Meaning
G The transparency group: a compound object consisting of all elements E 1 , …, E n of the group-the n constituent objects' colours, shapes, opacities, and blend modes
C 0 Colour of the group's backdrop
C Computed colour of the group, which shall be used as the source colour when the group is treated as an object
f Computed shape of the group, which shall be used as the object shape when the group is treated as an object
α 0 Alpha of the group's backdrop
α Computed alpha of the group, which shall be used as the object alpha when the group is treated as an object

NOTE 1 The opacity is not given explicitly as an argument or result of this function. Almost all of the computations use the product of shape and opacity (alpha) rather than opacity alone; therefore, it is usually convenient to work directly with shape and alpha rather than shape and opacity. When needed, the opacity can be computed by dividing the alpha by the associated shape.

The result of applying the group compositing function shall then be treated as if it were a single object, which in turn is composited with the group's backdrop according to the formulas defined in this sub-clause. In those formulas, the colour, shape, and alpha (C , f , and α ) calculated by the group compositing function shall be used, respectively, as the source colour C s , the object shape f j , and the object alpha α j .

The group compositing formulas for a non-isolated, non-knockout group are defined as follows:

  • Initialization:
  • For each group element E i ∈ G (i = 1, … , n) :

PDF 32000-1:2008

· Result:

where the variables have the meanings shown in Table 142 (in addition to those in Table 141).

For an element E i that is an elementary object, the colour, shape, and alpha values , , and are intrinsic attributes of the object. For an element that is a group, the group compositing function shall be applied recursively to the subgroup and the resulting C , f , and α values shall be used for its , , and in the calculations for the parent group. C s i f j i α j i C s i f j i α j i

Table 142 - Variables used in the group compositing formulas

Variable Meaning
E i Element i of the group: a compound variable representing the element's colour, shape, opacity, and blend mode
f s i Source shape for element E i
f j i Object shape for element E i
f m i Mask shape for element E i
f k i Constant shape for element E i
f g i Group shape: the accumulated source shapes of group elements E 1 to E i , excluding the initial backdrop
q m i Mask opacity for element E i
q k i Constant opacity for element E i
α s i Source alpha for element E i
α j i Object alpha for element E i : the product of its object shape and object opacity

Table 142 - Variables used in the group compositing formulas (continued)

Variable Meaning
α g i Group alpha: the accumulated source alphas of group elements E 1 to E i , excluding the initial backdrop
α i Accumulated alpha after compositing element E i , including the initial backdrop
C s i Source colour for element E i
C i Accumulated colour after compositing element E i , including the initial backdrop

Navigation: PDF-Spec-11-Model | PDF-Spec-Index | PDF-Spec-11-Soft-Masks

Clone this wiki locally