Package net.jalbum.util
Class QR
java.lang.Object
net.jalbum.util.QR
Utility class for QR code generation
- Since:
- 31
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic BufferedImage
toImage
(io.nayuki.qrcodegen.QrCode qr) static BufferedImage
toImage
(io.nayuki.qrcodegen.QrCode qr, int scale, int border) static BufferedImage
toImage
(io.nayuki.qrcodegen.QrCode qr, int scale, int border, int lightColor, int darkColor) Returns a raster image depicting the specified QR Code, with the specified module scale, border modules, and module colors.
-
Constructor Details
-
QR
public QR()
-
-
Method Details
-
toImage
-
toImage
-
toImage
public static BufferedImage toImage(io.nayuki.qrcodegen.QrCode qr, int scale, int border, int lightColor, int darkColor) Returns a raster image depicting the specified QR Code, with the specified module scale, border modules, and module colors.For example, scale=10 and border=4 means to pad the QR Code with 4 light border modules on all four sides, and use 10×10 pixels to represent each module.
- Parameters:
qr
- the QR Code to render (notnull
)scale
- the side length (measured in pixels, must be positive) of each moduleborder
- the number of border modules to add, which must be non-negativelightColor
- the color to use for light modules, in 0xRRGGBB formatdarkColor
- the color to use for dark modules, in 0xRRGGBB format- Returns:
- a new image representing the QR Code, with padding and scaling
- Throws:
NullPointerException
- if the QR Code isnull
IllegalArgumentException
- if the scale or border is out of range, or if {scale, border, size} cause the image dimensions to exceed Integer.MAX_VALUE
-