|
1 | | -# QRCodeGenLib4Pascal [](https://github.com/Xor-el/QRCodeGenLib4Pascal/blob/master/LICENSE) |
2 | | -QRCodeGenLib4Pascal is a Delphi/FPC Port of [Fast-QR-Code-generator](https://www.nayuki.io/page/fast-qr-code-generator-library) written by [Nayuki](https://www.nayuki.io/). It provides an easy to use interface for generating QR Codes. |
| 1 | +# QRCodeGenLib4Pascal |
3 | 2 |
|
4 | | -**Build Status** |
5 | 3 | [](https://github.com/Xor-el/QRCodeGenLib4Pascal/actions/workflows/make.yml) |
| 4 | +[](https://github.com/Xor-el/QRCodeGenLib4Pascal/blob/master/LICENSE) |
| 5 | +[](https://www.embarcadero.com/products/delphi) |
| 6 | +[](https://www.freepascal.org/) |
6 | 7 |
|
7 | | -Features |
8 | | --------- |
| 8 | +**QRCodeGenLib4Pascal** is a Delphi/FreePascal port of [Fast-QR-Code-generator](https://www.nayuki.io/page/fast-qr-code-generator-library) by [Nayuki](https://www.nayuki.io/), providing an easy-to-use interface for generating QR Codes, released under the permissive [MIT License](LICENSE). |
9 | 9 |
|
10 | | -Core features: |
| 10 | +## Table of Contents |
11 | 11 |
|
12 | | -* Supports encoding all 40 versions (sizes) and all 4 error correction levels, as per the QR Code Model 2 standard |
13 | | -* Output formats: Raw modules/pixels of the QR symbol, SVG XML string/file, `ImageObject`(`bmp` (`jpg` and `png`) for `VCL` and `LCL` only). |
14 | | -* Encodes numeric and special-alphanumeric text in less space than general text |
15 | | -* Ability to change the backgound and foreground colors of the generated QRCode. |
16 | | -* Open source code under the permissive MIT License |
| 12 | +- [Features](#features) |
| 13 | +- [Getting Started](#getting-started) |
| 14 | +- [Quick Examples](#quick-examples) |
| 15 | +- [Running Demos](#running-demos) |
| 16 | +- [Contributing](#contributing) |
| 17 | +- [Tip Jar](#tip-jar) |
| 18 | +- [License](#license) |
17 | 19 |
|
18 | | -Manual parameters: |
| 20 | +## Features |
19 | 21 |
|
20 | | -* User can specify minimum and maximum version numbers allowed, then library will automatically choose smallest version in the range that fits the data |
21 | | -* User can specify mask pattern manually, otherwise library will automatically evaluate all 8 masks and select the optimal one |
22 | | -* User can specify absolute error correction level, or allow the library to boost it if it doesn't increase the version number |
23 | | -* User can create a list of data segments manually and add ECI segments |
| 22 | +- **All QR versions and error correction levels** -- supports encoding all 40 versions (sizes) and all 4 error correction levels, as per the QR Code Model 2 standard |
| 23 | +- **Multiple output formats** -- raw modules/pixels, SVG XML string/file, `ImageObject` (`bmp`, `jpg`, `png`) for VCL and LCL |
| 24 | +- **Efficient encoding** -- numeric and special-alphanumeric text encoded in less space than general text |
| 25 | +- **Customizable colors** -- configurable background and foreground colors for generated QR codes |
| 26 | +- **Fine-grained control** -- specify version range, mask pattern, error correction level, or let the library choose optimal values automatically |
| 27 | +- **ECI segments** -- manually create data segment lists and add ECI segments |
| 28 | +- **Cross-framework** -- FCL, VCL (Delphi), LCL (Lazarus), and experimental FMX support |
24 | 29 |
|
25 | | -**Supported Compilers** |
26 | | - |
27 | | - FreePascal 3.0.0 and Above. |
28 | | - |
29 | | - Delphi XE3 and Above. |
30 | | - |
31 | | -**Supported Visual Frameworks** |
32 | | - |
33 | | - LCL Framework (Lazarus) |
34 | | - |
35 | | - VCL Framework (Delphi) |
36 | | - |
37 | | - FMX (Support is currently experimental, to use, enable the define "{.$DEFINE Framework_FMX}" in "QRCodeGenLib.inc"). |
| 30 | +## Getting Started |
38 | 31 |
|
39 | | -**Installing the Library.** |
| 32 | +### Prerequisites |
40 | 33 |
|
41 | | -**Method One:** |
| 34 | +| Compiler | Minimum Version | |
| 35 | +|---|---| |
| 36 | +| Delphi | XE3 or later | |
| 37 | +| FreePascal | 3.0.0 or later | |
42 | 38 |
|
43 | | - Use the Provided Packages in the "Packages" Folder. |
| 39 | +### Supported Frameworks |
44 | 40 |
|
45 | | -**Method Two:** |
| 41 | +| Framework | Notes | |
| 42 | +|---|---| |
| 43 | +| FCL | Default mode | |
| 44 | +| VCL | Delphi | |
| 45 | +| LCL | Lazarus | |
| 46 | +| FMX | Experimental -- enable `{.$DEFINE Framework_FMX}` in `QRCodeGenLib.inc` | |
46 | 47 |
|
47 | | - Add the Library Path and Sub Path to your Project Search Path. |
| 48 | +### Installation |
48 | 49 |
|
49 | | -**Demos** |
| 50 | +**Method 1: Using Packages** |
50 | 51 |
|
51 | | - Check out the `QRCodeGenLib.Demo` folder. |
| 52 | +Use the provided packages in the `Packages` folder. |
52 | 53 |
|
53 | | -**License** |
| 54 | +**Method 2: Search Path** |
54 | 55 |
|
55 | | -This "Software" is Licensed Under **`MIT License (MIT)`** . |
| 56 | +Add the library path and its subdirectories to your project's search path. |
56 | 57 |
|
57 | | -#### Tip Jar |
58 | | -* :dollar: **Bitcoin**: `1MhFfW7tDuEHQSgie65uJcAfJgCNchGeKf` |
59 | | -* :euro: **Ethereum**: `0x6c1DC21aeC49A822A4f1E3bf07c623C2C1978a98` |
60 | | -* :pound: **Pascalcoin**: `345367-40` |
| 58 | +## Quick Examples |
| 59 | + |
| 60 | +### Generate a Simple QR Code (SVG) |
| 61 | + |
| 62 | +```pascal |
| 63 | +uses |
| 64 | + SysUtils, QlpQRCodeGenLibTypes, QlpQRCode, QlpIQRCode; |
| 65 | +
|
| 66 | +var |
| 67 | + LQR: IQRCode; |
| 68 | + LSVG: String; |
| 69 | +begin |
| 70 | + LQR := TQRCode.EncodeText('Hello QRCodeGenLib4Pascal', |
| 71 | + TQrCode.TEcc.eccLow, TEncoding.UTF8); |
| 72 | + LSVG := LQR.ToSVGString(4); |
| 73 | +
|
| 74 | + WriteLn(LSVG); |
| 75 | +end; |
| 76 | +``` |
| 77 | + |
| 78 | +### Generate a QR Code with Custom Colors (BMP -- VCL/LCL) |
| 79 | + |
| 80 | +```pascal |
| 81 | +uses |
| 82 | + SysUtils, Graphics, QlpQRCodeGenLibTypes, QlpQRCode, QlpIQrCode; |
| 83 | +
|
| 84 | +var |
| 85 | + LQR: IQRCode; |
| 86 | + LBmp: TQRCodeGenLibBitmap; |
| 87 | +begin |
| 88 | + LQR := TQRCode.EncodeText('Custom colors!', |
| 89 | + TQRCode.TEcc.eccMedium, TEncoding.UTF8); |
| 90 | +
|
| 91 | + LBmp := LQR.ToBitmapImage(10, 4); |
| 92 | + try |
| 93 | + LBmp.SaveToFile('qrcode.bmp'); |
| 94 | + finally |
| 95 | + LBmp.Free; |
| 96 | + end; |
| 97 | +end; |
| 98 | +``` |
| 99 | + |
| 100 | +### Advanced: Manual Segment with Version Range |
| 101 | + |
| 102 | +```pascal |
| 103 | +uses |
| 104 | + SysUtils, QlpQRCodeGenLibTypes, QlpQRCode, QlpIQRCode, QlpQRSegment, QlpIQRSegment; |
| 105 | +
|
| 106 | +var |
| 107 | + LSegments: TArray<IQrSegment>; |
| 108 | + LQR: IQRCode; |
| 109 | +begin |
| 110 | + LSegments := TQRSegment.MakeSegments('0123456789', TEncoding.UTF8); |
| 111 | +
|
| 112 | + LQR := TQRCode.EncodeSegments(LSegments, |
| 113 | + TQRCode.TEcc.eccHigh, |
| 114 | + 5, // minimum version |
| 115 | + 10, // maximum version |
| 116 | + -1, // auto mask |
| 117 | + True // boost ECC |
| 118 | + ); |
| 119 | +
|
| 120 | + WriteLn(LQR.ToSVGString(4)); |
| 121 | +end; |
| 122 | +``` |
| 123 | + |
| 124 | +## Running Demos |
| 125 | + |
| 126 | +Check out the `QRCodeGenLib.Demo` folder for complete working examples. |
| 127 | + |
| 128 | +## Contributing |
| 129 | + |
| 130 | +Contributions are welcome. Please open an [issue](https://github.com/Xor-el/QRCodeGenLib4Pascal/issues) for bug reports or feature requests, and submit pull requests. |
| 131 | + |
| 132 | +## Tip Jar |
| 133 | + |
| 134 | +If you find this library useful and would like to support its continued development, tips are greatly appreciated! 🙏 |
| 135 | + |
| 136 | +| Cryptocurrency | Wallet Address | |
| 137 | +|---|---| |
| 138 | +| <img src="https://raw.githubusercontent.com/spothq/cryptocurrency-icons/master/32/icon/btc.png" width="20" alt="Bitcoin" /> **Bitcoin (BTC)** | `bc1quqhe342vw4ml909g334w9ygade64szqupqulmu` | |
| 139 | +| <img src="https://raw.githubusercontent.com/spothq/cryptocurrency-icons/master/32/icon/eth.png" width="20" alt="Ethereum" /> **Ethereum (ETH)** | `0x53651185b7467c27facab542da5868bfebe2bb69` | |
| 140 | +| <img src="https://raw.githubusercontent.com/spothq/cryptocurrency-icons/master/32/icon/sol.png" width="20" alt="Solana" /> **Solana (SOL)** | `BPZHjY1eYCdQjLecumvrTJRi5TXj3Yz1vAWcmyEB9Miu` | |
| 141 | + |
| 142 | +## License |
| 143 | + |
| 144 | +QRCodeGenLib4Pascal is released under the [MIT License](LICENSE). |
0 commit comments