Coder Social home page Coder Social logo

delphizxingqrcode's Introduction

DelphiZXingQRCode

DelphiZXingQRCode is a Delphi port of the QR Code functionality from ZXing, an open source barcode image processing library. The code was ported to Delphi by Senior Debenu Developer, Kevin Newman. The port retains the original Apache License (v2.0).

DelphiZXingQRCode Project

http://www.debenu.com/open-source/delphizxingqrcode-open-source-delphi-qr-code-generator/

ZXing

https://github.com/zxing/zxing

Getting Started

A sample Delphi project is provided in the TestApp folder to demonstrate how to use DelphiZXingQRCode. Simply add the DelphiZXIngQRCode.pas to the DelphiZXingQRCodeTestApp Delphi project and compile.

[Provided by Debenu]

delphizxingqrcode's People

Contributors

rowanhanna avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

delphizxingqrcode's Issues

Encoder error with AlphaCode

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;

Error in Bom\NoBom option

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

Here's my FMX Threaded Component version of DelphiZXingQRCode with all updates from the pull requests!

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

Bug at encode alphanumeric strings with 0 (zero)

CanAdd := GetAlphanumericCode(Ord(Content[X])) > 0;

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...

Provide access to elements

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.

Access violation

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.

Error compiling on iphone 6+ using delphi 10 seattle

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

Please expose the error tolerance for QR codes

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:

http://code.google.com/p/zxing/source/browse/trunk/core/src/main/java/com/google/zxing/qrcode/decoder/ErrorCorrectionLevel.java

I hope this helps to get this added to this library.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.