SHIP:Sail:qr

From Serious Documentation
Revision as of 15:22, 25 July 2016 by TerryWest (talk | contribs) (Detailed Description)
Jump to: navigation, search
Function Returns Introduced Description
qr nothing v5.1 Generates a QR code image in a canvas object.

See Also:

Prototype

qr(Node canvas, Dimension size, Dimension x, Dimension y, Byte type, Byte redundancy, String src, [Color fg [, Color bg ]]);qr(Node canvas, Dimension size, Dimension x, Dimension y, Byte type, Byte redundancy, Buffer src, [Color fg [, Color bg ]]);

Parameters/Return Value

Parameter Data Type Description
canvas Node Node of type canvas to render into
size Dimension Pixel width and height of resulting square QR code image
x Dimension Horizontal offset in canvas for bottom right corner of QR code
y Dimension Vertical offset in canvas for bottom right corner of QR code
type Byte Type of QR code 0...127
redundancy Byte Data redundancy desired in QR image 0..100 as a percentage
src String String object for source data
src Buffer Buffer object for source data
fg Color ARGB8888 color used for rendering the foreground; if not specified default is 0xFF000000 (opaque black)
bg Color ARGB8888 color used for rendering the background; if not specified default is 0xFFFFFFFF (opaque white)

Detailed Description

The qr function renders a QR code image into a canvas node based on runtime data held in a binary Buffer or String.

Since QR codes are always square, the size parameter indicates the pixel width and pixel height of the QR code. Since canvas dimensions are positive up-and-to-the-right (vs. box/frame which are down and to the right) the offset specified in the qr functions x and y parameters indicate the bottom-left corner of the QR code's target location. In the canvas, the QR code will be rendered at [x,y..(x+size-1),(y+size-1)].

Examples

Animations

getChild is particularly useful for animations where an incrementing counter variable from a timer can be used as an index into a group of images and then assigning the result to a box's object property.