Class FinderElement


  • public class FinderElement
    extends Object
    // Finder Patters are the Square blocks that exists on three corner of QR code (Top-Left, Top-Right and Bottom-Left). QR scanner use them to detect the oriantation of the QR Code. The Finder Patterns has a Size of 7 modules irrespective of the QR version. they are buit as three components; Outer block : 7 modules Innter block : 5 modules Finder ball : 3 modules The Finder Pattern need to be rendered in ratio of 1:1:3:1:1 (each module column/row), so that scnner can detect them.
    • Field Detail

      • scale

        public float scale
        One module may need more then 1 pixel depending on the qr size. scale determine the no's of pixels in each module.
      • FINDER_SIZE

        public static final int FINDER_SIZE
        QR Code Finder Pattern Size is fixed as 7 module irrespective of verion of the QR.
        See Also:
        Constant Field Values
      • finderWidth

        public int finderWidth
      • outerFrameX

        public int outerFrameX
      • outerFrameY

        public int outerFrameY
      • innerFrameX

        public int innerFrameX
      • innerFrameY

        public int innerFrameY
      • innerFrameWidth

        public int innerFrameWidth
      • ballX

        public int ballX
      • ballY

        public int ballY
      • ballWidth

        public int ballWidth
    • Constructor Detail

      • FinderElement

        public FinderElement​(int _version,
                             int _size,
                             int location)
        Parameters:
        _version - version of the QR code being used
        _size - Size of the QR Code
        location - Location of the Finder Pattern (i.e. 0 = Top-Left, 1 = Top-Right, 2 = Bottom-Left)
    • Method Detail

      • toRoundedCornerSquare

        public BufferedImage toRoundedCornerSquare()
      • toOppRoundCornerSquare

        public BufferedImage toOppRoundCornerSquare()
      • contains

        public boolean contains​(int x,
                                int y)
        Rendering the QR Code data must not overlap the Functional Patterns of the QR Code. This method helps to determine for if provided location (x,y) is part of the FinderElement or not.
        Parameters:
        x - position 'x' of the QR data module. (from the encoded byte[][] data)
        y - position 'y' of the QR data module. (from the encoded byte[][] data)
        Returns:
        true if the provided (x,y) are part of the FinderElement, else return False.
      • setStyle

        public void setStyle​(StyleConfig style)
      • test

        public static void test​(String[] args)