BitmapPainter


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

BitmapPainter(image: ImageBitmap, srcOffset: IntOffset, srcSize: IntSize)
Cmn

Public functions

open operator Boolean
equals(other: Any?)
Cmn
open Int
Cmn
open String
Cmn

Protected functions

open Boolean
applyAlpha(alpha: Float)

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

Cmn
open Boolean

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

Cmn
open Unit

Implementation of drawing logic for instances of Painter.

Cmn

Public properties

open Size

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

Cmn

Inherited functions

From androidx.compose.ui.graphics.painter.Painter
open Boolean

Apply the appropriate internal configuration to positioning content with the given LayoutDirection

Cmn
Unit
DrawScope.draw(size: Size, alpha: Float, colorFilter: ColorFilter?)
Cmn

Public constructors

BitmapPainter

BitmapPainter(
    image: ImageBitmap,
    srcOffset: IntOffset = IntOffset.Zero,
    srcSize: IntSize = IntSize(image.width, image.height)
)
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:

  1. Left and top bounds must be greater than or equal to zero

  2. Source size must be greater than zero

  3. Source size must be less than or equal to the dimensions of image

Public functions

equals

open operator fun equals(other: Any?): Boolean

hashCode

open fun hashCode(): Int

toString

open fun toString(): String

Protected functions

applyAlpha

protected open 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 open 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

protected open 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

Public properties

intrinsicSize

open val intrinsicSizeSize

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