This section is dedicated to section 8.7 in the specification.
We need to understand multiple key points in this part (7.3). A default QRCode is composed of many region. All default regions are explained below:
Alignment Pattern (V ≥ 2)
Version Information (V ≥ 7)
Combined QRCode regions (V=7)
See the default QRCode for version 5, we will use it to continue our journey. But, how do we place our structured buffer ? Let me show you an example:
This is the default QRCode for V=5
This is the occupied regions for V=5
This is the "path" we will follow when placing our data
The algorithm is not overly complex, so let's dive into it 🚀
We should start by: - Making a grid of width and height V * 4 + 17 (with V the version 1-40) - Making a function that returns if the module is "occupied" or not (see image above)
Now let's place our data ! (Dont forget the "Z" shape) - Start from bottom right corner. - Check if current module is occupied (using previous function), if not, place data. - Do the same for left module. - Then go up and repeat. - When reaching top or bottom, inverted the direction and repeat on the next two columns. You should always skip the column n°6 (see image above).
Grabbing the data buffer from previous computations: