Project

ChartForgeX

Render deterministic charts, dashboards, topology, hierarchy, and report visuals directly from .NET.

Stars 47
Forks 2
NuGet downloads 75,067
Release ChartForgeX-v2.0.0
Language: HTML Updated: 2026-10-12

API Reference

Class

RasterAnimationEncoder

Namespace ChartForgeX.Raster
Assembly ChartForgeX.Stories
Modifiers static

Encodes complete RGBA canvases as GIF or animated PNG using the managed raster engines.

Inheritance

  • Object
  • RasterAnimationEncoder

Remarks

Frames must share their dimensions. Both containers preserve zero frame delays. GIF rounds cumulative positive frame boundaries to the nearest 10 milliseconds, with a 10 millisecond minimum and 655.35 second maximum, and treats alpha below 128 as transparent. APNG preserves representable rational durations and otherwise rounds to a supported fraction, with a 65,535 second maximum. Encoder working buffers and returned output share a 256 MiB ceiling; caller-owned input pixel buffers are excluded. The frame list and pixel buffers must remain unchanged while encoding.

Methods

Encode 2 overloads
public static Byte[] Encode(IReadOnlyList<RasterAnimationFrame> frames, RasterAnimationFormat format, RasterAnimationOptions? options = null, CancellationToken cancellationToken = default) #
Returns: Byte[]

Encodes frames into a new byte array.

Parameters

frames System.Collections.Generic.IReadOnlyList<ChartForgeX.Raster.RasterAnimationFrame> requiredposition: 0
One or more complete RGBA frames with matching dimensions.
format ChartForgeX.Raster.RasterAnimationFormat requiredposition: 1
The GIF or APNG container.
options ChartForgeX.Raster.RasterAnimationOptions? = null optionalposition: 2
Playback and encoding options; omitted options repeat indefinitely with PNG compression level 6.
cancellationToken System.Threading.CancellationToken = default optionalposition: 3
Cancels validation and encoding between units of work.

Returns

The encoded animation.

public static Byte[] Encode(RasterAnimationSource source, RasterAnimationFormat format, RasterAnimationOptions? options = null, CancellationToken cancellationToken = default) #
Returns: Byte[]

Encodes a repeatable producer with memory bounded independently of frame count.

Parameters

source ChartForgeX.Raster.RasterAnimationSource requiredposition: 0
format ChartForgeX.Raster.RasterAnimationFormat requiredposition: 1
options ChartForgeX.Raster.RasterAnimationOptions? = null optionalposition: 2
cancellationToken System.Threading.CancellationToken = default optionalposition: 3
WriteTo 2 overloads
public static Void WriteTo(Stream stream, IReadOnlyList<RasterAnimationFrame> frames, RasterAnimationFormat format, RasterAnimationOptions? options = null, CancellationToken cancellationToken = default) #
Returns: Void

Writes an animation to a caller-owned writable stream and leaves that stream open.

Parameters

stream System.IO.Stream requiredposition: 0
The destination stream. Validation completes before any bytes are written.
frames System.Collections.Generic.IReadOnlyList<ChartForgeX.Raster.RasterAnimationFrame> requiredposition: 1
One or more complete RGBA frames with matching dimensions.
format ChartForgeX.Raster.RasterAnimationFormat requiredposition: 2
The GIF or APNG container.
options ChartForgeX.Raster.RasterAnimationOptions? = null optionalposition: 3
Playback and encoding options; omitted options repeat indefinitely with PNG compression level 6.
cancellationToken System.Threading.CancellationToken = default optionalposition: 4
Cancels validation and encoding between units of work.
public static Void WriteTo(Stream stream, RasterAnimationSource source, RasterAnimationFormat format, RasterAnimationOptions? options = null, CancellationToken cancellationToken = default) #
Returns: Void

Writes a repeatable producer to a caller-owned stream, leaving it open.

Parameters

stream System.IO.Stream requiredposition: 0
source ChartForgeX.Raster.RasterAnimationSource requiredposition: 1
format ChartForgeX.Raster.RasterAnimationFormat requiredposition: 2
options ChartForgeX.Raster.RasterAnimationOptions? = null optionalposition: 3
cancellationToken System.Threading.CancellationToken = default optionalposition: 4