Class RoundedCorners

java.lang.Object
com.iizxi.image.RoundedCorners

public class RoundedCorners extends Object
Class to round corner of an image.
Author:
Christopher Mindus
  • Constructor Details

    • RoundedCorners

      public RoundedCorners()
  • Method Details

    • round

      public static void round(File input, File output, String formatName, int radiusPercent) throws IOException
      Performs a "soft-rounded clip" of the image file. The edges might overflow a little bit in the rounded area due to anti-aliasing.
      Parameters:
      input - The input image file.
      output - The output file where the rounded corners are applies.
      formatName - A String containing the informal name of the format.
      radiusPercent - The radius percent to apply to the image file.
      Throws:
      IOException - For I/O errors.
    • round

      public static BufferedImage round(BufferedImage image, int radiusPercent)
      Performs a "soft-rounded clip" of the image file. The edges might overflow a little bit in the rounded area due to anti-aliasing.
      Parameters:
      image - Input image.
      radiusPercent - The rounded corner value in the maximum size of the image, max(width,height).
      Returns:
      The new rounded anti-aliased image.
      Throws:
      IllegalArgumentException - If radiusPercent is less than zero or larger than 100.