fromPixels static method
Texture2D
fromPixels(
- Uint8List pixels,
- int width,
- int height, {
- TextureContent content = TextureContent.color,
- TextureSampling sampling = const TextureSampling(),
Builds a texture from RGBA8888 pixels (straight alpha, row-major) of
width x height.
Implementation
static Texture2D fromPixels(
Uint8List pixels,
int width,
int height, {
TextureContent content = TextureContent.color,
TextureSampling sampling = const TextureSampling(),
}) => Texture2D._(
uploadMipLevels(
sampling.mipmaps && mipChainsAreSampled
? generateMipChain(pixels, width, height, content)
: <MipLevel>[MipLevel(width, height, pixels)],
width,
height,
maxMipmapLevels: sampling.maxMipmapLevels,
),
sampling.toSamplerOptions(),
);