textToBitmap

fun textToBitmap(text: String, font: Font, @ColorInt color: Int, @FloatRange(from = 0.0) scaleFactor: Float, displayMetrics: DisplayMetrics): Bitmap

Creates a bitmap from text that the user typed and a font the user chose.

Return

a bitmap from text that the user typed and a font the user chose.

Parameters

text

The text to be displayed.

font

The font to use to show the text.

color

The color to render the text.

scaleFactor

A factor, always positive, by which to scale the bitmap size.

displayMetrics

DisplayMetrics instance.