gats Posted July 7, 2020 Posted July 7, 2020 Hello, I need a component that can generate QRCode. logically it can be generated on the server, then the application downloads as an asset. but it will be easier if FGX can generate it. thanks you Quote
Alex Shi Posted July 9, 2020 Posted July 9, 2020 Hello, Try this component. Debenu-DelphiZXingQRCode.zip 2 Quote
Stas Posted July 9, 2020 Posted July 9, 2020 http://zarko-gajic.iz.hr/firemonkey-mobile-android-ios-qr-code-generation-using-delphi-xe-5-delphizxingqrcode/ 2 Quote
gats Posted July 10, 2020 Author Posted July 10, 2020 21 hours ago, Stas said: http://zarko-gajic.iz.hr/firemonkey-mobile-android-ios-qr-code-generation-using-delphi-xe-5-delphizxingqrcode/ 22 hours ago, Alex Shi said: Hello, Try this component. Debenu-DelphiZXingQRCode.zip 3.05 MB · 7 downloads Hello, I have tried this source code before, but failed to apply it to FGX. in this section I have not found the code on FGX. QRCodeBitmap.Canvas.Pixels[Column, Row] := clBlack; and how to repaint tfgpaintbox. Thanks you Quote
Alex Shi Posted July 10, 2020 Posted July 10, 2020 QRCodeBitmap: TfgBitmap; procedure TFormMain.UpdateQR; var QRCode: TDelphiZXingQRCode; pixelColor: TAlphaColor; Row, Column: integer; y, x: integer; columnPixel, rowPixel, pixelCount: single; function GetPixelCount(AWidth, AHeight: single): single; begin if QRCode.Rows > 0 then Result := (Trunc(Min(AWidth, AHeight)) div QRCode.Rows) * TfgAndroidHelper.ScreenScale else Result := 0; end; begin TfgAssert.IsNotNil(QRCodeBitmap, 'QRCodeBitmap is nil UpdateQR'); QRCode := TDelphiZXingQRCode.Create; try QRCode.Data := ' ' + QRCodeText; QRCode.Encoding := qrAuto; QRCode.QuietZone := 1; pixelCount := GetPixelCount(imgQRCode.Width, imgQRCode.Height); QRCodeBitmap.Size := TSizeF.Create(QRCode.Rows * pixelCount, QRCode.Columns * pixelCount).Round; QRCodeBitmap.Canvas.Stroke.Kind := TfgBrushKind.Solid; QRCodeBitmap.Canvas.Fill.Kind := TfgBrushKind.Solid; 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 := TAlphaColorRec.Black else pixelColor := TAlphaColorRec.White; columnPixel := Column * pixelCount; rowPixel := Row * pixelCount; QRCodeBitmap.Canvas.Fill.Color := pixelColor; QRCodeBitmap.Canvas.Stroke.Color := pixelColor; QRCodeBitmap.Canvas.FillRect(columnPixel, rowPixel, columnPixel + pixelCount, rowPixel + pixelCount); end; end; finally QRCode.Free; end; end; Quote
gats Posted July 10, 2020 Author Posted July 10, 2020 this imgQRCode component fgimage? and when QRCode showing? Quote
Alex Shi Posted July 10, 2020 Posted July 10, 2020 procedure TFormMain.imgQRCodePaint(Sender: TObject; const ACanvas: TfgCanvas); begin ACanvas.FillColor(TAlphaColorRec.White); TfgAssert.IsNotNil(QRCodeBitmap, 'QRCodeBitmap is nil imgQRCodePaint'); ACanvas.DrawBitmap(QRCodeBitmap, TRect.Create(0, 0, QRCodeBitmap.Width, QRCodeBitmap.Height), TRectF.Create(0, 0, ACanvas.Width * TfgAndroidHelper.ScreenScale, ACanvas.Height * TfgAndroidHelper.ScreenScale)); end; Quote
Administrators Yaroslav Brovin Posted July 17, 2020 Administrators Posted July 17, 2020 В 10.07.2020 в 08:04, Alex Shi сказал: TfgAndroidHelper.ScreenScale Now FGX Native provide crossplatform way for getting screen scale: FGX.Screen.TfgScreenManager.TfgScreen.Main.Scale 1 Quote
Administrators Yaroslav Brovin Posted July 17, 2020 Administrators Posted July 17, 2020 Also i suggest to store QR code bitmap into assets manager and display in TfgImage instead of drawing it on TfgPaintBox. It works faster. 1 Quote
Administrators Yaroslav Brovin Posted September 21, 2021 Administrators Posted September 21, 2021 We added new extension to FGX Native 1.12.0.0 with implementation new component TfgBarcode, which generates barcode of different types. В версии 1.12.0.0 добавлено расширение с новым компонентом TfgBarcode, генерирующим всевозможные типы штрихкодов. 2 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.