Package app.YUP.utils
Class QRCodeService
java.lang.Object
app.YUP.utils.QRCodeService
A utility class for generating QR codes.
-
Method Summary
Modifier and TypeMethodDescriptionstatic BufferedImagegenerateQrcode(String barcodeText) Generates a QR code image from the provided text.static BufferedImagetoImage(io.nayuki.qrcodegen.QrCode qr, int scale, int border, int lightColor, int darkColor) Converts a QrCode object to a BufferedImage.
-
Method Details
-
generateQrcode
Generates a QR code image from the provided text.- Parameters:
barcodeText- the text to be encoded in the QR code- Returns:
- a BufferedImage representing the generated QR code
-
toImage
public static BufferedImage toImage(io.nayuki.qrcodegen.QrCode qr, int scale, int border, int lightColor, int darkColor) Converts a QrCode object to a BufferedImage.- Parameters:
qr- the QrCode object to be convertedscale- the scale factor for the QR code imageborder- the border size for the QR code imagelightColor- the color to be used for the light modules of the QR codedarkColor- the color to be used for the dark modules of the QR code- Returns:
- a BufferedImage representing the QR code
- Throws:
IllegalArgumentException- if scale is less than or equal to 0, or if border is less than 0, or if the calculated size exceeds Integer.MAX_VALUE
-