plushie/widget/image

Image widget builder.

Types

Crop rectangle for image cropping (integer pixel values).

pub type Crop {
  Crop(x: Int, y: Int, width: Int, height: Int)
}

Constructors

  • Crop(x: Int, y: Int, width: Int, height: Int)
pub opaque type Image

Option type for image properties.

pub type Opt {
  Width(length.Length)
  Height(length.Length)
  ContentFit(content_fit.ContentFit)
  Rotation(Float)
  Opacity(Float)
  BorderRadius(Float)
  FilterMethod(filter_method.FilterMethod)
  Expand(Bool)
  Scale(Float)
  CropOpt(Crop)
  Alt(String)
  Description(String)
  Decorative(Bool)
  A11y(a11y.A11y)
}

Constructors

Values

pub fn a11y(img: Image, a: a11y.A11y) -> Image

Set accessibility properties for this widget.

pub fn alt(img: Image, a: String) -> Image

Set the alt text for accessibility.

pub fn border_radius(img: Image, r: Float) -> Image

Set the border radius.

pub fn build(img: Image) -> node.Node

Build the image into a renderable Node.

pub fn content_fit(
  img: Image,
  cf: content_fit.ContentFit,
) -> Image

Set how content is fitted within the widget bounds.

pub fn crop(img: Image, c: Crop) -> Image

Set the crop rectangle.

pub fn decorative(img: Image, d: Bool) -> Image

Mark as decorative (ignored by screen readers).

pub fn description(img: Image, d: String) -> Image

Set the description text for accessibility.

pub fn expand(img: Image, e: Bool) -> Image

Set whether the image expands to fill available space.

pub fn filter_method(
  img: Image,
  f: filter_method.FilterMethod,
) -> Image

Set the image filter method.

pub fn height(img: Image, h: length.Length) -> Image

Set the height.

pub fn height_animated(
  img: Image,
  animation: node.PropValue,
) -> Image

Set height to an animation descriptor (Transition, Spring, or Sequence). The descriptor must be pre-encoded via its module’s encode function.

pub fn new(id: String, source: String) -> Image

Create a new image builder.

pub fn opacity(img: Image, o: Float) -> Image

Set the opacity (0.0 to 1.0).

pub fn opacity_animated(
  img: Image,
  animation: node.PropValue,
) -> Image

Set opacity to an animation descriptor (Transition, Spring, or Sequence). The descriptor must be pre-encoded via its module’s encode function.

pub fn rotation(img: Image, r: Float) -> Image

Set the rotation angle in degrees.

pub fn rotation_animated(
  img: Image,
  animation: node.PropValue,
) -> Image

Set rotation to an animation descriptor (Transition, Spring, or Sequence). The descriptor must be pre-encoded via its module’s encode function.

pub fn scale(img: Image, s: Float) -> Image

Set the scale factor.

pub fn width(img: Image, w: length.Length) -> Image

Set the width.

pub fn width_animated(
  img: Image,
  animation: node.PropValue,
) -> Image

Set width to an animation descriptor (Transition, Spring, or Sequence). The descriptor must be pre-encoded via its module’s encode function.

pub fn with_opts(img: Image, opts: List(Opt)) -> Image

Apply a list of options to an image builder.

Search Document