public class

RoundingParams

extends Object
java.lang.Object
   ↳ com.facebook.drawee.generic.RoundingParams

Class Overview

Class that encapsulates rounding parameters.

Summary

Nested Classes
enum RoundingParams.RoundingMethod  
Public Constructors
RoundingParams()
Public Methods
static RoundingParams asCircle()
Factory method that creates new RoundingParams with RoundAsCircle specified.
boolean equals(Object o)
static RoundingParams fromCornersRadii(float topLeft, float topRight, float bottomRight, float bottomLeft)
Factory method that creates new RoundingParams with the specified corners radii.
static RoundingParams fromCornersRadii(float[] radii)
Factory method that creates new RoundingParams with the specified corners radii.
static RoundingParams fromCornersRadius(float radius)
Factory method that creates new RoundingParams with the specified corners radius.
int getBorderColor()
Gets the border color
float getBorderWidth()
Gets the border width
float[] getCornersRadii()
Gets the rounded corners radii.
int getOverlayColor()
Gets the overlay color.
float getPadding()
Gets the padding size
boolean getPaintFilterBitmap()
Gets whether to set FILTER_BITMAP_FLAG flag to Paint.
boolean getRoundAsCircle()
Gets whether to round as circle
RoundingParams.RoundingMethod getRoundingMethod()
Gets the rounding method.
boolean getScaleDownInsideBorders()
Gets whether image should be scaled down inside borders.
int hashCode()
RoundingParams setBorder(int color, float width)
Sets the border around the rounded drawable
RoundingParams setBorderColor(int color)
Sets the border color
RoundingParams setBorderWidth(float width)
Sets the border width
RoundingParams setCornersRadii(float topLeft, float topRight, float bottomRight, float bottomLeft)
Sets the rounded corners radii.
RoundingParams setCornersRadii(float[] radii)
Sets the rounded corners radii.
RoundingParams setCornersRadius(float radius)
Sets the rounded corners radius.
RoundingParams setOverlayColor(int overlayColor)
Sets the overlay color and changes the method to RoundingMethod.COLOR_OVERLAY.
RoundingParams setPadding(float padding)
Sets the padding on rounded drawable.
RoundingParams setPaintFilterBitmap(boolean paintFilterBitmap)
Sets FILTER_BITMAP_FLAG flag to Paint.
RoundingParams setRoundAsCircle(boolean roundAsCircle)
Sets whether to round as circle.
RoundingParams setRoundingMethod(RoundingParams.RoundingMethod roundingMethod)
Sets the rounding method.
RoundingParams setScaleDownInsideBorders(boolean scaleDownInsideBorders)
Sets whether image should be scaled down inside borders.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public RoundingParams ()

Public Methods

public static RoundingParams asCircle ()

Factory method that creates new RoundingParams with RoundAsCircle specified.

public boolean equals (Object o)

public static RoundingParams fromCornersRadii (float topLeft, float topRight, float bottomRight, float bottomLeft)

Factory method that creates new RoundingParams with the specified corners radii.

public static RoundingParams fromCornersRadii (float[] radii)

Factory method that creates new RoundingParams with the specified corners radii.

public static RoundingParams fromCornersRadius (float radius)

Factory method that creates new RoundingParams with the specified corners radius.

public int getBorderColor ()

Gets the border color

public float getBorderWidth ()

Gets the border width

public float[] getCornersRadii ()

Gets the rounded corners radii.

For performance reasons the internal array is returned directly. Do not modify it directly, but use one of the exposed corner radii setters instead.

public int getOverlayColor ()

Gets the overlay color.

public float getPadding ()

Gets the padding size

public boolean getPaintFilterBitmap ()

Gets whether to set FILTER_BITMAP_FLAG flag to Paint.

public boolean getRoundAsCircle ()

Gets whether to round as circle

public RoundingParams.RoundingMethod getRoundingMethod ()

Gets the rounding method.

public boolean getScaleDownInsideBorders ()

Gets whether image should be scaled down inside borders.

public int hashCode ()

public RoundingParams setBorder (int color, float width)

Sets the border around the rounded drawable

Parameters
color of the border
width of the width

public RoundingParams setBorderColor (int color)

Sets the border color

Parameters
color of the border

public RoundingParams setBorderWidth (float width)

Sets the border width

Parameters
width of the width

public RoundingParams setCornersRadii (float topLeft, float topRight, float bottomRight, float bottomLeft)

Sets the rounded corners radii.

Parameters
topLeft top-left corner radius in pixels
topRight top-right corner radius in pixels
bottomRight bottom-right corner radius in pixels
bottomLeft bottom-left corner radius in pixels
Returns
  • modified instance

public RoundingParams setCornersRadii (float[] radii)

Sets the rounded corners radii.

Parameters
radii float array of 8 radii in pixels. Each corner receives two radius values [X, Y]. The corners are ordered top-left, top-right, bottom-right, bottom-left.
Returns
  • modified instance

public RoundingParams setCornersRadius (float radius)

Sets the rounded corners radius.

Parameters
radius corner radius in pixels
Returns
  • modified instance

public RoundingParams setOverlayColor (int overlayColor)

Sets the overlay color and changes the method to RoundingMethod.COLOR_OVERLAY.

Parameters
overlayColor overlay color

public RoundingParams setPadding (float padding)

Sets the padding on rounded drawable. Works only with RoundingMethod.BITMAP_ONLY

Parameters
padding the padding in pixels

public RoundingParams 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.
Returns
  • modified instance

public RoundingParams setRoundAsCircle (boolean roundAsCircle)

Sets whether to round as circle.

Parameters
roundAsCircle whether or not to round as circle
Returns
  • modified instance

public RoundingParams setRoundingMethod (RoundingParams.RoundingMethod roundingMethod)

Sets the rounding method.

Parameters
roundingMethod method of rounding
Returns
  • modified instance

public RoundingParams setScaleDownInsideBorders (boolean scaleDownInsideBorders)

Sets whether image should be scaled down inside borders.

Parameters
scaleDownInsideBorders whether image should be scaled down inside borders or borders will be drawn over image
Returns
  • modified instance