Text

fun Text(    @StringOrStringRes text: Any,     textSize: Float = 12.0f,     @ColorInt textColor: Int = Color.BLACK,     position: WatermarkPosition = WatermarkPosition.MIDDLE_CENTER,     dx: Float = 0.0f,     dy: Float = 0.0f,     rotation: Float = 0.0f,     @FloatRange(from = 0.0, to = 1.0) opacity: Float = 1.0f,     typeface: Typeface? = null,     shadow: WatermarkShadow? = null,     measurementDimension: Dimension = Dimension.PX)

Parameters

text

Text for the watermark.

textSize

Text size for the watermark.

textColor

Color-int for the watermark text.

position

Position for the watermark inside of the image.

dx

Watermark offset for the x-axis.

dy

Watermark offset for the y-axis.

rotation

Rotation in degrees for the watermark.

opacity

Opacity of the watermark. This is a value from 0 to 1, where 0 means the watermark is completely transparent and 1 means the watermark is completely opaque.

typeface

Custom font for the watermark text, if value is null applies default font.

shadow

Shadow configuration for text watermark, null for not apply shadow.

measurementDimension

Type of dimension to use to draw watermark, its apply for textSize, dx, dy and shadow configuration (radius, dx and dy). For example, if the value of dx is 10f and measurementDimension is Dimension.PX, the offset of the drawn watermark will be 10 px in x-axis, but if measurementDimension is Dimension.DP, the the offset of the drawn watermark in x-axis will be calculate according the screen density. It is recommended to use DP instead of SP to prevent the text size from being affected by the device's font size setting.