Browse Source

Updated Readme with some helpful hints.

Jason Southwell 6 years ago
parent
commit
11979f993c
1 changed files with 56 additions and 1 deletions
  1. 56 1
      README.md

+ 56 - 1
README.md

@@ -1,2 +1,57 @@
-# qr
+# qr code generator for Delphi
+
+To generate a QR code, select the framework unit you need:
+
+* qr.code.vcl - for VCL projects
+* qr.code.fmx - for Firemonkey projects
+
+Each unit contains a TQRBitmap object which can be used as follows to generate a 600px bitmap of qr encoded user supplied text:
+
+```pascal
+var
+  bmp : TQRBitmap;
+begin
+  bmp := TQRBitmap.Create(Edit1.Text, 600, 600);
+  try
+    Image1.Picture.Graphic := bmp;
+  finally
+    bmp.Free;
+  end;
+end;
+```
+
+If you want more control over the image or would like to do custom drawing, the main qr generation object can be used directly.
+
+```pascal
+var
+  qr : TQRCode;
+begin
+  qry:= TQRCode.Create;
+  try
+    qr.OnPaint :=
+      procedure(Width, Height : integer; BlackRects : TArray<TRect>)
+	  begin
+	    // paint here using the supplied width and height as well as the array of rectangles that should be painted black.
+  	  end;
+    qr.BeginUpdate; // if you fail to use BeginUpdate, the code will rerender with each of the changes below.
+    try
+      qr.Mode := TMode.Auto;
+      qr.Version := TVersion.Auto;
+      qr.ECL := TErrorCorrectionLevel.Auto;
+      qr.Text := 'Some Data To Encode';
+    finally
+      qr.EndUpdate;  // will cause the OnPaint handler to get called
+    end;
+  finally
+    qr.Free;
+  end;
+ end;
+```
+
+Four Demos are provided for your assistance...
+* SimpleQRVCL - A VCL Demo showing a qr encoder using all defaults.
+* SimpleQRFMX - An FMX Demo showing a qr encoder using all defaults.
+* QREncoderVCL - A VCL Demo showing an encoder with a high level of customization.
+* QREncoderFMX - An FMX Demo Showing an encoder with a high leverl of customization.
+