Package de.presti.ree6.utils.data
Class ImageCreationUtility
java.lang.Object
de.presti.ree6.utils.data.ImageCreationUtility
A utility to create Images.
-
Method Summary
Modifier and TypeMethodDescriptionstatic BufferedImage
convertToCircleShape
(URL url) Generated a Circle Shaped Version of the given Image.static byte[]
createHornyJailImage
(net.dv8tion.jda.api.entities.User user) Generate a HornyJail Image with Java native Graphics2D.static byte[]
createJoinImage
(net.dv8tion.jda.api.entities.User user, String messageImage, String messageText) This method is used to create a Join Image.static byte[]
createRankImage
(de.presti.ree6.sql.entities.level.UserLevel userLevel) Generate a Rank Image with Java native Graphics2D.static BufferedImage
resize
(BufferedImage inputImage, int scaledWidth, int scaledHeight) Resizes an image to an absolute width and height (the image may not be proportional)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.
-
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
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
Resizes an image to an absolute width and height (the image may not be proportional)- Parameters:
inputImage
- The original imagescaledWidth
- absolute width in pixelsscaledHeight
- absolute height in pixels- Returns:
- The new resized image
-
retrieveFont
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.
-