BitmapDataExtensionsToGrayscale(IReadableBitmapData) Method
Namespace: KGySoft.Drawing.ImagingAssembly: KGySoft.Drawing.Core (in KGySoft.Drawing.Core.dll) Version: 10.0.0-rc.1
public static IReadWriteBitmapData ToGrayscale(
this IReadableBitmapData bitmapData
)
<ExtensionAttribute>
Public Shared Function ToGrayscale (
bitmapData As IReadableBitmapData
) As IReadWriteBitmapData
public:
[ExtensionAttribute]
static IReadWriteBitmapData^ ToGrayscale(
IReadableBitmapData^ bitmapData
)
[<ExtensionAttribute>]
static member ToGrayscale :
bitmapData : IReadableBitmapData -> IReadWriteBitmapData
- bitmapData IReadableBitmapData
- The IReadableBitmapData to convert to grayscale.
IReadWriteBitmapDataAn
IReadWriteBitmapData containing the grayscale version of the original
bitmapData.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
ToGrayscale(IReadableBitmapData, ParallelConfig) overload to configure these, while still executing the method synchronously.
Alternatively, use the
BeginToGrayscale or
ToGrayscaleAsync
(in .NET Framework 4.0 and above) methods for asynchronous call and to adjust parallelization, set up cancellation and for reporting progress.
This method always returns a new IReadWriteBitmapData with a pixel format matching the original color depth.
To make an IReadWriteBitmapData grayscale without creating a new instance use the MakeGrayscale method.