ContainerDecoration

data class ContainerDecoration(val background: PdfColor? = null, val cornerRadius: Dp = Dp.Zero, val padding: Padding = Padding.Zero, val border: BorderStroke? = null, val cornerRadiusEach: CornerRadius? = null, val borderEach: BorderSides? = null, val backgroundPaint: PdfPaint? = null, val clipToBounds: Boolean = false, val dropShadow: DropShadow? = null, val rotation: Float = 0.0f, val opacity: Float = 1.0f)

Background, border, padding, and corner-radius decoration shared by every container (ColumnNode, RowNode, BoxNode).

Drawing order at render time is:

  1. Fill the rectangle with background (if non-null).

  2. Place children inside the rectangle inset by padding.

  3. Stroke the outer rectangle with border (if non-null).

When cornerRadius is non-zero the rectangle becomes rounded — both the fill and the border outline follow the curve, and the children are clipped to the rounded shape so they don't poke past the corners.

Constructors

Link copied to clipboard
constructor(background: PdfColor? = null, cornerRadius: Dp = Dp.Zero, padding: Padding = Padding.Zero, border: BorderStroke? = null, cornerRadiusEach: CornerRadius? = null, borderEach: BorderSides? = null, backgroundPaint: PdfPaint? = null, clipToBounds: Boolean = false, dropShadow: DropShadow? = null, rotation: Float = 0.0f, opacity: Float = 1.0f)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val background: PdfColor? = null
Link copied to clipboard

Optional gradient or paint fill. When non-null takes precedence over background. Gradient coordinates are in the container's local coordinate space — (0, 0) is the top-left corner, the container's (width, height) is the bottom-right.

Link copied to clipboard
val border: BorderStroke? = null
Link copied to clipboard
val borderEach: BorderSides? = null

Per-side override. When non-null takes precedence over border. Each side is independent — leave any null to skip it.

Link copied to clipboard
val clipToBounds: Boolean = false

When true, the renderer clips drawing to the container's rectangle. Useful for fixed-size containers (e.g. box(width = 200.dp, height = 80.dp)) where overflowing children should not paint past the edges. Containers with a non-zero corner radius already clip to their rounded shape regardless of this flag.

Link copied to clipboard
Link copied to clipboard

Per-corner override. When non-null takes precedence over cornerRadius. Use com.conamobile.pdfkmp.style.CornerRadius.Companion.top etc. for common shapes.

Link copied to clipboard
val dropShadow: DropShadow? = null

Optional soft shadow drawn behind the container before its fill. See com.conamobile.pdfkmp.style.DropShadow.

Link copied to clipboard
val opacity: Float = 1.0f

Opacity (0–1) applied to the whole container as a group. 1f (default) draws fully opaque. Note for the JVM backend: children are composited individually, so overlapping children blend with each other — visually close to, but not identical to, true group transparency.

Link copied to clipboard
Link copied to clipboard
val rotation: Float = 0.0f

Rotation in degrees (clockwise) applied to the whole container — fill, children, and border — around its centre at draw time. Layout still reserves the unrotated rectangle, so large rotations can paint outside the reserved slot (the watermark trade-off).