FitWidthBitmapDrawable

open class FitWidthBitmapDrawable : Drawable
kotlin.Any
   ↳ android.graphics.drawable.Drawable
   ↳ androidx.leanback.graphics.FitWidthBitmapDrawable

Subclass of Drawable that can be used to draw a bitmap into a region. Bitmap will be scaled to fit the full width of the region and will be aligned to the top left corner. Any region outside the bounds will be clipped during #draw(Canvas) call. Top position of the bitmap can be controlled by #setVerticalOffset(int) call or #PROPERTY_VERTICAL_OFFSET.

Summary

Public constructors

Public methods
open Unit
draw(canvas: Canvas!)

open Int

open Unit
setAlpha(alpha: Int)

open Int

open Int

Returns the current vertical offset.

open Unit
setSource(source: Rect!)

Sets the Rect used for extracting the bitmap.

open Drawable!

open Rect!

Returns the Rect used for extracting the bitmap.

open Bitmap!

Returns the bitmap.

open Unit
setBitmap(bitmap: Bitmap!)

Sets the bitmap.

open Unit
setColorFilter(colorFilter: ColorFilter!)

open ConstantState!

open Unit

Sets the vertical offset which will be used for drawing the bitmap.

Properties
static Property<FitWidthBitmapDrawable!, Int!>!

Property for #setVerticalOffset(int) and #getVerticalOffset().

Public constructors

<init>

FitWidthBitmapDrawable()

Public methods

draw

open fun draw(canvas: Canvas!): Unit

getAlpha

open fun getAlpha(): Int
Return
Int: Alpha value between 0(inclusive) and 255(inclusive)

setAlpha

open fun setAlpha(alpha: Int): Unit

getOpacity

open fun getOpacity(): Int

getVerticalOffset

open fun getVerticalOffset(): Int

Returns the current vertical offset.

setSource

open fun setSource(source: Rect!): Unit

Sets the Rect used for extracting the bitmap.

mutate

open fun mutate(): Drawable!

getSource

open fun getSource(): Rect!

Returns the Rect used for extracting the bitmap.

getBitmap

open fun getBitmap(): Bitmap!

Returns the bitmap.

setBitmap

open fun setBitmap(bitmap: Bitmap!): Unit

Sets the bitmap.

setColorFilter

open fun setColorFilter(colorFilter: ColorFilter!): Unit

getConstantState

open fun getConstantState(): ConstantState!

setVerticalOffset

open fun setVerticalOffset(offset: Int): Unit

Sets the vertical offset which will be used for drawing the bitmap. The bitmap drawing will start the provided vertical offset.

Properties

PROPERTY_VERTICAL_OFFSET

static val PROPERTY_VERTICAL_OFFSET: Property<FitWidthBitmapDrawable!, Int!>!

Property for #setVerticalOffset(int) and #getVerticalOffset().