RoundedBitmapDrawable
abstract class RoundedBitmapDrawable : Drawable
kotlin.Any | ||
↳ | android.graphics.drawable.Drawable | |
↳ | androidx.core.graphics.drawable.RoundedBitmapDrawable |
A Drawable that wraps a bitmap and can be drawn with rounded corners. You can create a RoundedBitmapDrawable from a file path, an input stream, or from a android.graphics.Bitmap
object.
Also see the android.graphics.Bitmap
class, which handles the management and transformation of raw bitmap graphics, and should be used when drawing to a android.graphics.Canvas
.
Summary
Public methods | |
---|---|
open Unit | |
open Int |
getAlpha() |
Bitmap? |
Returns the bitmap used by this drawable to render. |
open ColorFilter? | |
open Float | |
open Int |
Get the gravity used to position/stretch the bitmap within its bounds. |
open Int | |
open Int | |
open Int | |
Paint |
getPaint() Returns the paint used to render this drawable. |
open Boolean |
Indicates whether anti-aliasing is enabled for this drawable. |
open Boolean |
Indicates whether the mipmap hint is enabled on this drawable's bitmap. |
open Boolean | |
open Unit | |
open Unit |
setAntiAlias(aa: Boolean) Enables or disables anti-aliasing for this drawable. |
open Unit |
setCircular(circular: Boolean) Sets the image shape to circular. |
open Unit |
setColorFilter(cf: ColorFilter?) |
open Unit |
setCornerRadius(cornerRadius: Float) Sets the corner radius to be applied when drawing the bitmap. |
open Unit | |
open Unit |
setFilterBitmap(filter: Boolean) |
open Unit |
setGravity(gravity: Int) Set the gravity used to position/stretch the bitmap within its bounds. |
open Unit |
Enables or disables the mipmap hint for this drawable's bitmap. |
open Unit |
setTargetDensity(@NonNull canvas: Canvas) Set the density scale at which this drawable will be rendered. |
open Unit |
setTargetDensity(@NonNull metrics: DisplayMetrics) Set the density scale at which this drawable will be rendered. |
open Unit |
setTargetDensity(density: Int) Set the density at which this drawable will be rendered. |
Protected methods | |
---|---|
open Unit |
onBoundsChange(bounds: Rect!) |
Public methods
getAlpha
open fun getAlpha(): Int
getBitmap
@Nullable fun getBitmap(): Bitmap?
Returns the bitmap used by this drawable to render. May be null.
getColorFilter
open fun getColorFilter(): ColorFilter?
getCornerRadius
open fun getCornerRadius(): Float
Return | |
---|---|
Float |
The corner radius applied when drawing the bitmap. |