BitmapDataExtensionsCopyTo(IReadableBitmapData, IWritableBitmapData, Point, IQuantizer, IDitherer) Method
Namespace: KGySoft.Drawing.ImagingAssembly: KGySoft.Drawing.Core (in KGySoft.Drawing.Core.dll) Version: 9.0.0
public static void CopyTo(
this IReadableBitmapData source,
IWritableBitmapData target,
Point targetLocation = default,
IQuantizer? quantizer = null,
IDitherer? ditherer = null
)
<ExtensionAttribute>
Public Shared Sub CopyTo (
source As IReadableBitmapData,
target As IWritableBitmapData,
Optional targetLocation As Point = Nothing,
Optional quantizer As IQuantizer = Nothing,
Optional ditherer As IDitherer = Nothing
)
public:
[ExtensionAttribute]
static void CopyTo(
IReadableBitmapData^ source,
IWritableBitmapData^ target,
Point targetLocation = Point(),
IQuantizer^ quantizer = nullptr,
IDitherer^ ditherer = nullptr
)
[<ExtensionAttribute>]
static member CopyTo :
source : IReadableBitmapData *
target : IWritableBitmapData *
?targetLocation : Point *
?quantizer : IQuantizer *
?ditherer : IDitherer
(* Defaults:
let _targetLocation = defaultArg targetLocation new Point()
let _quantizer = defaultArg quantizer null
let _ditherer = defaultArg ditherer null
*)
-> unit
- source IReadableBitmapData
- The source IReadableBitmapData to be copied into the target.
- target IWritableBitmapData
- The target IWritableBitmapData into which source should be copied.
- targetLocation Point (Optional)
- The target location. Target size will be always the same as the source size. This parameter is optional.
Default value: Point.Empty. - quantizer IQuantizer (Optional)
- An IQuantizer instance to be used. If not specified, then the copying operation might automatically
pick a quantizer based on target PixelFormat. This parameter is optional.
Default value: . - ditherer IDitherer (Optional)
- 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. This parameter is optional.
Default value: .
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 adjusts the degree of parallelization automatically, blocks the caller, and does not support cancellation or reporting progress. You can use
the
CopyTo(IReadableBitmapData, IWritableBitmapData, Point, IQuantizer, IDitherer, ParallelConfig) overload to configure these, while still executing the method synchronously. Alternatively, 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.