Google se compromete a impulsar la igualdad racial para las comunidades afrodescendientes. Obtén información al respecto.

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
draw(@NonNull canvas: Canvas)

open Int

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

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
setAlpha(alpha: Int)

open Unit

Enables or disables anti-aliasing for this drawable.

open Unit
setCircular(circular: Boolean)

Sets the image shape to circular.

open Unit

open Unit
setCornerRadius(cornerRadius: Float)

Sets the corner radius to be applied when drawing the bitmap.

open Unit
setDither(dither: Boolean)

open Unit

open Unit
setGravity(gravity: Int)

Set the gravity used to position/stretch the bitmap within its bounds.

open Unit
setMipMap(mipMap: Boolean)

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

Set the density at which this drawable will be rendered.

Protected methods
open Unit
onBoundsChange(bounds: Rect!)

Public methods

draw

open fun draw(@NonNull canvas: Canvas): Unit

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.

getGravity

open fun getGravity(): Int

Get the gravity used to position/stretch the bitmap within its bounds.

Return
Int the gravity applied to the bitmap

getIntrinsicHeight

open fun getIntrinsicHeight(): Int

getIntrinsicWidth

open fun getIntrinsicWidth(): Int

getOpacity

open fun getOpacity(): Int

getPaint

@NonNull fun getPaint(): Paint

Returns the paint used to render this drawable.

hasAntiAlias

open fun hasAntiAlias(): Boolean

Indicates whether anti-aliasing is enabled for this drawable.

Return
Boolean True if anti-aliasing is enabled, false otherwise.

hasMipMap

open fun hasMipMap(): Boolean

Indicates whether the mipmap hint is enabled on this drawable's bitmap.

Return
Boolean True if the mipmap hint is set, false otherwise. If the bitmap is null, this method always returns false.

isCircular

open fun isCircular(): Boolean
Return
Boolean true if the image is circular, else false.

setAlpha

open fun setAlpha(alpha: Int): Unit

setAntiAlias

open fun setAntiAlias(aa: Boolean): Unit

Enables or disables anti-aliasing for this drawable. Anti-aliasing affects the edges of the bitmap only so it applies only when the drawable is rotated.

Parameters
aa Boolean: True if the bitmap should be anti-aliased, false otherwise.

See Also

setCircular

open fun setCircular(circular: Boolean): Unit

Sets the image shape to circular.

This overwrites any calls made to setCornerRadius(float) so far.

setColorFilter

open fun setColorFilter(cf: ColorFilter?): Unit

setCornerRadius

open fun setCornerRadius(cornerRadius: Float): Unit

Sets the corner radius to be applied when drawing the bitmap.

setDither

open fun setDither(dither: Boolean): Unit

setFilterBitmap

open fun setFilterBitmap(filter: Boolean): Unit

setGravity

open fun setGravity(