qrcode.frink

Download or view qrcode.frink in plain text format

// Generates a QRcode image using Google Charts API:
// http://code.google.com/apis/chart/docs/gallery/qr_codes.html

// Generate a QRcode image and return that image.
// errorCorrection is a letter consisting of one of the following:
// "L" (can correct up to  7% errors)
// "M" (can correct up to 15% errors)
// "Q" (can correct up to 25% errors)
// "H" (can correct up to 30% errors)
qrcode[text, errorCorrection="M", width=400, height=400] :=
{
   i = new image["http://chart.apis.google.com/chart?cht=qr&chs=${width}x${height}&chld=$errorCorrection&chl=" + URLEncode[text, "UTF8"]]

   return i
}

//text = "https://frinklang.org/"
//text = "This is a test.  It is very long but it is awesome.  You are nice.  I like you too.  This has a text length limit of about 2000 characters.  What if I was a monkey.  That would be nice.  What if you had a monkey?  It would be nice too.  Monkey monkey monkey."
text="36.12090 N 115.18390 W"


g = new graphics;

g.fitCenter[qrcode[text,"L"],0,0,1,1]
g.fitCenter[qrcode[text,"M"],1,0,1,1]
g.fitCenter[qrcode[text,"Q"],0,1,1,1]
g.fitCenter[qrcode[text,"H"],1,1,1,1]
g.fitCenter[qrcode[text,"H"],0,2,1,1]
g.color[1,1,1]
g.fillRectCenter[1,1,.44,.1]
g.font["SansSerif",.1]
g.color[0,0,0]
g.text["Daemon", 1,1]
g.show[]
//g.write["daemonGPS.svg", 3000, 2000]  // Doh, comes back as bitmap
g.write["daemonGPS.png", 2000, 3000]
//g.print[]   // Or just right-click the graphic and select "print"


Download or view qrcode.frink in plain text format


This is a program written in the programming language Frink.
For more information, view the Frink Documentation or see More Sample Frink Programs.

Alan Eliasen was born 19944 days, 20 hours, 40 minutes ago.