[Module] QRCode (all OS)

Applications, Games, Tools, User libs and useful stuff coded in PureBasic
User avatar
Thorsten1867
Addict
Addict
Posts: 1372
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

[Module] QRCode (all OS)

Post by Thorsten1867 »

QRCode - Module (all OS / 64Bit / DPI)

( Based on the code of infratec )
  • QRCode - Gadget
  • Create a QR-Code (Image)
  • Decode QR-Code (image)

Code: Select all

; ----- Image -----
; QRCode::Create()             - Create an image with the QRCode
; QRCode::SetDefaults()        - Change defaults for Create()

; ----- Gadget -----
; QRCode::Gadget()             - Gadget for QRCodes

; QRCode::GetText()            - similar to 'GetGadgetText()'
; QRCode::GetColor()           - similar to 'GetGadgetColor()'

; QRCode::SetAutoResizeFlags() - [#MoveX|#MoveY|#Width|#Height]

; QRCode::SetAttribute()       - similar to 'SetGadgetAttribute()'
; QRCode::SetColor()           - similar to 'SetGadgetColor()'
; QRCode::SetText()            - similar to 'SetGadgetText()'

; ----- Decode -----
; QRCode::Decode()              - decodes an image with QRCode
Download 'QRCodeModule.pbi'
Last edited by Thorsten1867 on Wed May 25, 2022 10:51 am, edited 4 times in total.
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
User avatar
Thorsten1867
Addict
Addict
Posts: 1372
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

Re: [Module] QRCode Gadget (all OS)

Post by Thorsten1867 »

Update: Deocoding of QR-Codes added
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
User avatar
STARGÅTE
Addict
Addict
Posts: 2228
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Re: [Module] QRCode Gadget (all OS)

Post by STARGÅTE »

You forgot the code or a download link.
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and moreTypeface - Sprite-based font include/module
User avatar
Thorsten1867
Addict
Addict
Posts: 1372
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

Re: [Module] QRCode Gadget (all OS)

Post by Thorsten1867 »

Look in my signature
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
User avatar
STARGÅTE
Addict
Addict
Posts: 2228
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Re: [Module] QRCode Gadget (all OS)

Post by STARGÅTE »

Thorsten1867 wrote: Sat May 21, 2022 2:09 pm Look in my signature
Thanks for adding the direct link.
Signatures can be hidden in the forum theme, and some people actually hide them to improve the readability of topics.
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and moreTypeface - Sprite-based font include/module
User avatar
Paul
PureBasic Expert
PureBasic Expert
Posts: 1282
Joined: Fri Apr 25, 2003 4:34 pm
Location: Canada
Contact:

Re: [Module] QRCode (all OS)

Post by Paul »

Just a note, there is a bug in this Module where if you set the frontcolor using

Code: Select all

QRCode::SetColor(#Gadget, QRCode::#FrontColor, $800000)
but do not set any text using

Code: Select all

QRCode::SetText(#Gadget, "Hello World")
it will cause a crash.


An easy fix is to edit the Procedure Draw_()
and add a check at the end of the procedure by changing

Code: Select all

DrawImage(ImageID(QRCode()\Image), X, Y)
to

Code: Select all

If IsImage(QRCode()\Image)
   DrawImage(ImageID(QRCode()\Image), X, Y)
EndIf
Image Image
User avatar
idle
Always Here
Always Here
Posts: 5864
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: [Module] QRCode (all OS)

Post by idle »

Nice module thankyou.
User avatar
Thorsten1867
Addict
Addict
Posts: 1372
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

Re: [Module] QRCode (all OS)

Post by Thorsten1867 »

Paul wrote: Tue Oct 25, 2022 2:07 am Just a note, there is a bug in this Module where if you set the frontcolor using

Code: Select all

QRCode::SetColor(#Gadget, QRCode::#FrontColor, $800000)
but do not set any text using

Code: Select all

QRCode::SetText(#Gadget, "Hello World")
it will cause a crash.


An easy fix is to edit the Procedure Draw_()
and add a check at the end of the procedure by changing

Code: Select all

DrawImage(ImageID(QRCode()\Image), X, Y)
to

Code: Select all

If IsImage(QRCode()\Image)
   DrawImage(ImageID(QRCode()\Image), X, Y)
EndIf
Bug fixed.
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Re: [Module] QRCode (all OS)

Post by Psychophanta »

It looks like read a qr image good, and the numeric code is correct.
The problem is that when try the conversion again to the graphic from the numerical code, then the result is far to be correct.
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
Post Reply