Beispiel #1
0
 /// <summary>
 /// Begins to load a managed <see cref="IReadWriteBitmapData"/> instance from the specified <paramref name="stream"/> asynchronously that was saved by
 /// the <see cref="BitmapDataExtensions.Save">BitmapDataExtensions.Save</see> method.
 /// <br/>See the <strong>Remarks</strong> section for details.
 /// </summary>
 /// <param name="stream">The stream to load the bitmap data from.</param>
 /// <param name="asyncConfig">The configuration of the asynchronous operation such as cancellation, reporting progress, etc. This parameter is optional.
 /// <br/>Default value: <see langword="null"/>.</param>
 /// <returns>An <see cref="IAsyncResult"/> that represents the asynchronous operation, which could still be pending.</returns>
 /// <remarks>
 /// <para>In .NET Framework 4.0 and above you can use also the <see cref="LoadAsync">LoadAsync</see> method.</para>
 /// <para>To finish the operation and to get the exception that occurred during the operation you have to call the <see cref="EndLoad">EndLoad</see> method.</para>
 /// <para>This method is not a blocking call, though the operation is not parallelized and the <see cref="AsyncConfigBase.MaxDegreeOfParallelism"/> property of the <paramref name="asyncConfig"/> parameter is ignored.</para>
 /// </remarks>
 public static IAsyncResult BeginLoad(Stream stream, AsyncConfig asyncConfig = null)
 {
     if (stream == null)
     {
         throw new ArgumentNullException(nameof(stream), PublicResources.ArgumentNull);
     }
     return(AsyncContext.BeginOperation(ctx => DoLoadBitmapData(AsyncContext.Null, stream), asyncConfig));
 }
Beispiel #2
0
 /// <summary>
 /// Begins to clear the content of the specified <paramref name="bitmapData"/> and fills it with the specified <paramref name="color"/> asynchronously.
 /// <br/>This method is similar to <see cref="Graphics.Clear">Graphics.Clear</see> except that this one supports any <see cref="PixelFormat"/> and also dithering.
 /// <br/>See the <strong>Remarks</strong> section for details.
 /// </summary>
 /// <param name="bitmapData">The <see cref="IWritableBitmapData"/> to be cleared.</param>
 /// <param name="color">A <see cref="Color32"/> that represents the desired result color of the <paramref name="bitmapData"/>.
 /// If it has transparency, which is not supported by <see cref="IBitmapData.PixelFormat"/> of <paramref name="bitmapData"/>, then the result might be either
 /// completely transparent (depends also on <see cref="IBitmapData.AlphaThreshold"/>), or the color will be blended with <see cref="IBitmapData.BackColor"/>.
 /// </param>
 /// <param name="ditherer">The ditherer to be used for the clearing. Has no effect if <see cref="IBitmapData.PixelFormat"/> of <paramref name="bitmapData"/> has at least 24 bits-per-pixel size. This parameter is optional.
 /// <br/>Default value: <see langword="null"/>.</param>
 /// <param name="asyncConfig">The configuration of the asynchronous operation such as parallelization, cancellation, reporting progress, etc. This parameter is optional.
 /// <br/>Default value: <see langword="null"/>.</param>
 /// <returns>An <see cref="IAsyncResult"/> that represents the asynchronous operation, which could still be pending.</returns>
 /// <remarks>
 /// <para>In .NET Framework 4.0 and above you can use also the <see cref="ClearAsync">ClearAsync</see> method.</para>
 /// <para>To finish the operation and to get the exception that occurred during the operation you have to call the <see cref="EndClear">EndClear</see> method.</para>
 /// <para>This method is not a blocking call even if the <see cref="AsyncConfigBase.MaxDegreeOfParallelism"/> property of the <paramref name="asyncConfig"/> parameter is 1.</para>
 /// </remarks>
 public static IAsyncResult BeginClear(this IWritableBitmapData bitmapData, Color32 color, IDitherer ditherer = null, AsyncConfig asyncConfig = null)
 {
     if (bitmapData == null)
         throw new ArgumentNullException(nameof(bitmapData), PublicResources.ArgumentNull);
     return AsyncContext.BeginOperation(ctx => DoClear(ctx, bitmapData, color, ditherer), asyncConfig);
 }
Beispiel #3
0
 internal override IAsyncResult BeginGenerate(AsyncConfig asyncConfig)
 => sourceBitmapData.BeginDrawInto(targetBitmapData, new Rectangle(0, 0, sourceBitmapData.Width, sourceBitmapData.Height),
                                   new Rectangle(0, 0, targetBitmapData.Width, targetBitmapData.Height),
                                   scalingMode: ScalingMode, asyncConfig: asyncConfig);
Beispiel #4
0
 internal override IAsyncResult BeginGenerate(AsyncConfig asyncConfig)
 => BitmapData.BeginAdjustBrightness(Value, channels: ColorChannels, asyncConfig: asyncConfig);
Beispiel #5
0
 internal abstract IAsyncResult BeginGenerate(AsyncConfig asyncConfig);
Beispiel #6
0
 internal override IAsyncResult BeginGenerate(AsyncConfig asyncConfig)
 => sourceBitmap.BeginConvertPixelFormat(PixelFormat, Quantizer, Ditherer, asyncConfig);