Class QR

java.lang.Object
net.jalbum.util.QR

public class QR extends Object
Utility class for QR code generation
Since:
31
  • Constructor Summary

    Constructors
    Constructor
    Description
    QR()
     
  • Method Summary

    Modifier and Type
    Method
    Description
    toImage(io.nayuki.qrcodegen.QrCode qr)
     
    toImage(io.nayuki.qrcodegen.QrCode qr, int scale, int border)
     
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • QR

      public QR()
  • Method Details

    • toImage

      public static BufferedImage toImage(io.nayuki.qrcodegen.QrCode qr)
    • toImage

      public static BufferedImage toImage(io.nayuki.qrcodegen.QrCode qr, int scale, int border)
    • 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 (not null)
      scale - the side length (measured in pixels, must be positive) of each module
      border - the number of border modules to add, which must be non-negative
      lightColor - the color to use for light modules, in 0xRRGGBB format
      darkColor - 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 is null
      IllegalArgumentException - if the scale or border is out of range, or if {scale, border, size} cause the image dimensions to exceed Integer.MAX_VALUE