GifEncoderEncodeHighColorImageAsync Method
Encodes the specified imageData as a multi-layered, single frame GIF image asynchronously, and writes it into the specified stream, preserving its original color depth.
Namespace: KGySoft.Drawing.ImagingAssembly: KGySoft.Drawing.Core (in KGySoft.Drawing.Core.dll) Version: 10.0.0-rc.1
public static Task EncodeHighColorImageAsync(
IReadableBitmapData imageData,
Stream stream,
bool allowFullScan = false,
Color32 backColor = default,
byte alphaThreshold = 128,
TaskConfig? asyncConfig = null
)
Public Shared Function EncodeHighColorImageAsync (
imageData As IReadableBitmapData,
stream As Stream,
Optional allowFullScan As Boolean = false,
Optional backColor As Color32 = Nothing,
Optional alphaThreshold As Byte = 128,
Optional asyncConfig As TaskConfig = Nothing
) As Task
public:
static Task^ EncodeHighColorImageAsync(
IReadableBitmapData^ imageData,
Stream^ stream,
bool allowFullScan = false,
Color32 backColor = Color32(),
unsigned char alphaThreshold = 128,
TaskConfig^ asyncConfig = nullptr
)
static member EncodeHighColorImageAsync :
imageData : IReadableBitmapData *
stream : Stream *
?allowFullScan : bool *
?backColor : Color32 *
?alphaThreshold : byte *
?asyncConfig : TaskConfig
(* Defaults:
let _allowFullScan = defaultArg allowFullScan false
let _backColor = defaultArg backColor new Color32()
let _alphaThreshold = defaultArg alphaThreshold 128
let _asyncConfig = defaultArg asyncConfig null
*)
-> Task
- imageData IReadableBitmapData
- The image data to write. Possible alpha pixels might be blended with backColor but otherwise the color depth will be preserved.
- stream Stream
- The stream to save the encoded animation into.
- allowFullScan Boolean (Optional)
- to allow scanning the whole image for each layers to be able to re-use the local palette of the current layer.
to expand the initial layer area to the local pixels only. This parameter is optional.
Default value: . - backColor Color32 (Optional)
- Colors with alpha (transparency), whose Color32.A field
is equal to or greater than alphaThreshold will be blended with this color during the encoding.
The alpha value (Color32.A field) of the specified background color is ignored. This parameter is optional.
Default value: The default value of the Color32 type, which has the same RGB values as Black. - alphaThreshold Byte (Optional)
- Specifies a threshold value for the Color32.A field, under which a pixel is considered transparent.
If 0, then the final composite image will not have transparent pixels. This parameter is optional.
Default value: 128. - asyncConfig TaskConfig (Optional)
- The configuration of the asynchronous operation such as parallelization, cancellation, reporting progress, etc.
When Progress is set in this parameter,
then this library always passes a DrawingOperation instance to the generic methods of
the IAsyncProgress interface. This parameter is optional.
Default value: .
TaskA task that represents the asynchronous operation.
This method is not a blocking call even if the MaxDegreeOfParallelism property of the asyncConfig parameter is 1.
The encoding itself cannot be parallelized. The MaxDegreeOfParallelism setting affects only some processing steps if the size of a layer exceeds a threshold.
See the
Remarks section of the
EncodeHighColorImage method for more details.