convert

fun convert(    view: View,     @ColorInt backgroundColor: Int = Color.TRANSPARENT,     backgroundCornerRadius: CornerRadius = CornerRadius(0f),     trimBorders: Boolean = false,     padding: Padding = Padding(0f),     margin: Margin = Margin(0f),     viewsToExclude: ArrayList<ExcludeView> = arrayListOf()): Bitmap

Converts a view to a bitmap image.

Return

A bitmap of the view.

Parameters

view

View from which the image will be generated.

backgroundColor

Background color to apply to the image.

backgroundCornerRadius

Corner radius for the background.

trimBorders

Determines whether before applying margin and padding the borders of the view are cropped. To define the cropping area, use the background color of the view.

padding

Padding between the view edges and the margin internal edges. Values must be zero or positive.

margin

Margin between the padding external edges and the image edges. Values must be zero or positive.

viewsToExclude

If the view is a view group and has a children views, it determines the children's views to exclude when generating the image.

Throws

If the view is not already laid out.

If any child view of the view cannot be excluded from the image, or if the padding or margin values are invalid.