Skip to main content

Crate alpha2_extensions

Crate alpha2_extensions 

Source
Expand description

Extension providers: frames of formats the host’s video and image decoders do not read, supplied through one contract.

A provider probes bytes (never a file name) and opens a source that answers frames by source time. The host registers the providers its build includes, in priority order, and feeds their frames to the engine like any other source’s; the engine and the renderer know nothing of them. Each format is a cargo feature: a build without one still renders everything else, and reports that format’s sources as unsupported.

Structs§

AnimatedImageProvider
Reads GIF, animated WebP, and APNG. A still file of those formats is not this provider’s: the host’s image decoders read it.
ExrProvider
Reads still OpenEXR images.
LinearColor
What linear-light media’s RGB is: the primaries it is in, and where that was learned.
LottieProvider
Reads Lottie JSON and dotLottie packages.
NoResources
A resolver with nothing registered.
ProbeReport
What probing a file finds.
ProgressWatch
Ends a watch_progress watch, restoring the one before it.
Registry
The providers a host’s build includes, highest priority first.
SvgProvider
Reads static SVG documents.
VisualFrame
One frame of a source.

Enums§

ColorOrigin
Where a source’s color description comes from.
Diagnostic
Something a provider did that the user should know about.
ExtensionError
Why a provider could not answer.
Format
A format a provider reads.
FramePixels
A frame’s pixels, rows packed without padding, in the precision its source has. Shared, never copied, with what the source keeps: a frame a source answers again (a still, a frame it holds) costs no copy.
Timing
When a source’s frames are shown, in source time.

Constants§

DEFAULT_FRAME_BUDGET
Decoded bytes an animated source or an image sequence keeps between requests.
MAX_ANIMATION_FRAMES
Most frames an animated image may have.
MAX_ANIMATION_PIXELS
Most pixels an animated image’s frames may cover, all frames together: what one pass through it decodes and composites, whatever its canvas. About a thousand whole 1080p frames, which one pass decodes in about ten seconds natively.
MAX_CANVAS_PIXELS
Largest canvas a provider opens, in pixels: 8K UHD.
MAX_CANVAS_SIDE
Largest canvas side a provider opens, in pixels.
MAX_NORMALIZED_DELAY_MS
The longest delay not taken as meant: a frame declaring this or less (zero included) is shown for NORMALIZED_DELAY_MS and reported. A GIF counts delays in hundredths of a second, so its 0 and 1 are the delays normalized; APNG and WebP declare frame times exactly, and a longer delay (60 fps is 16 or 17 ms) plays as declared, in every format alike.
MAX_SOURCE_IMAGE_PIXELS
Most pixels the raster images inside one source may decode to, all of them together: four whole canvases of MAX_CANVAS_PIXELS. An SVG decodes every image it draws on each render (an image drawn twice, as through <use>, counts twice) and a Lottie animation decodes its image assets once, when it opens, and holds them; each image is also within check_canvas on its own. A source past it is refused.
NORMALIZED_DELAY_MS
What a delay of MAX_NORMALIZED_DELAY_MS or less becomes.

Traits§

ResourceResolver
Bytes a source needs besides its own: an image sequence’s frames, and the fonts and images an SVG names. A provider never fetches anything else. It may be asked from inside a parser (usvg asks for each image it draws), which requires it to be shared across threads.
VisualProvider
Reads one family of formats.
VisualSource
A source a provider opened: asked for frames by source time.

Functions§

check_canvas
Refuses a canvas larger than a provider opens.
check_document_size
Refuses a source’s file of length bytes larger than its document_limit, before it is read or parsed.
check_image_pixels
Refuses images that together decode to more than MAX_SOURCE_IMAGE_PIXELS.
document_limit
The most bytes a provider reads of a source’s own file, for the formats it reads whole: a dotLottie package (MAX_PROVIDER_DOCUMENT_BYTES), a Lottie JSON file (MAX_LOTTIE_DOCUMENT_BYTES), and an SVG document (MAX_SVG_DOCUMENT_BYTES), with what the file is called; None for the formats a provider decodes as it goes. head is the file’s start: a Lottie source’s file is a package when it starts as a ZIP file does.
open_sequence
Opens an image sequence: frames in play order (None for a gap in the numbering), at rate, their bytes from resolver as they are shown; OpenEXR frames in primaries when given. Only the first frame is read here.
premultiply
Premultiplies straight RGBA8 in place, rounding to nearest.
watch_progress
Calls progressed on this thread each time a provider call it makes gets further, until the returned watch drops.

Type Aliases§

SharedResolver
A resolver a source may keep: an image sequence reads each frame from it when it shows that frame, never all of them when it opens.