Description
The BGRX8888
field is a member of the ImageFormat
enumeration in the Sandbox namespace. This format represents an image with 32 bits per pixel, where each pixel is composed of 8 bits for blue, 8 bits for green, 8 bits for red, and 8 bits for padding (X). The padding is typically used to align the data to a 32-bit boundary, but it is not used for storing color information.
Usage
Use the BGRX8888
format when you need to work with images that require 32 bits per pixel with a blue-green-red channel order and an unused padding byte. This format is useful for applications that need to align image data to 32-bit boundaries for performance reasons, but do not require an alpha channel.
Example
// Example of using ImageFormat.BGRX8888
public void ProcessImageData(byte[] imageData)
{
// Assume imageData is in BGRX8888 format
int width = 1920; // Example width
int height = 1080; // Example height
int bytesPerPixel = 4; // BGRX8888 has 4 bytes per pixel
for (int y = 0; y < height; y++)
{
for (int x = 0; x < width; x++)
{
int index = (y * width + x) * bytesPerPixel;
byte blue = imageData[index];
byte green = imageData[index + 1];
byte red = imageData[index + 2];
// byte x = imageData[index + 3]; // Padding byte, typically ignored
// Process the pixel (red, green, blue)
}
}
}