BitmapDataExtensionsCombine(IReadableBitmapData, IReadableBitmapData, IWritableBitmapData, FuncColor64, Color64, Color64, NullablePoint, NullablePoint, NullablePoint, NullableSize, ParallelConfig) Method
Combines the pixels of source1 and source2 using the specified combineFunction, and writes the result into target.
Namespace: KGySoft.Drawing.ImagingAssembly: KGySoft.Drawing.Core (in KGySoft.Drawing.Core.dll) Version: 10.0.1
public static bool Combine(
this IReadableBitmapData source1,
IReadableBitmapData source2,
IWritableBitmapData target,
Func<Color64, Color64, Color64> combineFunction,
Point? source1Location = null,
Point? source2Location = null,
Point? targetLocation = null,
Size? size = null,
ParallelConfig? parallelConfig = null
)
<ExtensionAttribute>
Public Shared Function Combine (
source1 As IReadableBitmapData,
source2 As IReadableBitmapData,
target As IWritableBitmapData,
combineFunction As Func(Of Color64, Color64, Color64),
Optional source1Location As Point? = Nothing,
Optional source2Location As Point? = Nothing,
Optional targetLocation As Point? = Nothing,
Optional size As Size? = Nothing,
Optional parallelConfig As ParallelConfig = Nothing
) As Boolean
public:
[ExtensionAttribute]
static bool Combine(
IReadableBitmapData^ source1,
IReadableBitmapData^ source2,
IWritableBitmapData^ target,
Func<Color64, Color64, Color64>^ combineFunction,
Nullable<Point> source1Location = nullptr,
Nullable<Point> source2Location = nullptr,
Nullable<Point> targetLocation = nullptr,
Nullable<Size> size = nullptr,
ParallelConfig^ parallelConfig = nullptr
)
[<ExtensionAttribute>]
static member Combine :
source1 : IReadableBitmapData *
source2 : IReadableBitmapData *
target : IWritableBitmapData *
combineFunction : Func<Color64, Color64, Color64> *
?source1Location : Nullable<Point> *
?source2Location : Nullable<Point> *
?targetLocation : Nullable<Point> *
?size : Nullable<Size> *
?parallelConfig : ParallelConfig
(* Defaults:
let _source1Location = defaultArg source1Location null
let _source2Location = defaultArg source2Location null
let _targetLocation = defaultArg targetLocation null
let _size = defaultArg size null
let _parallelConfig = defaultArg parallelConfig null
*)
-> bool
- source1 IReadableBitmapData
- An IReadableBitmapData to be combined with source2.
- source2 IReadableBitmapData
- An IReadableBitmapData to be combined with source1.
- target IWritableBitmapData
- The target IWritableBitmapData to write the combined result into.
- combineFunction FuncColor64, Color64, Color64
- The custom function to be used to combine the colors of the bitmaps. Its first parameter represents a pixel in source1,
whereas the second parameter represents the corresponding pixel in source2. The function must be thread-safe, as it might be called concurrently.
- source1Location NullablePoint (Optional)
- A Point that specifies the origin in source1 for the operation, or to start with its top-left pixel. This parameter is optional.
Default value: . - source2Location NullablePoint (Optional)
- A Point that specifies the origin in source2 for the operation, or to start with its top-left pixel. This parameter is optional.
Default value: . - targetLocation NullablePoint (Optional)
- A Point that specifies the target location, or to write the combined result to the top-left corner of the target. Target size will be always the same as the source size. This parameter is optional.
Default value: . - size NullableSize (Optional)
- A Size that specifies the bounds of the combined pixels, or to take the largest possible area. This parameter is optional.
Default value: . - parallelConfig ParallelConfig (Optional)
- 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
BeginCombine
or
CombineAsync (in .NET Framework 4.0 and above) methods to perform the operation asynchronously.
The combined area is automatically clipped if size is larger than the dimensions of the smallest bitmap or the available sizes using the specified locations.
If target can represent a narrower set of colors, then the result will be automatically quantized to the colors of the target.
To use dithering, call the Combine(IReadableBitmapData, IReadableBitmapData, IWritableBitmapData, FuncColor32, Color32, Color32, NullablePoint, NullablePoint, NullablePoint, NullableSize, IDitherer, ParallelConfig) overload instead, and specify a ditherer.