Class PixelFormatHelper
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
mtMediaTypeThe media type describing the video format.
scolorstringThe color in string format (e.g., "#AARRGGBB").
Returns
- VersatileBuffer
A VersatileBuffer filled with the color, or null if the format is unsupported.
GetPlaneCount(PixelFormat)
Gets the number of planes in the specified pixel format.
public static int GetPlaneCount(PixelFormat pixelFormat)
Parameters
pixelFormatPixelFormatThe 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
heightintThe height of the image in pixels.
pixelFormatPixelFormatThe pixel format.
planeIndexintThe 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
widthintThe width of the image in pixels.
pixelFormatPixelFormatThe pixel format.
planeIndexintThe 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
pixelFormatPixelFormatThe pixel format.
Returns
- int
The number of bits per pixel, or 0 if unknown.