Slightly tweaked demo programs for clarity.
This commit is contained in:
parent
0cded0ba36
commit
55f410cc66
|
@ -187,7 +187,7 @@ static void doMaskDemo() {
|
||||||
|
|
||||||
/*---- Utilities ----*/
|
/*---- Utilities ----*/
|
||||||
|
|
||||||
// Prints the given QR Code to the console.
|
// Prints the given QrCode object to the console.
|
||||||
static void printQr(const QrCode &qr) {
|
static void printQr(const QrCode &qr) {
|
||||||
int border = 4;
|
int border = 4;
|
||||||
for (int y = -border; y < qr.getSize() + border; y++) {
|
for (int y = -border; y < qr.getSize() + border; y++) {
|
||||||
|
|
|
@ -62,7 +62,8 @@ public final class QrCodeGeneratorDemo {
|
||||||
ImageIO.write(img, "png", imgFile); // Write image to file
|
ImageIO.write(img, "png", imgFile); // Write image to file
|
||||||
|
|
||||||
String svg = qr.toSvgString(4); // Convert to SVG XML code
|
String svg = qr.toSvgString(4); // Convert to SVG XML code
|
||||||
Files.write(new File("hello-world-QR.svg").toPath(),
|
File svgFile = new File("hello-world-QR.svg"); // File path for output
|
||||||
|
Files.write(svgFile.toPath(), // Write image to file
|
||||||
svg.getBytes(StandardCharsets.UTF_8));
|
svg.getBytes(StandardCharsets.UTF_8));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue