Skip to content

Class ImageDecoder

Namespace: Apogee.Content
Assembly: Apogee.Content.dll

Decodes PNG, JPEG, BMP, TGA and the other formats stb_image reads into RGBA8 textures with a full mip chain.

public static class ImageDecoder

Inheritance

object ← ImageDecoder

Inherited Members

object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()

Methods

BuildMipChain(byte[], int, int, bool)

Halves the image down to 1x1 with a box filter. sRGB images are averaged in linear light, which is what the sampler does when it filters.

public static IReadOnlyList<byte[]> BuildMipChain(byte[] level0, int width, int height, bool srgb)

Parameters

level0 byte[]

width int

height int

srgb bool

Returns

IReadOnlyList<byte[]>

Decode(string, ReadOnlySpan<byte>, bool, SamplerData, bool)

Decodes an image file to RGBA8. srgb says what the colors mean: sRGB for base color and emissive textures, linear for the rest.

public static TextureData Decode(string name, ReadOnlySpan<byte> file, bool srgb, SamplerData sampler, bool generateMips = true)

Parameters

name string

file ReadOnlySpan<byte>

srgb bool

sampler SamplerData

generateMips bool

Returns

TextureData