Image.Plug.Pipeline.Ops.Draw.Layer (image_plug v0.1.0)

Copy Markdown View Source

A single overlay layer used by Image.Plug.Pipeline.Ops.Draw.

The interpreter prefers SVG composition: when the layer source resolves to (or can be expressed as) SVG, the overlay is rendered via Image.from_svg/2 so it scales without raster artefacts. Bitmap sources are decoded, optionally resized, and composited with the configured opacity.

Position is either nil (centre) or {:offset, ...} with any combination of :top / :bottom and :left / :right (a side and its opposite cannot both be set; the provider rejects that at parse time).

Summary

Types

fit()

@type fit() :: :contain | :cover | :crop | :pad | :scale_down

position()

@type position() :: nil | {:offset, keyword()}

repeat()

@type repeat() :: false | true | :x | :y

t()

@type t() :: %Image.Plug.Pipeline.Ops.Draw.Layer{
  background: nil | String.t(),
  fit: fit(),
  gravity: Image.Plug.Pipeline.Ops.Resize.gravity(),
  height: nil | pos_integer(),
  opacity: float(),
  position: position(),
  repeat: repeat(),
  rotate: 0 | 90 | 180 | 270,
  source: Image.Plug.Source.t(),
  width: nil | pos_integer()
}