Skip to content

Commit 0db94b7

Browse files
committed
Added a sample code snippet to the document.
1 parent 06bfbfd commit 0db94b7

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

ChangeLog

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
[develop]
33
* qrencode.c:
44
- Removed unused code.
5+
* qrencode.h:
6+
- Added a sample code snippet to the document.
57

68
2020.09.28 Kentaro Fukuchi <[email protected]>
79
[hotfix]

qrencode.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,27 @@
6060
* In such cases, the input data would be too large to be encoded in a
6161
* symbol of the specified version.
6262
*
63+
* The following code snippet demonstrates how to use the obtained object:
64+
*
65+
* \code
66+
* QRcode *qrcode;
67+
*
68+
* qrcode = QRcode_encodeString("TEST", 0, QR_ECLEVEL_M, QR_MODE_8, 1);
69+
* if(qrcode == NULL) abort();
70+
*
71+
* for(int y = 0; y < qrcode->width; y++) {
72+
* for(int x = 0; x < qrcode->width; x++) {
73+
* if(qrcode->data[y * qrcode->width + x] & 1) {
74+
* draw_black_dot(x, y);
75+
* } else {
76+
* draw_white_dot(x, y);
77+
* }
78+
* }
79+
* }
80+
*
81+
* QRcode_free(qrcode);
82+
* \endcode
83+
*
6384
* \section structured Structured append
6485
* Libqrencode can generate "Structured-appended" symbols that enable to split
6586
* a large data set into multiple QR codes. A QR code reader concatenates
@@ -371,6 +392,9 @@ extern int QRinput_setFNC1Second(QRinput *input, unsigned char appid);
371392
|`------- finder pattern and separator
372393
`-------- non-data modules (format, timing, etc.)
373394
@endverbatim
395+
*
396+
* See \ref result section for a sample code snippet that shows how to use the
397+
* obtained QRcode object.
374398
*/
375399
typedef struct {
376400
int version; ///< version of the symbol

0 commit comments

Comments
 (0)