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 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

      @NonNull public RectF getBounds()
      Returns current transform bounds - latest received by onBoundsChange(Rect).
      Returns:
      current transform bounds
    • onBoundsChange

      public void onBoundsChange​(Rect bounds)
      Description copied from interface: Transform
      Called by GifDrawable when its bounds changes by GifDrawable.onBoundsChange(Rect) and when transform is associated using GifDrawable.setTransform(Transform). In this latter case the latest GifDrawable bounds (empty Rect if they were not set yet).
      Specified by:
      onBoundsChange in interface Transform
      Parameters:
      bounds - new bounds
    • onDraw

      public void onDraw​(Canvas canvas, Paint paint, Bitmap buffer)
      Description copied from interface: Transform
      Called by GifDrawable when its GifDrawable.draw(Canvas) is called.
      Specified by:
      onDraw in interface Transform
      Parameters:
      canvas - The canvas supplied by the system to draw on.
      paint - The paint to use for custom drawing.
      buffer - The current Bitmap for the GIF.