BitmapDataExtensionsToTransparent(IReadableBitmapData, Color32) 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,
Color32 transparentColor
)
<ExtensionAttribute>
Public Shared Function ToTransparent (
bitmapData As IReadableBitmapData,
transparentColor As Color32
) As IReadWriteBitmapData
public:
[ExtensionAttribute]
static IReadWriteBitmapData^ ToTransparent(
IReadableBitmapData^ bitmapData,
Color32 transparentColor
)
[<ExtensionAttribute>]
static member ToTransparent :
bitmapData : IReadableBitmapData *
transparentColor : Color32 -> IReadWriteBitmapData
- bitmapData IReadableBitmapData
- The IReadableBitmapData to convert to transparent.
- transparentColor Color32
- Specifies the color to make 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, Color32, ParallelConfig) overload to configure these, while still executing the method synchronously.
Alternatively, use the
BeginToTransparent(IReadableBitmapData, Color32, AsyncConfig) or
ToTransparentAsync(IReadableBitmapData, Color32, 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 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 auto-detect the background color to be made transparent use the ToTransparent(IReadableBitmapData) overload instead.
Please note that unlike the
MakeOpaque method, this one changes exactly one color shade without any tolerance.