FitWidthBitmapDrawable


class FitWidthBitmapDrawable : Drawable


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 call. Top position of the bitmap can be controlled by setVerticalOffset call or PROPERTY_VERTICAL_OFFSET.

Summary

Public constructors

Public functions

Unit
draw(canvas: Canvas)
Int
Bitmap!

Returns the bitmap.

Drawable.ConstantState!
Int

This function is deprecated.

Rect!

Returns the Rect used for extracting the bitmap.

Int

Returns the current vertical offset.

Drawable!
Unit
setAlpha(alpha: Int)
Unit
setBitmap(bitmap: Bitmap!)

Sets the bitmap.

Unit
setColorFilter(colorFilter: ColorFilter!)
Unit
setSource(source: Rect!)

Sets the Rect used for extracting the bitmap.

Unit

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

Inherited functions

From android.graphics.drawable.Drawable
Unit
Boolean
Unit
Rect!
Unit
copyBounds(bounds: Rect!)
java-static Drawable!
createFromPath(pathName: String!)
java-static Drawable!
createFromResourceStream(
    res: Resources!,
    value: TypedValue!,
    is: InputStream!,
    srcName: String!
)
java-static Drawable!
createFromStream(is: InputStream!, srcName: String!)
java-static Drawable!
java-static Drawable!
createFromXmlInner(
    r: Resources!,
    parser: XmlPullParser!,
    attrs: AttributeSet!
)
Rect!
Drawable.Callback!
Int
ColorFilter!
Drawable!
Rect!
Unit
Int
Int
Int
Int
Int
Int
Insets!
Unit
getOutline(outline: Outline!)
Boolean
getPadding(padding: Rect!)
IntArray<Int>!
Region!
Boolean
Unit
inflate(r: Resources!, parser: XmlPullParser!, attrs: AttributeSet!)
Unit
Boolean
Boolean
Boolean
Boolean
Boolean
Unit
Unit
onBoundsChange(bounds: Rect!)
Boolean
onLayoutDirectionChanged(layoutDirection: Int)
Boolean
Boolean
java-static Int
resolveOpacity(op1: Int, op2: Int)
Unit
scheduleSelf(what: Runnable!, when: Long)
Unit
Unit
setBounds(left: Int, top: Int, right: Int, bottom: Int)
Unit
Unit
Unit
setDither(dither: Boolean)

This function is deprecated.

Unit
Unit
Unit
setHotspotBounds(left: Int, top: Int, right: Int, bottom: Int)
Boolean
setLayoutDirection(layoutDirection: Int)
Boolean
setLevel(level: Int)
Boolean
setState(stateSet: IntArray!)
Unit
setTint(tintColor: Int)
Unit
Unit
Unit
Boolean
setVisible(visible: Boolean, restart: Boolean)
Unit

Constants

PROPERTY_VERTICAL_OFFSET

Added in 1.1.0
const val PROPERTY_VERTICAL_OFFSETProperty<FitWidthBitmapDrawable!, Int!>!

Property for setVerticalOffset and getVerticalOffset.

Public constructors

FitWidthBitmapDrawable

Added in 1.1.0
FitWidthBitmapDrawable()

Public functions

draw

Added in 1.1.0
fun draw(canvas: Canvas): Unit

getAlpha

fun getAlpha(): Int
Returns
Int

Alpha value between 0(inclusive) and 255(inclusive)

getBitmap

Added in 1.1.0
fun getBitmap(): Bitmap!

Returns the bitmap.

getConstantState

fun getConstantState(): Drawable.ConstantState!

getOpacity

Added in 1.1.0
fun getOpacity(): Int

getSource

Added in 1.1.0
fun getSource(): Rect!

Returns the Rect used for extracting the bitmap.

getVerticalOffset

Added in 1.1.0
fun getVerticalOffset(): Int

Returns the current vertical offset.

mutate

fun mutate(): Drawable!

setAlpha

Added in 1.1.0
fun setAlpha(alpha: Int): Unit

setBitmap

Added in 1.1.0
fun setBitmap(bitmap: Bitmap!): Unit

Sets the bitmap.

setColorFilter

Added in 1.1.0
fun setColorFilter(colorFilter: ColorFilter!): Unit

setSource

Added in 1.1.0
fun setSource(source: Rect!): Unit

Sets the Rect used for extracting the bitmap.

setVerticalOffset

Added in 1.1.0
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.