|
|
@ -272,7 +272,7 @@ void QrCode::drawVersion() {
|
|
|
|
void QrCode::drawFinderPattern(int x, int y) {
|
|
|
|
void QrCode::drawFinderPattern(int x, int y) {
|
|
|
|
for (int dy = -4; dy <= 4; dy++) {
|
|
|
|
for (int dy = -4; dy <= 4; dy++) {
|
|
|
|
for (int dx = -4; dx <= 4; dx++) {
|
|
|
|
for (int dx = -4; dx <= 4; dx++) {
|
|
|
|
int dist = std::max(std::abs(dy), std::abs(dx)); // Chebyshev/infinity norm
|
|
|
|
int dist = std::max(std::abs(dx), std::abs(dy)); // Chebyshev/infinity norm
|
|
|
|
int xx = x + dx, yy = y + dy;
|
|
|
|
int xx = x + dx, yy = y + dy;
|
|
|
|
if (0 <= xx && xx < size && 0 <= yy && yy < size)
|
|
|
|
if (0 <= xx && xx < size && 0 <= yy && yy < size)
|
|
|
|
setFunctionModule(xx, yy, dist != 2 && dist != 4);
|
|
|
|
setFunctionModule(xx, yy, dist != 2 && dist != 4);
|
|
|
@ -284,7 +284,7 @@ void QrCode::drawFinderPattern(int x, int y) {
|
|
|
|
void QrCode::drawAlignmentPattern(int x, int y) {
|
|
|
|
void QrCode::drawAlignmentPattern(int x, int y) {
|
|
|
|
for (int dy = -2; dy <= 2; dy++) {
|
|
|
|
for (int dy = -2; dy <= 2; dy++) {
|
|
|
|
for (int dx = -2; dx <= 2; dx++)
|
|
|
|
for (int dx = -2; dx <= 2; dx++)
|
|
|
|
setFunctionModule(x + dx, y + dy, std::max(std::abs(dy), std::abs(dx)) != 1);
|
|
|
|
setFunctionModule(x + dx, y + dy, std::max(std::abs(dx), std::abs(dy)) != 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|