PredefinedColorsQuantizerFromCustomFunction(FuncColor32, Color32, Color32, Byte, Boolean, KnownPixelFormat) Method
Gets a
PredefinedColorsQuantizer instance that can quantize colors using the custom quantizer function specified in the
quantizingFunction parameter.
Namespace: KGySoft.Drawing.ImagingAssembly: KGySoft.Drawing.Core (in KGySoft.Drawing.Core.dll) Version: 9.0.0
public static PredefinedColorsQuantizer FromCustomFunction(
Func<Color32, Color32> quantizingFunction,
Color32 backColor,
byte alphaThreshold,
bool autoBlend,
KnownPixelFormat pixelFormatHint = KnownPixelFormat.Format32bppArgb
)
Public Shared Function FromCustomFunction (
quantizingFunction As Func(Of Color32, Color32),
backColor As Color32,
alphaThreshold As Byte,
autoBlend As Boolean,
Optional pixelFormatHint As KnownPixelFormat = KnownPixelFormat.Format32bppArgb
) As PredefinedColorsQuantizer
public:
static PredefinedColorsQuantizer^ FromCustomFunction(
Func<Color32, Color32>^ quantizingFunction,
Color32 backColor,
unsigned char alphaThreshold,
bool autoBlend,
KnownPixelFormat pixelFormatHint = KnownPixelFormat::Format32bppArgb
)
static member FromCustomFunction :
quantizingFunction : Func<Color32, Color32> *
backColor : Color32 *
alphaThreshold : byte *
autoBlend : bool *
?pixelFormatHint : KnownPixelFormat
(* Defaults:
let _pixelFormatHint = defaultArg pixelFormatHint KnownPixelFormat.Format32bppArgb
*)
-> PredefinedColorsQuantizer
- quantizingFunction FuncColor32, Color32
- A delegate that specifies the custom quantizing logic. It must be thread-safe for parallel invoking, and it is expected to be fast.
The results returned by the delegate are not cached.
- backColor Color32
- Determines the BackColor property of the result. The Color32.A field of the background color is ignored.
If autoBlend is , then colors with alpha (transparency), whose Color32.A field
is equal to or greater than alphaThreshold will be blended with this color before invoking the quantizingFunction delegate.
If autoBlend is , then this parameter matters only if a consumer considers the BackColor property, such as an IDitherer instance that does not support partial transparency. - alphaThreshold Byte
- Specifies a threshold value for the Color32.A field, under which a quantized color is considered transparent without invoking quantizingFunction.
If autoBlend is , then quantizingFunction will never be invoked with colors with alpha. Instead, colors whose alpha
equal to or greater than this parameter will be blended with backColor before invoking quantizingFunction.
If autoBlend is , then colors with alpha equal to or greater than this parameter
are allowed to be passed to quantizingFunction without blending with backColor. - autoBlend Boolean
- to always apply backColor and alphaThreshold to the input color before invoking quantizingFunction.
to apply only alphaThreshold to the input colors and allowing quantizingFunction to be invoked with partially transparent colors. - pixelFormatHint KnownPixelFormat (Optional)
- The KnownPixelFormat value that the PixelFormatHint property of the returned instance will return. This parameter is optional.
Default value: Format32bppArgb.
PredefinedColorsQuantizerA
PredefinedColorsQuantizer instance that can quantize colors using the custom quantizer function specified in the
quantizingFunction parameter.