Package pl.droidsonroids.gif.transforms
Class CornerRadiusTransform
java.lang.Object
pl.droidsonroids.gif.transforms.CornerRadiusTransform
- All Implemented Interfaces:
Transform
public class CornerRadiusTransform extends Object implements Transform
Transform which adds rounded corners.-
Constructor Summary
Constructors Constructor Description CornerRadiusTransform(float cornerRadius) -
Method Summary
Modifier and Type Method Description RectFgetBounds()Returns current transform bounds - latest received byonBoundsChange(Rect).floatgetCornerRadius()voidonBoundsChange(Rect bounds)Called byGifDrawablewhen its bounds changes byGifDrawable.onBoundsChange(Rect)and when transform is associated usingGifDrawable.setTransform(Transform).voidonDraw(Canvas canvas, Paint paint, Bitmap buffer)Called byGifDrawablewhen itsGifDrawable.draw(Canvas)is called.voidsetCornerRadius(float cornerRadius)Sets the corner radius to be applied when drawing the bitmap.
-
Constructor Details
-
CornerRadiusTransform
public CornerRadiusTransform(@FloatRange(from=0.0) float cornerRadius)- Parameters:
cornerRadius- corner radius, may be 0.
-
-
Method Details
-
setCornerRadius
public void setCornerRadius(@FloatRange(from=0.0) float cornerRadius)Sets the corner radius to be applied when drawing the bitmap.- Parameters:
cornerRadius- corner radius or 0 to remove rounding
-
getCornerRadius
@FloatRange(from=0.0) public float getCornerRadius()- Returns:
- The corner radius applied when drawing this drawable. 0 when drawable is not rounded.
-
getBounds
Returns current transform bounds - latest received byonBoundsChange(Rect).- Returns:
- current transform bounds
-
onBoundsChange
Description copied from interface:TransformCalled byGifDrawablewhen its bounds changes byGifDrawable.onBoundsChange(Rect)and when transform is associated usingGifDrawable.setTransform(Transform). In this latter case the latestGifDrawablebounds (emptyRectif they were not set yet).- Specified by:
onBoundsChangein interfaceTransform- Parameters:
bounds- new bounds
-
onDraw
Description copied from interface:TransformCalled byGifDrawablewhen itsGifDrawable.draw(Canvas)is called.
-