QuantizeFilter Class

Rounds the colors multiplied by their alpha (premultiplied) and the alpha to a number of bits per sample, as a texture of that depth holds them: the last filter of a chain gives the result of a filter a browser draws on an 8-bit premultiplied texture.

public sealed class QuantizeFilter : Filter

Remarks

Each value v of a pixel, a fraction of one, becomes floor(M v + 1/2) / M, with M = 2^n - 1: the colors are rounded multiplied by the alpha, so a color is kept with the precision its alpha leaves it. The result is then written to the samples of the layer as any filter result is (Filter): a layer of 8 bits per sample gets the straight color closest to the rounded value, and a layer of 16 bits per sample keeps it nearly exactly.

Inheritance
Filter QuantizeFilter

Constructors

NameDescription
QuantizeFilter(int)Initializes a new instance of the QuantizeFilter class.

QuantizeFilter(int)

QuantizeFilter.cs

Initializes a new instance of the QuantizeFilter class.

public QuantizeFilter(int bitsPerSample)

Parameters

bitsPerSample int
The number of bits per sample of the values. Must be between 1 and 16.

Exceptions

ArgumentOutOfRangeException
bitsPerSample is not between 1 and 16.

Properties

NameDescription
BitsPerSampleGets the number of bits per sample of the values.

BitsPerSample

QuantizeFilter.cs

Gets the number of bits per sample of the values.

public int BitsPerSample { get; }

Property value

int