Skip to content
ChartForgeX
Struct

RgbaImage

ChartForgeX.Raster

Namespace
ChartForgeX.Raster
Assembly
ChartForgeX
Base
ValueType
Modifiers
sealed

Represents a dependency-free 32-bit RGBA raster image.

Inheritance

  • ValueType
  • RgbaImage

Remarks

This value borrows the supplied mutable pixel array without copying it. Keep the array alive and avoid changing it while a renderer or encoder uses the image. Composition and typed visual-canvas image entrypoints document when they create independent snapshots.

Usage

Explore 88 API references to this type

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

Returned or exposed by 53

Accepted by parameters 35

Constructors

public RgbaImage(int width, int height, byte[] pixels) #

Initializes an RGBA raster image.

Parameters

width int required
The image width in pixels.
height int required
The image height in pixels.
pixels byte[] required
Borrowed mutable RGBA pixels, row-major from top-left. The constructor does not copy the array.

Fields

public readonly int Width #

Gets the image width in pixels.

public readonly int Height #

Gets the image height in pixels.

public readonly byte[] Pixels #

Gets the image pixels as RGBA bytes, row-major from top-left.

Extension Methods

public static void SaveGif(RgbaImage image, string path) #

Saves one RGBA image as a single-frame GIF.

Parameters

image ChartForgeX.Raster.RgbaImage required
path string required
SaveRasterImage 2 overloads
public static void SaveRasterImage(RgbaImage image, string path, RasterImageFormat format, RasterImageOptions? options = null) #

Saves RGBA pixels to a dependency-free raster file.

Parameters

image ChartForgeX.Raster.RgbaImage required
The image to encode.
path string required
The output file path.
format ChartForgeX.Core.RasterImageFormat required
The raster image format.
options ChartForgeX.Core.RasterImageOptions? = null optional
Optional raster export options.
public static void SaveRasterImage(RgbaImage image, string path, RasterImageOptions? options = null) #

Saves RGBA pixels to a raster file using the output path extension to choose the format.

Parameters

image ChartForgeX.Raster.RgbaImage required
The image to encode.
path string required
The output file path.
options ChartForgeX.Core.RasterImageOptions? = null optional
Optional raster export options.
public static byte[] ToGif(RgbaImage image) #

Encodes one RGBA image as a single-frame GIF.

Parameters

image ChartForgeX.Raster.RgbaImage required

Returns

byte[]
public static byte[] ToJpeg(RgbaImage image, RasterImageOptions? options = null) #

Encodes RGBA pixels to JPEG bytes after flattening transparent pixels against the configured background.

Parameters

image ChartForgeX.Raster.RgbaImage required
The image to encode.
options ChartForgeX.Core.RasterImageOptions? = null optional
Optional raster export options.

Returns

byte[] A JPEG image.
ToPng 2 overloads
public static byte[] ToPng(RgbaImage image) #

Encodes RGBA pixels to PNG bytes.

Parameters

image ChartForgeX.Raster.RgbaImage required
The image to encode.

Returns

byte[] A PNG image.
public static byte[] ToPng(RgbaImage image, RasterImageOptions? options) #

Encodes an RGBA image as PNG bytes using dependency-free raster options.

Parameters

image ChartForgeX.Raster.RgbaImage required
options ChartForgeX.Core.RasterImageOptions? required

Returns

byte[]
public static byte[] ToRasterImage(RgbaImage image, RasterImageFormat format, RasterImageOptions? options = null) #

Encodes RGBA pixels to a dependency-free raster format.

Parameters

image ChartForgeX.Raster.RgbaImage required
The image to encode.
format ChartForgeX.Core.RasterImageFormat required
The raster image format.
options ChartForgeX.Core.RasterImageOptions? = null optional
Optional raster export options.

Returns

byte[] Encoded raster image bytes.
public static VisualCanvas ToVisualCanvas(RgbaImage image, VisualCanvasImageFit fit = Stretch) #

Creates a visual canvas from decoded RGBA pixels with the image as the first layer.

Parameters

image ChartForgeX.Raster.RgbaImage required
fit ChartForgeX.Composition.VisualCanvasImageFit = Stretch optional
public static void WriteGif(RgbaImage image, Stream stream) #

Writes one RGBA image as a single-frame GIF.

Parameters

image ChartForgeX.Raster.RgbaImage required
stream System.IO.Stream required
public static void WriteRasterImage(RgbaImage image, Stream stream, RasterImageFormat format, RasterImageOptions? options = null) #

Writes RGBA pixels to a dependency-free raster stream.

Parameters

image ChartForgeX.Raster.RgbaImage required
The image to encode.
stream System.IO.Stream required
The destination stream.
format ChartForgeX.Core.RasterImageFormat required
The raster image format.
options ChartForgeX.Core.RasterImageOptions? = null optional
Optional raster export options.