Slightly tweaked demo programs for clarity.

This commit is contained in:
Project Nayuki 2018-10-04 19:09:26 +00:00
parent 0cded0ba36
commit 55f410cc66
2 changed files with 3 additions and 2 deletions

View File

@ -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++) {

View File

@ -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));
} }