Class ImageCreationUtility

java.lang.Object
de.presti.ree6.utils.data.ImageCreationUtility

public class ImageCreationUtility extends Object
A utility to create Images.
  • Method Details

    • createRankImage

      public static byte[] createRankImage(de.presti.ree6.sql.entities.level.UserLevel userLevel) throws IOException
      Generate a Rank Image with Java native Graphics2D.
      Parameters:
      userLevel - the User Level Object.
      Returns:
      the bytes of the Image.
      Throws:
      IOException - when URL-Format is Invalid or the URL is not a valid Image.
    • createJoinImage

      public static byte[] createJoinImage(net.dv8tion.jda.api.entities.User user, String messageImage, String messageText) throws IOException
      This method is used to create a Join Image.
      Parameters:
      user - The User who joined the Guild.
      messageImage - The Image of the Message.
      messageText - The Text of the Message.
      Returns:
      The Image as an Array of Bytes.
      Throws:
      IOException - If an error occurs while creating the Image.
    • createHornyJailImage

      public static byte[] createHornyJailImage(net.dv8tion.jda.api.entities.User user) throws IOException
      Generate a HornyJail Image with Java native Graphics2D.
      Parameters:
      user - the User Object.
      Returns:
      the bytes of the Image.
      Throws:
      IOException - when URL-Format is Invalid or the URL is not a valid Image.
    • convertToCircleShape

      public static BufferedImage convertToCircleShape(URL url) throws IOException
      Generated a Circle Shaped Version of the given Image.
      Parameters:
      url - the URL to the Image.
      Returns:
      the edited BufferedImage.
      Throws:
      IOException - if the link is not a valid Image.
    • resize

      public static BufferedImage resize(BufferedImage inputImage, int scaledWidth, int scaledHeight)
      Resizes an image to an absolute width and height (the image may not be proportional)
      Parameters:
      inputImage - The original image
      scaledWidth - absolute width in pixels
      scaledHeight - absolute height in pixels
      Returns:
      The new resized image
    • retrieveFont

      public static Font retrieveFont(int size, String text)
      Retrieves a Font with the given size and fallbacks to Arial if it can't display the given text.
      Parameters:
      size - the size of the Font.
      text - the text to display.
      Returns:
      the Font.