Skip to main content

Module transparency

Module transparency 

Source
Expand description

Transparency group compositing — replaces Splash::beginTransparencyGroup, Splash::endTransparencyGroup, and Splash::paintTransparencyGroup.

§PDF transparency model (§11.3–11.4)

A transparency group is an intermediate compositing surface. The caller:

  1. Calls begin_group to allocate a fresh group bitmap and push it onto the stack. All subsequent paint operations target that group.
  2. Renders into the group normally (fill, stroke, image, shading, glyph calls on the group bitmap).
  3. Calls paint_group (or discard_group on error) to pop the group and composite it back into the underlying bitmap.

§Isolated vs. non-isolated groups

FlagEffect
isolated = trueGroup starts with a transparent background (alpha = 0).
isolated = falseGroup is pre-initialised with the backdrop’s colours.

Knockout groups clear the accumulated alpha on each object; non-knockout groups accumulate.

§Soft masks

When soft_mask_type != SoftMaskType::None, the group is later used as a luminosity or alpha soft mask rather than being composited directly. Call extract_soft_mask on the finished GroupBitmap to obtain the mask bytes, then store them in crate::GraphicsState::soft_mask after wrapping in AnyBitmap.

§C++ equivalents

  • Splash::beginTransparencyGroup
  • Splash::endTransparencyGroup
  • Splash::paintTransparencyGroup

Structs§

GroupBitmap
A group bitmap together with its compositing metadata.
GroupParams
Parameters for one transparency group, collected before begin_group.

Enums§

SoftMaskType
Whether the group’s soft-mask channel is alpha-based or luminosity-based.

Functions§

begin_group
Open a new transparency group and return a group bitmap to render into.
discard_group
Discard a group without compositing it (used on error paths).
extract_soft_mask
Convert a finished group bitmap into a single-channel soft mask.
paint_group
Composite a finished group back into the parent bitmap and return the saved clip.