qrencoder icon indicating copy to clipboard operation
qrencoder copied to clipboard

API method to get the used mask pattern

Open gioele opened this issue 14 years ago • 2 comments

Hello,

could you add an API method to get some information about the mask pattern that has been used to generate the QR code?

gioele avatar Aug 18 '11 17:08 gioele

The library does expose the QREncoder::QRCode#data method, which may do what you need. It returns an array of integers, each of whose bit is significant. From there, you can perform bitwise operations to get what you need. From the libqrencoder documentation:

  MSB 76543210 LSB
      |||||||`- 1=black/0=white
      ||||||`-- data and ecc code area
      |||||`--- format information
      ||||`---- version information
      |||`----- timing pattern
      ||`------ alignment pattern
      |`------- finder pattern and separator
      `-------- non-data modules (format, timing, etc.)

jgdavey avatar Aug 19 '11 17:08 jgdavey

I know, but I was wondering whether this extraction could be performed directly by the qrencoder gem instead of application code. :)

gioele avatar Aug 20 '11 14:08 gioele