Recent

Author Topic: QRCodeGenLib4Pascal  (Read 6109 times)

Xor-el

  • Sr. Member
  • ****
  • Posts: 404
QRCodeGenLib4Pascal
« on: October 13, 2018, 12:10:25 am »
QRCodeGenLib4Pascal

Generates QR Codes from text strings and byte arrays.

QRCodeGenLib4Pascal is a PurePascal Delphi/FPC compatible library that provides an easy to use interface for generating QR Codes.

Features

Core features:

    Supports encoding all 40 versions (sizes) and all 4 error correction levels, as per the QR Code Model 2 standard
    Output formats: Raw modules/pixels of the QR symbol, SVG XML string/file, ImageObject(bmp, jpg and png).
    Encodes numeric and special-alphanumeric text in less space than general text
    Ability to change the backgound and foreground colors of the generated QRCode.

Manual parameters:

    User can specify minimum and maximum version numbers allowed, then library will automatically choose smallest version in the range that fits the data
    User can specify mask pattern manually, otherwise library will automatically evaluate all 8 masks and select the optimal one
    User can specify absolute error correction level, or allow the library to boost it if it doesn't increase the version number
    User can create a list of data segments manually and add ECI segments

Demos

Check out the QRCodeGenLib.Demo folder.

Link:

https://github.com/Xor-el/QRCodeGenLib4Pascal
« Last Edit: October 13, 2018, 12:14:47 am by Xor-el »

AlexTP

  • Hero Member
  • *****
  • Posts: 2384
    • UVviewsoft
Re: QRCodeGenLib4Pascal
« Reply #1 on: October 13, 2018, 07:44:41 am »

jwdietrich

  • Hero Member
  • *****
  • Posts: 1232
    • formatio reticularis
Re: QRCodeGenLib4Pascal
« Reply #2 on: October 13, 2018, 08:31:42 am »
Does the library depend on an online connection (where a server generates the QR code) or is it self-contained and able to provide offline functionality?
function GetRandomNumber: integer; // xkcd.com
begin
  GetRandomNumber := 4; // chosen by fair dice roll. Guaranteed to be random.
end;

http://www.formatio-reticularis.de

Lazarus 2.2.6 | FPC 3.2.2 | PPC, Intel, ARM | macOS, Windows, Linux

Xor-el

  • Sr. Member
  • ****
  • Posts: 404
Re: QRCodeGenLib4Pascal
« Reply #3 on: October 13, 2018, 08:47:27 am »
Does the library depend on an online connection (where a server generates the QR code) or is it self-contained and able to provide offline functionality?

Nope, it's self contained.
Does not require internet connection.

Xor-el

  • Sr. Member
  • ****
  • Posts: 404
Re: QRCodeGenLib4Pascal
« Reply #4 on: October 13, 2018, 09:35:29 am »
@Alextp, thanks a lot for the wiki page. :)

heejit

  • Full Member
  • ***
  • Posts: 245
Re: QRCodeGenLib4Pascal
« Reply #5 on: October 13, 2018, 10:34:48 am »
If possible please add to ONLINE PACKAGE MANAGER


Xor-el

  • Sr. Member
  • ****
  • Posts: 404
Re: QRCodeGenLib4Pascal
« Reply #6 on: October 16, 2018, 12:05:28 pm »
If possible please add to ONLINE PACKAGE MANAGER

added to Online Package Manager.

heejit

  • Full Member
  • ***
  • Posts: 245
Re: QRCodeGenLib4Pascal
« Reply #7 on: October 16, 2018, 12:38:50 pm »
Thanks

Now all user of Lazarus Can see that library

Thaddy

  • Hero Member
  • *****
  • Posts: 14197
  • Probably until I exterminate Putin.
Re: QRCodeGenLib4Pascal
« Reply #8 on: October 16, 2018, 02:27:33 pm »
@Xor-el
Very very nice code -again - indeed! compliments.
Specialize a type, not a var.

Xor-el

  • Sr. Member
  • ****
  • Posts: 404
Re: QRCodeGenLib4Pascal
« Reply #9 on: December 27, 2018, 08:02:36 am »
@Xor-el
Very very nice code -again - indeed! compliments.

thanks for the nice compliments Thaddy.  :)

Xor-el

  • Sr. Member
  • ****
  • Posts: 404
Re: QRCodeGenLib4Pascal
« Reply #10 on: December 27, 2018, 08:08:44 am »
just released v1.4 of this library.

* compatibility fix for raspberry pi in FPC

Now QRCodeGenLib4Pascal works beautifully in Raspberry PI via FPC.  :)

avra

  • Hero Member
  • *****
  • Posts: 2514
    • Additional info
Re: QRCodeGenLib4Pascal
« Reply #11 on: December 27, 2018, 09:25:54 am »
Can we embed a custom logo in generated QR code with this lib?
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

Xor-el

  • Sr. Member
  • ****
  • Posts: 404
Re: QRCodeGenLib4Pascal
« Reply #12 on: December 27, 2018, 10:35:40 am »
Can we embed a custom logo in generated QR code with this lib?

While I did start working on something like this sometime ago, I stopped because I had to consider various edge cases and prevent the user from shooting him/her self in the foot.
Some of those cases are
1. The logo to be embedded should be a perfect square to able to calculate the offsets from the centre of the parent bitmap to the edges of the parent bitmap.

2. If am to resize the logo to meet the requirements, then I would need a way to resize images with transparent backgrounds without the issue of a black background after resizing.

 but not to lose hope, you can draw your logo on the output bitmap after it is created, just remember to set the error correction level of the qrcode to at least medium or high.

 

TinyPortal © 2005-2018