I try to rewrite an FMX project in VCL.
Code for QR-code drawing in FMX:
for Column := 0 to QRCode.Columns - 1 do
begin
if QRCode.IsBlack[Row, Column] then
QRCodeBitmap.ClearRect(TRectF.Create(PointF(Column, Row) * Scale,
Scale, Scale), TAlphaColors.Black);
end;
How to replace QRCodeBitmap.ClearRect() in VCL?
I try like this:
if (QRCode.IsBlack[Row, Column]) then
begin
QRCodeBitmap.Canvas.Pixels[Column, Row] := clBlack;
end else
begin
QRCodeBitmap.Canvas.Pixels[Column, Row] := clWhite;
end;
but it does not work like I want.
The
TBitmap.ClearRect()method in FMX fills a rectangular area with a color.In VCL, you can do the same thing using the
TBitmap.Canvas.FillRect()method, where the fill color is specified in theTBitmap.Canvas.Brush.Colorproperty, eg: