Skip to content

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.

C#
public static class PremultipliedColor

Inheritance

object ← PremultipliedColor

Methods

FromBytes(byte, byte, byte, byte)

A colour from 8-bit channels that are already premultiplied: each channel is byte / 255.

C#
public static ColorF FromBytes(byte r, byte g, byte b, byte a = 255)

Parameters

r byte

g byte

b byte

a byte

Returns

ColorF

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.

C#
public static ColorF FromStraight(Color color)

Parameters

color Color

Returns

ColorF

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.

C#
public static void PremultiplyInPlace(Span<byte> rgba)

Parameters

rgba Span<byte>

Tightly packed R, G, B, A bytes.