Can LC read QR-Code?

Sean Cole (Pi) sean at pidigital.co.uk
Mon Dec 7 22:51:00 EST 2020


Hi Richard

This isn't quite what you was asking for (I have to have LC open on my Mac
to get the dictionary when coding in Linux), but here are the two library
bits from the dictionary:

----

*qrCreate*

Type

command

Syntax

qrCreate pImg,pData,pECC,pSize,pMask,pMinVersion,pMaxVersion

Associations

QR Code GeneratorSummaryCreate a QR codeParameters

Name    Type     Description

pImg                  The name of an image object on the card, a filename
or the special code "!" which will return the image data in the result.
pData                The data to be encoded.
pECC                The error correction level

"L" : 7% error correction

"M" : 15% error correction

"Q" : 25% error correction

"H" : 30% error correction

pSize

Module size you can make the code larger/smaller. You can also just rescale
the image after the code has been created.

pMask

An integer value between 0 and 7. When encoding a QR code, there are eight
mask patterns that you can use to change the outputted matrix. Each mask
pattern changes the bits according to their coordinates in the QR matrix.
The purpose of a mask pattern is to make the QR code easier for a QR
scanner to read.

pMinVersion

An integer value between 1 and 40. It must be lower or equal to
pMaxVersion. If pMinVersion is not specified then the default value of 1 is
used.

pMaxVersion

An integer value between 1 and 40. It must be higher or equal to
pMinVersion. If pMaxVersion is not specified then the default value of 40
is used.


• Examples
qrCreate "MyImage", "QR data", "M", 3
--creating QR Code with ECC level M, Size 3, Mask 7 and version 14
qrCreate "MyImage", "QR data", "M", 3, 7, 14, 14
-- example how to use qrCreate with LiveCode server
qrCreate "!", tData, tECC, tSize
put the result into tData
if tData begins with "Error" then
   put tData
else
   # line 1 of the result contains some info
   # the remaining lines contain the png image data
   put line 1 of tData into tInfo
   delete line 1 of tData
   put "<b>Qr code info</b><br/>" & LF
   put "Version: " & item 1 of tInfo & "<br/>" & LF
   put "ECC: " & item 2 of tInfo & "<br/>" & LF
   put "Mode: " & item 3 of tInfo & "<br/>" & LF
   put "Mask: " & item 4 of tInfo & "<br/>" & LF
   # show the image
   put base64Encode(tData) into tData
   replace LF with empty in tData
   put "<img src='data:image/png;base64," & tData & "'/><br/>" & LF
end if

Value

Name Type Description

the result

If successful, the first line of the result will be the following values:

QR version

ECC

Mode

Mask
Image size with quiet zone (based on module size 1)


If there was an error the result will contain "Error:" and then an error
description.

If the special character '!' is used for pImg, then the result also
contains the raw output of a png image. You can use this data, for example,
with LiveCode server to generate QR codes on web pages.


Description

Set the text of an image to a QR code or get the PMG data of the QR code
image.

----

*qrSetColors*

Type

command

Syntax

qrSetColors pForeground,pBackground

Associations

QR Code Generator

Summary

Set colors other than the default black and white

Parameters

Name    Type    Description

pForeground

A color name or RGB triplet

pBackground

A color name or RGB triplet

Examples

qrSetColors "Blue", "Yellow"

Description

Optionally use colors other than black and white there must be a high
enough contrast between colors for scanning the foreground color should be
darker than the background color.




Sean Cole
*Pi Digital *

On Tue, 8 Dec 2020 at 02:07, Richard Gaskin via use-livecode <
use-livecode at lists.runrev.com> wrote:

> Klaus wrote:
>
>  > Question, the dictionary says the "Android Barcode Library" works with
>  > LC INDY. But I remember there was one feature falsely reported as
>  > supported by INDY, but was BUSINESS only in the end. Was it this
>  > library?
>
> Where is LC's QR code plugin documented?
>
> I have Indy, but LiveCode has no functioning browser widget for Linux,
> and so it has no Dictionary; instead it opens the Dictionary from the
> public site, which apparently only documents things in the Community
> Edition.
>
> --
>   Richard Gaskin
>   Fourth World Systems
>   Software Design and Development for the Desktop, Mobile, and the Web
>   ____________________________________________________________________
>   Ambassador at FourthWorld.com                http://www.FourthWorld.com
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



More information about the use-livecode mailing list