Class ImageOverlay

  • All Implemented Interfaces:
    Decorator<java.awt.image.BufferedImage>

    public class ImageOverlay
    extends java.lang.Object
    implements Decorator<java.awt.image.BufferedImage>
    Adds a image overlay to a qrcode
    • Field Detail

      • DEFAULT_OVERLAY_TRANSPARENCY

        public static final java.lang.Float DEFAULT_OVERLAY_TRANSPARENCY
      • DEFAULT_OVERLAY_TO_QRCODE_RATIO

        public static final java.lang.Float DEFAULT_OVERLAY_TO_QRCODE_RATIO
    • Method Detail

      • addImageOverlay

        public static Decorator<java.awt.image.BufferedImage> addImageOverlay​(java.awt.image.BufferedImage overlay,
                                                                              java.lang.Float overlayTransparency,
                                                                              java.lang.Float overlayToQRCodeRatio)
        Parameters:
        overlay - - the image to be over rendered on top of the qrcode
        overlayTransparency - - the overlays transparency from 0..1 where one is no transparency. Default is set to 1
        overlayToQRCodeRatio - - Specifies the ratio between the overlay image and the QRCode in percentage like 0.20 = 20%. Overlays should as a guide not take up more 25% of the QRCode or else the readability of the code could be compromised Default is set to 25% It's safe to add a overlay that takes up more than 25%, if the transparency is less than .20
        Throws:
        java.lang.IllegalArgumentException - - if the overlay is null
      • decorate

        public java.awt.image.BufferedImage decorate​(java.awt.image.BufferedImage qrcode)
        Specified by:
        decorate in interface Decorator<java.awt.image.BufferedImage>