createBitmap

inline fun createBitmap(width: Int, height: Int, config: Bitmap.Config = Bitmap.Config.ARGB_8888): Bitmap(source)

Returns a mutable bitmap with the specified width and height. A config can be optionally specified. If not, the default config is Bitmap.Config.ARGB_8888.

Return

A new bitmap with the specified dimensions and config

Parameters

width

The new bitmap's desired width

height

The new bitmap's desired height

config

The new bitmap's desired config


@RequiresApi(value = 26)
inline fun createBitmap(width: Int, height: Int, config: Bitmap.Config = Bitmap.Config.ARGB_8888, hasAlpha: Boolean = true, colorSpace: ColorSpace = ColorSpace.get(ColorSpace.Named.SRGB)): Bitmap(source)

Returns a mutable bitmap with the specified width and height. The config, transparency and color space can optionally be specified. They respectively default to Bitmap.Config.ARGB_8888, true and sRGB.

Return

A new bitmap with the specified dimensions and config

Parameters

width

The new bitmap's desired width

height

The new bitmap's desired height

config

The new bitmap's desired config

hasAlpha

Whether the new bitmap is opaque or not

colorSpace

The new bitmap's color space