GraphicsAPI reference
Class PremultipliedColor
Namespace: MicroEngine.Graphics.Devices
Assembly: MicroEngine.Graphics.dll
Guide: The graphics device
Conversions between 8-bit colours and the premultiplied float colours of the device contract.
public static class PremultipliedColorInheritance
Methods
FromBytes(byte, byte, byte, byte)
A colour from 8-bit channels that are already premultiplied: each channel is byte / 255.
public static ColorF FromBytes(byte r, byte g, byte b, byte a = 255)Parameters
r byte
g byte
b byte
a byte
Returns
FromStraight(Color)
The premultiplied form of a straight (not premultiplied) 8-bit colour, as the 2D layer passes tints to the device:
each colour channel c / 255 × a / 255.
public static ColorF FromStraight(Color color)Parameters
color Color
Returns
PremultiplyInPlace(Span<byte>)
Premultiplies straight 8-bit RGBA texels in place, as an upload of straight-alpha image data does (each colour
channel becomes round(c × a / 255)). Opaque and fully transparent texels are exact.
public static void PremultiplyInPlace(Span<byte> rgba)Parameters
Tightly packed R, G, B, A bytes.