Color32[] GetPixels( int mip )
void GetPixels( System.ValueTuple<int, int, int, int> srcRect, int slice, int mip, System.Span<T> dstData, ImageFormat dstFormat, System.ValueTuple<int, int> dstSize )
void GetPixels( System.ValueTuple<int, int, int, int> srcRect, int slice, int mip, System.Span<T> dstData, ImageFormat dstFormat, System.ValueTuple<int, int, int, int> dstRect, int dstStride )

book_4_sparkGenerated
code_blocksInput

Description

The GetPixels method retrieves the color data of a specified mip level from a texture. This method returns an array of Color32 objects, each representing a pixel's color in the texture at the specified mip level.

Usage

To use the GetPixels method, you need to specify the mip level you want to retrieve the pixel data from. The mip level is an integer where 0 represents the highest resolution level of the texture. Ensure that the mip level specified is within the range of available mip levels for the texture.

Example

// Assuming 'texture' is an instance of Sandbox.Texture
int mipLevel = 0; // Get the highest resolution mip level
Color32[] pixels = texture.GetPixels(mipLevel);

// Iterate through the pixels
foreach (var pixel in pixels)
{
    // Access pixel.r, pixel.g, pixel.b, pixel.a
    // Do something with the pixel data
}