Class RoundedDrawable


  • public class RoundedDrawable
    extends android.graphics.drawable.Drawable
    • Nested Class Summary

      • Nested classes/interfaces inherited from class android.graphics.drawable.Drawable

        android.graphics.drawable.Drawable.Callback, android.graphics.drawable.Drawable.ConstantState
    • Constructor Summary

      Constructors 
      Constructor Description
      RoundedDrawable​(android.graphics.Bitmap bitmap)  
    • Constructor Detail

      • RoundedDrawable

        public RoundedDrawable​(android.graphics.Bitmap bitmap)
    • Method Detail

      • fromBitmap

        public static RoundedDrawable fromBitmap​(android.graphics.Bitmap bitmap)
      • fromDrawable

        public static android.graphics.drawable.Drawable fromDrawable​(android.graphics.drawable.Drawable drawable)
      • drawableToBitmap

        public static android.graphics.Bitmap drawableToBitmap​(android.graphics.drawable.Drawable drawable)
      • getSourceBitmap

        public android.graphics.Bitmap getSourceBitmap()
      • isStateful

        public boolean isStateful()
        Overrides:
        isStateful in class android.graphics.drawable.Drawable
      • onStateChange

        protected boolean onStateChange​(int[] state)
        Overrides:
        onStateChange in class android.graphics.drawable.Drawable
      • onBoundsChange

        protected void onBoundsChange​(@NonNull
                                      android.graphics.Rect bounds)
        Overrides:
        onBoundsChange in class android.graphics.drawable.Drawable
      • draw

        public void draw​(@NonNull
                         android.graphics.Canvas canvas)
        Specified by:
        draw in class android.graphics.drawable.Drawable
      • getOpacity

        public int getOpacity()
        Specified by:
        getOpacity in class android.graphics.drawable.Drawable
      • getAlpha

        public int getAlpha()
        Overrides:
        getAlpha in class android.graphics.drawable.Drawable
      • setAlpha

        public void setAlpha​(int alpha)
        Specified by:
        setAlpha in class android.graphics.drawable.Drawable
      • getColorFilter

        public android.graphics.ColorFilter getColorFilter()
        Overrides:
        getColorFilter in class android.graphics.drawable.Drawable
      • setColorFilter

        public void setColorFilter​(android.graphics.ColorFilter cf)
        Specified by:
        setColorFilter in class android.graphics.drawable.Drawable
      • setDither

        public void setDither​(boolean dither)
        Overrides:
        setDither in class android.graphics.drawable.Drawable
      • setFilterBitmap

        public void setFilterBitmap​(boolean filter)
        Overrides:
        setFilterBitmap in class android.graphics.drawable.Drawable
      • getIntrinsicWidth

        public int getIntrinsicWidth()
        Overrides:
        getIntrinsicWidth in class android.graphics.drawable.Drawable
      • getIntrinsicHeight

        public int getIntrinsicHeight()
        Overrides:
        getIntrinsicHeight in class android.graphics.drawable.Drawable
      • getCornerRadius

        public float getCornerRadius()
        Returns:
        the corner radius.
      • getCornerRadius

        public float getCornerRadius​(int corner)
        Parameters:
        corner - the specific corner to get radius of.
        Returns:
        the corner radius of the specified corner.
      • setCornerRadius

        public RoundedDrawable setCornerRadius​(float radius)
        Sets all corners to the specified radius.
        Parameters:
        radius - the radius.
        Returns:
        the RoundedDrawable for chaining.
      • setCornerRadius

        public RoundedDrawable setCornerRadius​(int corner,
                                               float radius)
        Sets the corner radius of one specific corner.
        Parameters:
        corner - the corner.
        radius - the radius.
        Returns:
        the RoundedDrawable for chaining.
      • setCornerRadius

        public RoundedDrawable setCornerRadius​(float topLeft,
                                               float topRight,
                                               float bottomRight,
                                               float bottomLeft)
        Sets the corner radii of all the corners.
        Parameters:
        topLeft - top left corner radius.
        topRight - top right corner radius
        bottomRight - bototm right corner radius.
        bottomLeft - bottom left corner radius.
        Returns:
        the RoundedDrawable for chaining.
      • getBorderWidth

        public float getBorderWidth()
      • getBorderColor

        public int getBorderColor()
      • getBorderColors

        public android.content.res.ColorStateList getBorderColors()
      • setBorderColor

        public RoundedDrawable setBorderColor​(android.content.res.ColorStateList colors)
      • isOval

        public boolean isOval()
      • getScaleType

        public android.widget.ImageView.ScaleType getScaleType()
      • setScaleType

        public RoundedDrawable setScaleType​(android.widget.ImageView.ScaleType scaleType)
      • getTileModeX

        public android.graphics.Shader.TileMode getTileModeX()
      • setTileModeX

        public RoundedDrawable setTileModeX​(android.graphics.Shader.TileMode tileModeX)
      • getTileModeY

        public android.graphics.Shader.TileMode getTileModeY()
      • setTileModeY

        public RoundedDrawable setTileModeY​(android.graphics.Shader.TileMode tileModeY)
      • toBitmap

        public android.graphics.Bitmap toBitmap()