I'm making simple drawing application with FireMonkey and Delphi. All it really does is drawing lines and ellipses. This is the code:
Image1.Bitmap.Canvas.BeginScene;
with Form1 do begin
for i := 0 to 360 do
if (i mod 15)=0 then
begin
p1 := TPointF.Create(PX, PY);
p2 := TPointF.Create(Round(PX+200*sin(i*pi/180)), Round(PY+200*cos(i*pi/180)));
Image1.Bitmap.Canvas.DrawLine(p1, p2, 100);
end;
for i := 0 to 200 do
if (i mod 20)=0 then
begin
prst1 := TRectF.Create(PX+i,PY+i,PX-i,PY-i);
Image1.Bitmap.Canvas.DrawEllipse(prst1, 100);
end;
Image1.Bitmap.Canvas.EndScene;
end;
This code works perfectly when I compile it under Win32 or Win64. But when I try to compile it and run on an Android device, only lines show up, and ellipses are just missing. Does anyone have an idea why is that happening?
Thank you in advance for your help!
You can draw on the Form.Canvas
in the OnPaint
event handler. Here is an example:
procedure TForm1.FormPaint(Sender: TObject; Canvas: TCanvas;
const ARect: TRectF);
begin
with Canvas do begin
BeginUpdate;
try
Stroke.Kind := TBrushKind.Solid;
Stroke.Thickness := 2.0;
DrawEllipse(ARect,1);
DrawLine(PointF(ARect.Left,ARect.Height / 2), PointF(ARect.right,ARect.Height / 2), 1);
DrawLine(PointF(ARect.Left+(ARect.Width / 2),ARect.Height), PointF(ARect.Left+(ARect.Width / 2),0), 1);
finally
EndUpdate;
end;
end;
end;