unit Unit1;

interface

uses
  System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
  FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.Objects,
  FMX.StdCtrls, FMX.Controls.Presentation, FMX.Edit,
  FMXDelphiZXingQRCode, System.Math;

type
  TForm1 = class(TForm)
    Image1: TImage;
    Rectangle1: TRectangle;
    procedure Button1Click(Sender: TObject);
  private
    procedure QrCodeMobile(imgQRCode: TImage; texto: string);
    procedure QRCodeWin(imgQRCode: TImage; texto: string);
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.fmx}

procedure TForm1.QRCodeWin(imgQRCode: TImage; texto: string);
var
  QRCode: TDelphiZXingQRCode;
  Row, Column: Integer;
  pixelColor : TAlphaColor;
  vBitMapData : TBitmapData;
begin
    imgQRCode.DisableInterpolation := true;
    imgQRCode.WrapMode := TImageWrapMode.iwStretch;

    QRCode := TDelphiZXingQRCode.Create;
    try
        QRCode.Data := texto;
        QRCode.Encoding := TQRCodeEncoding.qrAuto;
        QRCode.QuietZone := 4;
        imgQRCode.Bitmap.SetSize(QRCode.Rows, QRCode.Columns);

        for Row := 0 to QRCode.Rows - 1 do
        begin
            for Column := 0 to QRCode.Columns - 1 do
            begin
                if (QRCode.IsBlack[Row, Column]) then
                    pixelColor := TAlphaColors.Black
                else
                    pixelColor := TAlphaColors.White;

                if imgQRCode.Bitmap.Map(TMapAccess.maWrite, vBitMapData)  then
                try
                    vBitMapData.SetPixel(Column, Row, pixelColor);
                finally
                    imgQRCode.Bitmap.Unmap(vBitMapData);
                end;
            end;
        end;

    finally
        QRCode.Free;
    end;

end;

procedure TForm1.Button1Click(Sender: TObject);
begin
    {$IFDEF MSWINDOWS}
    QRCodeWin(Image1, edit1.text);
    {$ELSE}
    QRCodeMobile(Image1, edit1.text);
    {$ENDIF}
end;

end.
