SKBitmap Constructors

Definition

Overloads

SKBitmap()

Default constructor that creates a bitmap with zero width and height, and no pixels. Its color type is set to Unknown.

SKBitmap(SKImageInfo)

Constructor that configures the bitmap based on an SKImageInfo specification.

SKBitmap(SKImageInfo, SKBitmapAllocFlags)

Constructor that configures the bitmap based on an SKImageInfo specification.

SKBitmap(SKImageInfo, SKColorTable)

Constructor that configures the bitmap based on an SKImageInfo specification and a color table.

SKBitmap(SKImageInfo, Int32)

Constructor that configures the bitmap based on an SKImageInfo specification, and the specified number of bytes per row (the stride size)

SKBitmap(SKImageInfo, SKColorTable, SKBitmapAllocFlags)

Constructor that configures the bitmap based on an SKImageInfo specification and a color table.

SKBitmap(Int32, Int32, Boolean)

Creates a bitmap with the given width, height and opacity with color type set to PlatformColorType

SKBitmap(Int32, Int32, SKColorType, SKAlphaType)

Creates a bitmap with the given width, height, color type and alpha type.

SKBitmap()

Default constructor that creates a bitmap with zero width and height, and no pixels. Its color type is set to Unknown.

public SKBitmap ();

Remarks

This constructor does not allocate a backing store for the bitmap.

SKBitmap(SKImageInfo)

Constructor that configures the bitmap based on an SKImageInfo specification.

public SKBitmap (SkiaSharp.SKImageInfo info);

Parameters

info
SKImageInfo

The description of the desired image format.

Remarks

This constructor might throw an exception if it is not possible to create a bitmap with the specified configuration (for example, the image info requires a color table, and there is no color table).

SKBitmap(SKImageInfo, SKBitmapAllocFlags)

Constructor that configures the bitmap based on an SKImageInfo specification.

public SKBitmap (SkiaSharp.SKImageInfo info, SkiaSharp.SKBitmapAllocFlags flags);

Parameters

info
SKImageInfo

The description of the desired image format.

flags
SKBitmapAllocFlags

The additional flags.

Remarks

This constructor might throw an exception if it is not possible to create a bitmap with the specified configuration (for example, the image info requires a color table, and there is no color table).

SKBitmap(SKImageInfo, SKColorTable)

Warning

This API is now obsolete.

Constructor that configures the bitmap based on an SKImageInfo specification and a color table.

[System.Obsolete("The Index8 color type and color table is no longer supported. Use SKBitmap(SKImageInfo) instead.")]
public SKBitmap (SkiaSharp.SKImageInfo info, SkiaSharp.SKColorTable ctable);

Parameters

info
SKImageInfo

The description of the desired image format.

ctable
SKColorTable

The color lookup table.

Attributes

Remarks

Use this method to create a bitmap that will use a color lookup table. The bitmap will be an 8-bit indexed bitmap, where each value represents an index into the color table, and the color is determined by the value in the specific location in the color table array.

SKBitmap(SKImageInfo, Int32)

Constructor that configures the bitmap based on an SKImageInfo specification, and the specified number of bytes per row (the stride size)

public SKBitmap (SkiaSharp.SKImageInfo info, int rowBytes);

Parameters

info
SKImageInfo

The description of the desired image format.

rowBytes
Int32

The number of bytes per row.

Remarks

This constructor might throw an exception if it is not possible to create a bitmap with the specified configuration (for example, the image info requires a color table, and there is no color table).

SKBitmap(SKImageInfo, SKColorTable, SKBitmapAllocFlags)

Warning

This API is now obsolete.

Constructor that configures the bitmap based on an SKImageInfo specification and a color table.

[System.Obsolete("The Index8 color type and color table is no longer supported. Use SKBitmap(SKImageInfo, SKBitmapAllocFlags) instead.")]
public SKBitmap (SkiaSharp.SKImageInfo info, SkiaSharp.SKColorTable ctable, SkiaSharp.SKBitmapAllocFlags flags);

Parameters

info
SKImageInfo

The description of the desired image format.

ctable
SKColorTable

The color lookup table.

flags
SKBitmapAllocFlags

The additional flags.

Attributes

Remarks

Use this method to create a bitmap that will use a color lookup table. The bitmap will be an 8-bit indexed bitmap, where each value represents an index into the color table, and the color is determined by the value in the specific location in the color table array.

SKBitmap(Int32, Int32, Boolean)

Creates a bitmap with the given width, height and opacity with color type set to PlatformColorType

public SKBitmap (int width, int height, bool isOpaque = false);

Parameters

width
Int32

The desired width in pixels.

height
Int32

The desired height in pixels.

isOpaque
Boolean

If true, sets the SKAlphaType to Opaque, otherwise it sets it to Premul.

Remarks

This constructor might throw an exception if it is not possible to create a bitmap with the specified configuration (for example, the image info requires a color table, and there is no color table).

SKBitmap(Int32, Int32, SKColorType, SKAlphaType)

Creates a bitmap with the given width, height, color type and alpha type.

public SKBitmap (int width, int height, SkiaSharp.SKColorType colorType, SkiaSharp.SKAlphaType alphaType);

Parameters

width
Int32

The desired width in pixels.

height
Int32

The desired height in pixels.

colorType
SKColorType

The desired SKColorType.

alphaType
SKAlphaType

The desired SKAlphaType.

Remarks

This constructor might throw an exception if it is not possible to create a bitmap with the specified configuration (for example, the image info requires a color table, and there is no color table).

Applies to