BitmapDataExtensionsCopyTo(IReadableBitmapData, IWritableBitmapData, Rectangle, Point, IQuantizer, IDitherer, ParallelConfig) Method
Copies the
source IReadableBitmapData into the
target IWritableBitmapData
without scaling and blending. This method works between any pair of source and target
KnownPixelFormats and supports quantizing and dithering.
To draw a bitmap data into another one with blending use the
DrawInto methods,
or to use custom a function to specify how the source and target pixels should be combined, use the
Combine methods instead.
Namespace: KGySoft.Drawing.ImagingAssembly: KGySoft.Drawing.Core (in KGySoft.Drawing.Core.dll) Version: 10.0.0-rc.1
public static bool CopyTo(
this IReadableBitmapData source,
IWritableBitmapData target,
Rectangle sourceRectangle,
Point targetLocation,
IQuantizer? quantizer,
IDitherer? ditherer,
ParallelConfig? parallelConfig
)
<ExtensionAttribute>
Public Shared Function CopyTo (
source As IReadableBitmapData,
target As IWritableBitmapData,
sourceRectangle As Rectangle,
targetLocation As Point,
quantizer As IQuantizer,
ditherer As IDitherer,
parallelConfig As ParallelConfig
) As Boolean
public:
[ExtensionAttribute]
static bool CopyTo(
IReadableBitmapData^ source,
IWritableBitmapData^ target,
Rectangle sourceRectangle,
Point targetLocation,
IQuantizer^ quantizer,
IDitherer^ ditherer,
ParallelConfig^ parallelConfig
)
[<ExtensionAttribute>]
static member CopyTo :
source : IReadableBitmapData *
target : IWritableBitmapData *
sourceRectangle : Rectangle *
targetLocation : Point *
quantizer : IQuantizer *
ditherer : IDitherer *
parallelConfig : ParallelConfig -> bool
- source IReadableBitmapData
- The source IReadableBitmapData to be copied into the target.
- target IWritableBitmapData
- The target IWritableBitmapData into which source should be copied.
- sourceRectangle Rectangle
- A Rectangle that specifies the portion of the source to be copied into the target.
- targetLocation Point
- The target location. Target size will be always the same as the source size.
- quantizer IQuantizer
- An IQuantizer instance to be used. If not specified, then the copying operation might automatically
pick a quantizer based on target PixelFormat.
- ditherer IDitherer
- The ditherer to be used. Might be ignored if quantizer is not specified
and target PixelFormat format has at least 24 bits-per-pixel size.
- parallelConfig ParallelConfig
- The configuration of the 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.
If , then the degree of parallelization is configured automatically.
Boolean, if the operation completed successfully.
, if the operation has been canceled and the
ThrowIfCanceled property
of the
parallelConfig parameter was
.In Visual Basic and C#, you can call this method as an instance method on any object of type
IReadableBitmapData. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).
This method blocks the caller as it executes synchronously, though the
parallelConfig parameter allows configuring the degree of parallelism,
cancellation and progress reporting. Use the
BeginCopyTo or
CopyToAsync
(in .NET Framework 4.0 and above) methods to perform the operation asynchronously.
The copied area is automatically clipped if its size or targetLocation makes it impossible to completely fit in the target.
If target can represent a narrower set of colors, then the result will be automatically quantized to the colors of the target,
even if there is no quantizer specified. To use dithering a ditherer must be explicitly specified though.
If quantizer is specified, but it uses more/different colors than target can represent,
then the result will eventually be quantized to target, though the result may have a poorer quality than expected.