summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog2
-rw-r--r--qrencode.h24
2 files changed, 26 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 0553a84520..ba479e32dd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,8 @@
[develop]
* qrencode.c:
- Removed unused code.
+ * qrencode.h:
+ - Added a sample code snippet to the document.
2020.09.28 Kentaro Fukuchi <kentaro@fukuchi.org>
[hotfix]
diff --git a/qrencode.h b/qrencode.h
index 1c66f336c4..3460866321 100644
--- a/qrencode.h
+++ b/qrencode.h
@@ -60,6 +60,27 @@
* In such cases, the input data would be too large to be encoded in a
* symbol of the specified version.
*
+ * The following code snippet demonstrates how to use the obtained object:
+ *
+ * \code
+ * QRcode *qrcode;
+ *
+ * qrcode = QRcode_encodeString("TEST", 0, QR_ECLEVEL_M, QR_MODE_8, 1);
+ * if(qrcode == NULL) abort();
+ *
+ * for(int y = 0; y < qrcode->width; y++) {
+ * for(int x = 0; x < qrcode->width; x++) {
+ * if(qrcode->data[y * qrcode->width + x] & 1) {
+ * draw_black_dot(x, y);
+ * } else {
+ * draw_white_dot(x, y);
+ * }
+ * }
+ * }
+ *
+ * QRcode_free(qrcode);
+ * \endcode
+ *
* \section structured Structured append
* Libqrencode can generate "Structured-appended" symbols that enable to split
* 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);
|`------- finder pattern and separator
`-------- non-data modules (format, timing, etc.)
@endverbatim
+ *
+ * See \ref result section for a sample code snippet that shows how to use the
+ * obtained QRcode object.
*/
typedef struct {
int version; ///< version of the symbol