foxitsoftware / delphizxingqrcode Goto Github PK
View Code? Open in Web Editor NEWDelphi port of QR Code functionality from ZXing, a barcode image processing library.
License: Apache License 2.0
Delphi port of QR Code functionality from ZXing, a barcode image processing library.
License: Apache License 2.0
Currently we're using the Google API to generate QR codes. It offers an error correction level of 'L', 'M', 'Q' and 'H' (according to the specs, see https://en.wikipedia.org/wiki/QR_code#Error_correction).
With this library an TErrorCorrectionLevel class is available, that probably control this option. However, it is not exposed by GenerateQRCode(..), which is used by the TDelphiZXingQRCode class. The value is hard-coded to 1 ("Level.FBits := 1;").
I guess adding a variable parameter should do the trick:
function GenerateQRCode(const Input: WideString; EncodeOptions: Integer; ErrorCorrectionBits: Integer = 1): T2DBooleanArray;
[...]
Level.FBits := ErrorCorrectionBits;
Then, just add a property for error correction bits that defaults to 1 in the TDelphiZXingQRCode class.
From what I have read I'm not sure if (and what) the bits setting corresponds to the predefined error levels. In the original ZXing library some information can be found here:
I hope this helps to get this added to this library.
To avoid copying data more than necessary, it would be useful to have to the 'Elements' array (of type T2DBooleanArray). It must not be a direct (but readonly!) access to the FElements field, but some pointer to the raw 2D data would be nice. With the current implementation this is not possible due to the fact that the definition:
T2DBooleanArray = array of array of Boolean;
don't yield a linear data field. This would not only result in a more compact memory (with less fragmentation and faster operation), but also increase the usability.
TQRCodeEncoding = (qrAuto, qrNumeric, qrAlphanumeric, qrISO88591, qrUTF8NoBOM, qrUTF8BOM);
...
if (EncodeOptions = 4) then
begin
// Add the UTF-8 BOM
UTF8Version := #$EF#$BB#$BF + UTF8Encode(Content);
...
if (EncodeOptions = 5) then
begin
// No BOM
qrUTF8NoBOM = 4
qrUTF8BOM = 5
I would have pulled a fork, but decided it was more better to just post a link here.
DelphiZXingQRCode isn't threaded by itself. I created a threaded component that wraps DelphiZXingQRCode inside a thread. You can control the thread speed via ThreadSleep in milliseconds (default is 40). Drop the number to 0 for the quickest results. Yes, in this version you can control the ErrorCorrectionLevel, thanks to the gosanefr pull request update. All the latest updates from the pull requests are in this version.
The OnGenerate* procedures are synchronized, so you should be safe to use them anywhere in your application.
You can check out the sample.pas for the code, but it's best you create a FMX multi device application and then look at the code to help you build your application. I'll update it later with a visual project, cause my Delphi 11 was buggin out like crazy. Delphi doesn't give you updates unless you pay for them. So the 11.2 updates aren't free because my subscription ran out.
https://github.com/War3Evo/gtDelphi/tree/develop/gtDelphiZXingQRCode
DelphiZXingQRCode/Source/DelphiZXIngQRCode.pas
Line 1051 in 7753eb6
In this line it is need to set > 0;
to >= 0;
(or > -1;
).
Reason:
GetAlphanumericCode give back for '0' the value 0 from ALPHANUMERIC_TABLE (defined Line 66).
If you want with actual sourcecode to encode a string like '00.00.00.00' the QR will only ecnode '...' (three dots without the zeros).
With bugfix it encodes correct '00.00.00.00'.
I found that because I tried to encode the IP 192.168.165.101 and the result string was every time 192.168.165.11 - missing the 0...
Deleted issue, I hadn't see that it was solved under the 'Pull requests' tab.
I'm sorry for that.
I got this error when I built the project for iphone 6+ using delphi 10 seattle.
Built on android and ios simulator no such error.
[DCC Error] E2597 ld: file not found: ZBarSDK\libzbar_64.a
[DCC Fatal Error] F2588 Linker error code: 1 ($00000001)
Provisioning created using xcode 7.3
In the demo one can provoke an access violation in GetModeCharacterCountBits by putting too much data into the edit field. If possible the library should detect such a state and throw a proper exception.
If input data is Alphanumeric code "A0" Encoder returns only "A"
if (Mode = qmAlphanumeric) then....
CanAdd := GetAlphanumericCode(Ord(Content[X])) > 0;
ALPHANUMERIC_TABLE['0'] returns 0....
So I modified it by :
if (Mode = qmAlphanumeric) then....
CanAdd := GetAlphanumericCode(Ord(Content[X])) >= 0;
Due to Google.Code closure, the link :
https://code.google.com/p/zxing/
is now pointing to the same page linked below it:
https://github.com/zxing/zxing
Solution: Remove first link (https://code.google.com/p/zxing)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.