Table of Contents

Class PixelFormatHelper

Namespace
VAST.Common
Assembly
VAST.Common.dll

Provides helper methods for working with pixel formats.

public static class PixelFormatHelper
Inheritance
PixelFormatHelper
Inherited Members

Methods

CreateColorBuffer(MediaType, string)

Creates a VersatileBuffer filled with the specified color for the given media type.

public static VersatileBuffer CreateColorBuffer(MediaType mt, string scolor)

Parameters

mt MediaType

The media type describing the video format.

scolor string

The color in string format (e.g., "#AARRGGBB").

Returns

VersatileBuffer

A VersatileBuffer filled with the color, or null if the format is unsupported.

GetPackedImageSize(int, int, PixelFormat)

Calculates the total size, in bytes, required to store a packed image with the specified dimensions and pixel format.

public static int GetPackedImageSize(int width, int height, PixelFormat pixelFormat)

Parameters

width int

The width of the image, in pixels. Must be a positive integer.

height int

The height of the image, in pixels. Must be a positive integer.

pixelFormat PixelFormat

The pixel format of the image, which determines the number of planes and the stride for each plane.

Returns

int

The total size, in bytes, of the packed image, calculated by summing the sizes of all image planes.

Remarks

The calculation takes into account the number of planes and their respective dimensions based on the provided pixel format. Ensure that the width and height parameters are valid to avoid incorrect size calculations.

GetPlaneCount(PixelFormat)

Gets the number of planes in the specified pixel format.

public static int GetPlaneCount(PixelFormat pixelFormat)

Parameters

pixelFormat PixelFormat

The pixel format.

Returns

int

The number of planes, or 0 if unknown.

GetPlaneHeight(int, PixelFormat, int)

Gets the height of a specific plane for the specified pixel format.

public static int GetPlaneHeight(int height, PixelFormat pixelFormat, int planeIndex)

Parameters

height int

The height of the image in pixels.

pixelFormat PixelFormat

The pixel format.

planeIndex int

The zero-based plane index.

Returns

int

The plane height in rows, or 0 if unknown.

GetPlaneStride(int, PixelFormat, int)

Gets the stride (bytes per row) for a specific plane of the specified pixel format.

public static int GetPlaneStride(int width, PixelFormat pixelFormat, int planeIndex)

Parameters

width int

The width of the image in pixels.

pixelFormat PixelFormat

The pixel format.

planeIndex int

The zero-based plane index.

Returns

int

The stride in bytes, or 0 if unknown.

GetStorageBitsPerPixel(PixelFormat)

Gets the number of bits per pixel required to store the specified pixel format.

public static int GetStorageBitsPerPixel(PixelFormat pixelFormat)

Parameters

pixelFormat PixelFormat

The pixel format.

Returns

int

The number of bits per pixel, or 0 if unknown.