MCPcopy Create free account
hub / github.com/TactilityProject/Tactility / drawFinderPattern

Function drawFinderPattern

Libraries/QRCode/src/qrcode.c:284–296  ·  view source on GitHub ↗

Draws a 9*9 finder pattern including the border separator, with the center module at (x, y).

Source from the content-addressed store, hash-verified

282
283// Draws a 9*9 finder pattern including the border separator, with the center module at (x, y).
284static void drawFinderPattern(BitBucket *modules, BitBucket *isFunction, uint8_t x, uint8_t y) {
285 uint8_t size = modules->bitOffsetOrWidth;
286
287 for (int8_t i = -4; i <= 4; i++) {
288 for (int8_t j = -4; j <= 4; j++) {
289 uint8_t dist = max(abs(i), abs(j)); // Chebyshev/infinity norm
290 int16_t xx = x + j, yy = y + i;
291 if (0 <= xx && xx < size && 0 <= yy && yy < size) {
292 setFunctionModule(modules, isFunction, xx, yy, dist != 2 && dist != 4);
293 }
294 }
295 }
296}
297
298// Draws a 5*5 alignment pattern, with the center module at (x, y).
299static void drawAlignmentPattern(BitBucket *modules, BitBucket *isFunction, uint8_t x, uint8_t y) {

Callers 2

drawFunctionPatternsFunction · 0.85
drawFunctionPatternsMethod · 0.85

Calls 2

maxFunction · 0.85
setFunctionModuleFunction · 0.85

Tested by 1

drawFunctionPatternsMethod · 0.68