{% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %} {% include "_shared/_reference-head-tags.html" %}

BitmapPainterKt

public final class BitmapPainterKt


Summary

Public methods

static final @NonNull BitmapPainter
BitmapPainter(
    @NonNull ImageBitmap image,
    @NonNull IntOffset srcOffset,
    @NonNull IntSize srcSize,
    @NonNull FilterQuality filterQuality
)

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

Public methods

BitmapPainter

public static final @NonNull BitmapPainter BitmapPainter(
    @NonNull ImageBitmap image,
    @NonNull IntOffset srcOffset,
    @NonNull IntSize srcSize,
    @NonNull FilterQuality filterQuality
)

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
@NonNull ImageBitmap image

The ImageBitmap to draw

@NonNull IntOffset srcOffset

Optional offset relative to image used to draw a subsection of the ImageBitmap. By default this uses the origin of image

@NonNull IntSize srcSize

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

@NonNull FilterQuality filterQuality

Sampling algorithm applied to the image when it is scaled and drawn into the destination. The default is FilterQuality.Low which scales using a bilinear sampling algorithm