The second Android 11 Developer Preview is now available, test it out and share your feedback.

ImagePainter

data class ImagePainter : Painter
kotlin.Any
   ↳ androidx.ui.graphics.painter.Painter
   ↳ androidx.ui.graphics.painter.ImagePainter

Painter implementation used to draw an ImageAsset into the provided canvas This implementation can handle applying alpha and ColorFilter to it's drawn result

Summary

Public constructors

Painter implementation used to draw an ImageAsset into the provided canvas This implementation can handle applying alpha and ColorFilter to it's drawn result

Protected methods

Boolean
applyAlpha(alpha: Float)

Apply the provided alpha value returning true if it was applied successfully, or false if it could not be applied

Boolean

Apply the provided color filter returning true if it was applied successfully, or false if it could not be applied

Unit
onDraw(canvas: Canvas, bounds: PxSize)

Implementation of drawing logic for instances of Painter.

Inherited functions

Inherited extension functions

From androidx.ui.core
DrawModifier
Painter.asModifier(sizeToIntrinsics: Boolean = true, alignment: Alignment = Alignment.Center, scaleFit: ScaleFit = ScaleFit.Fit, alpha: Float = DefaultAlpha, colorFilter: ColorFilter? = null, rtl: Boolean = false)

Create a DrawModifier from this Painter.

Properties

PxSize

Return the dimension of the underlying ImageAsset as it's intrinsic width and height

Public constructors

<init>

ImagePainter(image: ImageAsset)

Painter implementation used to draw an ImageAsset into the provided canvas This implementation can handle applying alpha and ColorFilter to it's drawn result

Protected methods

applyAlpha

protected fun applyAlpha(alpha: Float): Boolean

Apply the provided alpha value returning true if it was applied successfully, or false if it could not be applied

applyColorFilter

protected fun applyColorFilter(colorFilter: ColorFilter?): Boolean

Apply the provided color filter returning true if it was applied successfully, or false if it could not be applied

onDraw

protected fun onDraw(
    canvas: Canvas,
    bounds: PxSize
): Unit

Implementation of drawing logic for instances of Painter. This is invoked internally within draw after the positioning and configuring the Painter

Properties

intrinsicSize

val intrinsicSize: PxSize

Return the dimension of the underlying ImageAsset as it's intrinsic width and height