BitmapDataExtensionsToTransparent(IReadableBitmapData) Method
Returns a new
IReadWriteBitmapData, which is the clone of the specified
bitmapData with transparent background.
Namespace: KGySoft.Drawing.ImagingAssembly: KGySoft.Drawing.Core (in KGySoft.Drawing.Core.dll) Version: 10.0.0-rc.1
public static IReadWriteBitmapData ToTransparent(
this IReadableBitmapData bitmapData
)
<ExtensionAttribute>
Public Shared Function ToTransparent (
bitmapData As IReadableBitmapData
) As IReadWriteBitmapData
public:
[ExtensionAttribute]
static IReadWriteBitmapData^ ToTransparent(
IReadableBitmapData^ bitmapData
)
[<ExtensionAttribute>]
static member ToTransparent :
bitmapData : IReadableBitmapData -> IReadWriteBitmapData
- bitmapData IReadableBitmapData
- The IReadableBitmapData to convert to transparent.
IReadWriteBitmapDataA new
IReadWriteBitmapData, which is the clone of the specified
bitmapData with transparent background.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
ToTransparent(IReadableBitmapData, ParallelConfig) overload to configure these, while still executing the method synchronously.
Alternatively, use the
BeginToTransparent(IReadableBitmapData, AsyncConfig) or
ToTransparentAsync(IReadableBitmapData, TaskConfig)
(in .NET Framework 4.0 and above) methods for asynchronous call and to adjust parallelization, set up cancellation and for reporting progress.
This method uses the bottom-left pixel to determine the background color, which must be completely opaque; otherwise, just an exact clone of bitmapData will be returned.
This method always returns a new IReadWriteBitmapData that has a pixel format with alpha support.
To attempt to make an IReadWriteBitmapData transparent without creating a new instance use the MakeTransparent method.
To force replacing even non-completely opaque pixels use the ToTransparent(IReadableBitmapData, Color32) overload instead.
Please note that unlike the
MakeOpaque method, this one changes exactly one color shade without any tolerance.