Image display -- renders a raster image from a file path or an in-memory handle.
Props
source(string or handle ref) -- path to the image file, or%{handle: name}for an in-memory image created viaToddy.Command.create_image/2.width(length) -- image width. Default: shrink. SeeToddy.Iced.Length.height(length) -- image height. Default: shrink.content_fit-- how the image fits its bounds. SeeToddy.Iced.ContentFit.rotation(number) -- rotation angle in degrees.opacity(number) -- opacity from 0.0 (transparent) to 1.0 (opaque).border_radius(number) -- corner radius in pixels.filter_method-- image interpolation mode. SeeToddy.Iced.FilterMethod.expand(boolean) -- expand image to fill available space.scale(number) -- scale factor for the image.crop(map) -- crop rectangle:%{x, y, width, height}(integer pixel values).alt(string) -- alt text for the image (accessibility).description(string) -- longer description for the image (accessibility).a11y(map) -- accessibility overrides. SeeToddy.Iced.A11y.
Summary
Functions
Sets accessibility annotations.
Sets the alt text for the image.
Sets the border radius in pixels.
Converts this image struct to a ui_node() map via the Toddy.Iced.Widget protocol.
Sets how the image fits its bounds.
Sets the crop rectangle.
Sets a longer description for the image.
Sets whether the image expands to fill available space.
Sets the image filter method.
Sets the image height.
Creates a new image struct with the given source and optional keyword opts.
Sets the image opacity (0.0 to 1.0).
Sets the rotation angle in degrees.
Sets the image scale factor.
Sets the image width.
Applies keyword options to an existing image struct.
Types
@type option() :: {:width, Toddy.Iced.Length.t()} | {:height, Toddy.Iced.Length.t()} | {:content_fit, Toddy.Iced.ContentFit.t()} | {:rotation, number()} | {:opacity, number()} | {:border_radius, number()} | {:filter_method, Toddy.Iced.FilterMethod.t()} | {:expand, boolean()} | {:scale, number()} | {:crop, map()} | {:alt, String.t()} | {:description, String.t()} | {:a11y, Toddy.Iced.A11y.t()}
Image source: a file path string or a handle reference map.
@type t() :: %Toddy.Iced.Widget.Image{ a11y: Toddy.Iced.A11y.t() | nil, alt: String.t() | nil, border_radius: number() | nil, content_fit: Toddy.Iced.ContentFit.t() | nil, crop: map() | nil, description: String.t() | nil, expand: boolean() | nil, filter_method: Toddy.Iced.FilterMethod.t() | nil, height: Toddy.Iced.Length.t() | nil, id: String.t(), opacity: number() | nil, rotation: number() | nil, scale: number() | nil, source: source(), width: Toddy.Iced.Length.t() | nil }
Functions
@spec a11y(image :: t(), a11y :: Toddy.Iced.A11y.t()) :: t()
Sets accessibility annotations.
Sets the alt text for the image.
Sets the border radius in pixels.
@spec build(image :: t()) :: Toddy.Iced.ui_node()
Converts this image struct to a ui_node() map via the Toddy.Iced.Widget protocol.
@spec content_fit(image :: t(), content_fit :: Toddy.Iced.ContentFit.t()) :: t()
Sets how the image fits its bounds.
Sets the crop rectangle.
Sets a longer description for the image.
Sets whether the image expands to fill available space.
@spec filter_method(image :: t(), filter_method :: Toddy.Iced.FilterMethod.t()) :: t()
Sets the image filter method.
@spec height(image :: t(), height :: Toddy.Iced.Length.t()) :: t()
Sets the image height.
Creates a new image struct with the given source and optional keyword opts.
The source can be a file path string or a handle reference map
(%{handle: "name"}) for in-memory images created via
Toddy.Command.create_image/2.
Sets the image opacity (0.0 to 1.0).
Sets the rotation angle in degrees.
Sets the image scale factor.
@spec width(image :: t(), width :: Toddy.Iced.Length.t()) :: t()
Sets the image width.
Applies keyword options to an existing image struct.