ImagePainter
data class ImagePainter : Painter
kotlin.Any | ||
↳ | androidx.compose.ui.graphics.painter.Painter | |
↳ | androidx.compose.ui.graphics.painter.ImagePainter |
Painter implementation used to draw an ImageBitmap into the provided canvas This implementation can handle applying alpha and ColorFilter to it's drawn result
Summary
Public constructors | |
---|---|
<init>(image: ImageBitmap, srcOffset: IntOffset = IntOffset.Zero, srcSize: IntSize = IntSize(image.width, image.height)) Painter implementation used to draw an ImageBitmap 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 |
applyColorFilter(colorFilter: ColorFilter?) Apply the provided color filter returning true if it was applied successfully, or false if it could not be applied |
Unit |
Implementation of drawing logic for instances of Painter. |
Inherited functions | |
---|---|
Properties | |
---|---|
Size |
Return the dimension of the underlying ImageBitmap as it's intrinsic width and height |
Public constructors
<init>
ImagePainter(
image: ImageBitmap,
srcOffset: IntOffset = IntOffset.Zero,
srcSize: IntSize = IntSize(image.width, image.height))
Painter implementation used to draw an ImageBitmap into the provided canvas This implementation can handle applying alpha and ColorFilter to it's drawn result
Parameters | |
---|---|
image: ImageBitmap | The ImageBitmap to draw |
srcOffset: IntOffset = IntOffset.Zero | Optional offset relative to image used to draw a subsection of the ImageBitmap. By default this uses the origin of image |
srcSize: IntSize = IntSize(image.width, image.height) | Optional dimensions representing size of the subsection of image to draw Both the offset and size must have the following requirements: |
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 DrawScope.onDraw(): 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: Size
Return the dimension of the underlying ImageBitmap as it's intrinsic width and height