public class

RoundedCornersDrawable

extends ForwardingDrawable
implements Rounded
java.lang.Object
   ↳ android.graphics.drawable.Drawable
     ↳ com.facebook.drawee.drawable.ForwardingDrawable
       ↳ com.facebook.drawee.drawable.RoundedCornersDrawable

Class Overview

Drawable that draws underlying drawable with rounded corners.

Summary

Nested Classes
enum RoundedCornersDrawable.Type  
[Expand]
Inherited Fields
From class com.facebook.drawee.drawable.ForwardingDrawable
Public Constructors
RoundedCornersDrawable(Drawable drawable)
Creates a new RoundedCornersDrawable with given underlying drawable.
Public Methods
void draw(Canvas canvas)
int getBorderColor()
Gets the border color.
float getBorderWidth()
Gets the border width.
int getOverlayColor()
Gets the overlay color.
float getPadding()
Gets the padding.
boolean getPaintFilterBitmap()
Gets whether to set FILTER_BITMAP_FLAG flag to Paint.
float[] getRadii()
Gets the radii.
boolean getScaleDownInsideBorders()
Gets whether image should be scaled down inside borders.
boolean isCircle()
Returns whether or not this drawable rounds as circle.
void setBorder(int color, float width)
Sets the border
void setCircle(boolean isCircle)
Sets whether to round as circle.
void setOverlayColor(int overlayColor)
Sets the overlay color for corner type OVERLAY_COLOR
void setPadding(float padding)
void setPaintFilterBitmap(boolean paintFilterBitmap)
Sets FILTER_BITMAP_FLAG flag to Paint.
void setRadii(float[] radii)
Sets radii values to be used for rounding.
void setRadius(float radius)
Sets radius to be used for rounding
void setScaleDownInsideBorders(boolean scaleDownInsideBorders)
Sets whether image should be scaled down inside borders.
void setType(RoundedCornersDrawable.Type type)
Sets the type of rounding process
Protected Methods
void onBoundsChange(Rect bounds)
[Expand]
Inherited Methods
From class com.facebook.drawee.drawable.ForwardingDrawable
From class android.graphics.drawable.Drawable
From class java.lang.Object
From interface android.graphics.drawable.Drawable.Callback
From interface com.facebook.drawee.drawable.DrawableParent
From interface com.facebook.drawee.drawable.Rounded
From interface com.facebook.drawee.drawable.TransformAwareDrawable
From interface com.facebook.drawee.drawable.TransformCallback

Public Constructors

public RoundedCornersDrawable (Drawable drawable)

Creates a new RoundedCornersDrawable with given underlying drawable.

Parameters
drawable underlying drawable

Public Methods

public void draw (Canvas canvas)

public int getBorderColor ()

Gets the border color.

public float getBorderWidth ()

Gets the border width.

public int getOverlayColor ()

Gets the overlay color.

public float getPadding ()

Gets the padding.

public boolean getPaintFilterBitmap ()

Gets whether to set FILTER_BITMAP_FLAG flag to Paint.

public float[] getRadii ()

Gets the radii.

public boolean getScaleDownInsideBorders ()

Gets whether image should be scaled down inside borders.

public boolean isCircle ()

Returns whether or not this drawable rounds as circle.

public void setBorder (int color, float width)

Sets the border

Parameters
color of the border
width of the border

public void setCircle (boolean isCircle)

Sets whether to round as circle.

Parameters
isCircle whether or not to round as circle

public void setOverlayColor (int overlayColor)

Sets the overlay color for corner type OVERLAY_COLOR

Parameters
overlayColor the color to filled outside the rounded corners

public void setPadding (float padding)

public void setPaintFilterBitmap (boolean paintFilterBitmap)

Sets FILTER_BITMAP_FLAG flag to Paint. FILTER_BITMAP_FLAG

This should generally be on when drawing bitmaps, unless performance-bound (rendering to software canvas) or preferring pixelation artifacts to blurriness when scaling significantly.

Parameters
paintFilterBitmap whether to set FILTER_BITMAP_FLAG flag to Paint.

public void setRadii (float[] radii)

Sets radii values to be used for rounding. Each corner receive two radius values [X, Y]. The corners are ordered top-left, top-right, bottom-right, bottom-left

Parameters
radii Array of 8 values, 4 pairs of [X,Y] radii

public void setRadius (float radius)

Sets radius to be used for rounding

Parameters
radius corner radius in pixels

public void setScaleDownInsideBorders (boolean scaleDownInsideBorders)

Sets whether image should be scaled down inside borders.

public void setType (RoundedCornersDrawable.Type type)

Sets the type of rounding process

Parameters
type type of rounding process

Protected Methods

protected void onBoundsChange (Rect bounds)