Package-level declarations

Types

Link copied to clipboard
@Immutable
class BlurEffect(radiusX: Float, radiusY: Float = radiusX, edgeTreatment: TileMode = TileMode.Clamp) : RenderEffect

Blurs the recording of the ImageLayer it is set on, by radiusX across and radiusY down.

Link copied to clipboard
@Immutable
class BorderStroke(val width: Int, val brush: Brush)

A line width wide filled with brush: what border draws.

Link copied to clipboard
fun interface Brush

A fill resolved against the size of what it decorates - what background paints under a component's content and what border strokes its edge with. It is asked for its paint each time the component paints, at the size its decorated box stands at then, with that box's top-left corner as the origin.

Link copied to clipboard

The full bounds with each corner rounded by half the shorter side: a circle on a square component and a pill on any other, as androidx's CircleShape is.

Link copied to clipboard

A component that paints through the decoration its modifier declares: what every decoration modifier and every DecorationModifierNode target.

Link copied to clipboard

What a Decoratable component paints through, and how far it paints past its layout bounds: the steps its modifier declares and the paint outsets its parent gives it. The library creates each value for one component and writes it to Decoratable.decoration; a value never changes, and a change is a new value.

Link copied to clipboard

A modifier node that is one step of its component's decoration, at the node's position in the modifier: it wraps every step declared after it and the component's own painting, and is wrapped by every step declared before it.

Link copied to clipboard
fun interface Decorator

One operation wrapping the painting of what it decorates, declared on a component with decoration. It is handed the graphics, the size, and the continuation that paints everything inside it, and it decides what graphics that continuation paints into: a decorator painting around its content hands on the graphics it was given, one cutting the content hands on a clipped one, and one that post-processes the content's pixels, such as a blur or a tint, points it at an offscreen raster. The content keeps its own area: space between a decoration and the content is a padding declared after the decoration.

Link copied to clipboard

A SwingModifier.ComponentNode that draws into its component.

Link copied to clipboard
class ImageLayer @RememberInComposition constructor

An offscreen raster that records Java2D drawing once and draws it again as often as you like, through a transform the caller can change without re-recording.

Link copied to clipboard

The full bounds of what it decorates.

Link copied to clipboard
@Immutable
interface RenderEffect

A per-pixel effect an ImageLayer applies to its recording each time it draws it, set as its renderEffect.

Link copied to clipboard
class RoundedCornerShape(val size: Float) : Shape

The full bounds with each corner rounded to size, or to half the shorter side where that is less, so a radius too large for the size is a pill, as androidx's RoundedCornerShape is.

Link copied to clipboard
fun interface Shape

An outline resolved against the size of what it decorates - what clip cuts a component's painting to. It is asked for its outline at the size its decorated box stands at then, with that box's top-left corner as the origin. How often depends on the decorator: clip and background ask again on every paint, while border keeps the outline it built and asks again when the size or the border's width, brush or shape changes.

Link copied to clipboard
@Immutable
value class TileMode

What an effect reads past the edges of what it applies to. A BlurEffect takes Clamp and Decal.

Link copied to clipboard
@Immutable
class TransformOrigin(val pivotFractionX: Float, val pivotFractionY: Float)

The point scale and rotation are applied around, as fractions of the content's own painted box.

Functions

Link copied to clipboard
fun SwingModifier.alpha(@FloatRange(from = 0.0, to = 1.0) alpha: Float): SwingModifier

Paints the component at alpha of its opacity, content and children alike, cut to the decorated box as androidx's Modifier.alpha cuts it.

Link copied to clipboard

This op as a RenderEffect that applies it to the recording at any scale, with no outsets.

Link copied to clipboard

Fills shape's outline with color under the component's content; the solid-color overload of background.

fun SwingModifier.background(brush: Brush, shape: Shape = RectangleShape, @FloatRange(from = 0.0, to = 1.0) alpha: Float = 1.0f): SwingModifier

Fills shape's outline with brush under the component's content.

Link copied to clipboard

Softens everything inside it, by radius: the component's content, its border and its children.

Link copied to clipboard
fun SwingModifier.border(border: BorderStroke, shape: Shape = RectangleShape): SwingModifier

Draws border along the inside of shape's outline; the BorderStroke overload of border.

fun SwingModifier.border(width: Int, color: Color, shape: Shape = RectangleShape): SwingModifier

Draws a line width wide in color along the inside of shape's outline; the solid-color overload of border.

fun SwingModifier.border(width: Int, brush: Brush, shape: Shape = RectangleShape): SwingModifier

Draws a line width wide along the inside of shape's outline, over the content.

Link copied to clipboard
fun SwingModifier.clip(shape: Shape, antialias: Boolean = false): SwingModifier

Clips everything inside it to shape's outline - the component's content, its border and, on a container, its children.

Link copied to clipboard

Declares decorator on a component that paints through a decoration: a component implementing Decoratable. Any other component is refused, with an IllegalStateException naming Decoratable.

Declares element, whose DecorationModifierNode is one step of the component's decoration, such as a DrawModifierNode. It paints at its place among the other steps, as a declared Decorator does, so the component must be a Decoratable and element must be additive; either is refused, before the node attaches when element names Decoratable as its target type, or as the node attaches otherwise.

Link copied to clipboard

Draws onDraw into the component's area before the content declared after this modifier. A shortcut for a DrawModifierNode whose ContentDrawScope.drawContent runs after the block.

Link copied to clipboard

Draws onDraw into the component's area, letting the block decide when the content declared after this modifier is painted by calling ContentDrawScope.drawContent.

Link copied to clipboard

Repaints this node's component, so DrawModifierNode.draw runs again. Does nothing while it is not attached.

Link copied to clipboard
@Composable
fun rememberImageLayer(): ImageLayer

Creates an ImageLayer that is remembered across compositions and released when the composition leaves.

Link copied to clipboard
fun SwingModifier.shadow(radius: Int, color: Color, offsetX: Int = 0, offsetY: Int = 0): SwingModifier

Casts a blurred shadow of everything inside it, into outsets the component grows by.