SKSurfaceExtensionsGetReadWriteBitmapData(SKSurface, SKColor, Byte) Method

Gets a managed read-write accessor for an SKSurface instance.
See the Remarks section of the BitmapExtensions.GetReadWriteBitmapData method for details and code samples. That method is for the GDI+ Bitmap type but the main principles apply for this method, too.

Definition

Namespace: KGySoft.Drawing.SkiaSharp
Assembly: KGySoft.Drawing.SkiaSharp (in KGySoft.Drawing.SkiaSharp.dll) Version: 9.0.0
C#
public static IReadWriteBitmapData GetReadWriteBitmapData(
	this SKSurface surface,
	SKColor backColor = default,
	byte alphaThreshold = 128
)

Parameters

surface  SKSurface
An SKSurface instance, whose data is about to be accessed.
backColor  SKColor  (Optional)
Determines the BackColor property of the result. When setting pixels of bitmaps without alpha support, specifies the color of the background. Color values with alpha, which are considered opaque will be blended with this color before setting the pixel in the result bitmap data. The Alpha property of the specified background color is ignored. This parameter is optional.
Default value: The bitwise zero instance of SKColor, which has the same RGB values as Black.
alphaThreshold  Byte  (Optional)
Determines the AlphaThreshold property of the result. Can be relevant in some operations such as when drawing another IReadableBitmapData instance with alpha into the returned bitmap data by the DrawInto extension methods and the specified surface has no alpha support. This parameter is optional.
Default value: 128.

Return Value

IReadWriteBitmapData
An IReadWriteBitmapData instance, which provides fast read-write access to the actual data of the specified surface.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type SKSurface. 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).

See Also