Update README.md with how to use quirc_flip()

This commit is contained in:
Claudio Felber 2020-09-22 12:22:06 +02:00
parent 2fd06df8de
commit 8e8a638a5f
2 changed files with 18 additions and 0 deletions

1
.gitignore vendored
View file

@ -9,3 +9,4 @@ libquirc.so*
.*.swp .*.swp
*~ *~
.DS_Store .DS_Store
.idea

View file

@ -174,6 +174,23 @@ for (i = 0; i < num_codes; i++) {
`quirc_code` and `quirc_data` are flat structures which don't need to be `quirc_code` and `quirc_data` are flat structures which don't need to be
initialized or freed after use. initialized or freed after use.
In case you also need to support horizontally flipped QR-codes (mirrored
images according to ISO 18004:2015, pages 6 and 62), you can make a second
decode attempt with the flipped image data whenever you get an ECC failure:
```C
err = quirc_decode(&code, &data);
if (err == QUIRC_ERROR_DATA_ECC) {
quirc_flip(&code);
err = quirc_decode(&code, &data);
}
if (err)
printf("DECODE FAILED: %s\n", quirc_strerror(err));
else
printf("Data: %s\n", data.payload);
```
Copyright Copyright
--------- ---------
Copyright (C) 2010-2012 Daniel Beer <<dlbeer@gmail.com>> Copyright (C) 2010-2012 Daniel Beer <<dlbeer@gmail.com>>