PeachDrawing.Core

PeachDrawing.Core.PixelMath

PixelMath.Div255(int) Method

x / 255, rounded to nearest: the exact result for every product of two 8-bit values (0..65025), without a division. This is how a channel is scaled by an alpha or coverage byte.

public static int Div255(int x);

Parameters

x System.Int32

the value to divide, normally the product of two bytes

Returns

System.Int32
the rounded quotient