FMX.Graphics.TCanvas.DrawEllipse doesn't work on AndroidProblems running a 32-bit Delphi app on a 64-bit Windows platformHow does Delphi XE2 Firemonkey's Align property set to alScale affect the coordinate system?How to install a Delphi XE5 application permanently on a MacDelphi XE5 - TPaintBox scrolls too slow under TListBox on machines with AndroidDelphi FireMonkey Canvas performance issuesFiremonkey XE6:How to use the full resolution on my adroiddevice?dccosx Fatal ErrorDelphi 10 Seattle strange Memo behaviour on Android 6Delphi Rtti with Ios 64 BitsDelphi android app TEdit access violation
Generate ladder of integers using the least number of unique characters (in C++)
Anatomically Correct Carnivorous Tree
OSPF increase bandwidth with load-balancing
Why are solar panels kept tilted?
Why did the metro bus stop at each railway crossing, despite no warning indicating a train was coming?
How to disable Two-factor authentication for Apple ID?
Is this possible when it comes to the relations of P, NP, NP-Hard and NP-Complete?
do we have C++20 ranges library in gcc 9?
Should generated documentation be stored in a Git repository?
Wireless headphones interfere with Wi-Fi signal on laptop
Biology of a Firestarter
Formal Definition of Dot Product
Smooth function that vanishes only on unit cube
Find the unknown area, x
About matrices whose row and column sums are 0
Will a coyote attack my dog on a leash while I'm on a hiking trail?
Where to find every-day healthy food near Heathrow Airport?
A case where Bishop for knight isn't a good trade
Set a Field Equivalent in Microsoft Flow
How might a landlocked lake become a complete ecosystem?
Is 95% of what you read in the financial press “either wrong or irrelevant?”
Do I need to say “o’clock”?
Meaning of "work with shame"
How to describe a building set which is like LEGO without using the "LEGO" word?
FMX.Graphics.TCanvas.DrawEllipse doesn't work on Android
Problems running a 32-bit Delphi app on a 64-bit Windows platformHow does Delphi XE2 Firemonkey's Align property set to alScale affect the coordinate system?How to install a Delphi XE5 application permanently on a MacDelphi XE5 - TPaintBox scrolls too slow under TListBox on machines with AndroidDelphi FireMonkey Canvas performance issuesFiremonkey XE6:How to use the full resolution on my adroiddevice?dccosx Fatal ErrorDelphi 10 Seattle strange Memo behaviour on Android 6Delphi Rtti with Ios 64 BitsDelphi android app TEdit access violation
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
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!
delphi firemonkey rad-studio
add a comment |
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!
delphi firemonkey rad-studio
Drawing inside an image control isn't really the proper way to draw on the screen. Try drawing directly onto the form canvas from within the form'sOnPaintevent handler.
– Jerry Dodge
Mar 23 at 14:29
Please always provide details like variable initialization and types. E.g. What value doPXandPYhave at entry? What if they happen to be 123456? What is the context of the code? Event handler? Your defined method? What are thebrushandstrokepropertiy values? Bonus question: What is the opacity value for a fully opaque line?
– Tom Brunberg
Mar 23 at 15:49
@TomBrunberg Sorry for that. BothPXandPYare 200, andTImageis 400x400 so they really just represent the centre of theTImage. The code is underButtonClickprocedure - I just want to draw radar-like surface on the image. Then I'm drawing trajectories on it. I just havestrokeandcolorproperty values, they are3forstrokeandTAlphaColors.Blackforcolor. Opacity value in Object Inspector forTImageis1(if this is what you are asking about).
– brecho
Mar 23 at 15:57
I'm just having problem with understanding why the same FireMonkey code works under Win32 but doesn't work under Android. I'm pretty new to Delphi and I believed that the same code will work identically under both of them. Embarcadero wiki isn't really that helpful for me with my limited knowledge. Will using TPaintBox will be better than TImage in my situation when I want to draw multiple trajectories on it (so editing it in loop that works for about 1000steps)?
– brecho
Mar 23 at 16:11
Thanks for responding to my comment, but please add that info to your question, here in the comments it is so easily overlooked. My q regarding opacity stems from your line:Image1.Bitmap.Canvas.DrawLine(p1, p2, 100);. The third parameter is the opacity, 0..1.0 acc docs, but ok, anything above 1.0 is considered 1.0.
– Tom Brunberg
Mar 23 at 17:25
add a comment |
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!
delphi firemonkey rad-studio
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!
delphi firemonkey rad-studio
delphi firemonkey rad-studio
asked Mar 23 at 13:45
brechobrecho
93
93
Drawing inside an image control isn't really the proper way to draw on the screen. Try drawing directly onto the form canvas from within the form'sOnPaintevent handler.
– Jerry Dodge
Mar 23 at 14:29
Please always provide details like variable initialization and types. E.g. What value doPXandPYhave at entry? What if they happen to be 123456? What is the context of the code? Event handler? Your defined method? What are thebrushandstrokepropertiy values? Bonus question: What is the opacity value for a fully opaque line?
– Tom Brunberg
Mar 23 at 15:49
@TomBrunberg Sorry for that. BothPXandPYare 200, andTImageis 400x400 so they really just represent the centre of theTImage. The code is underButtonClickprocedure - I just want to draw radar-like surface on the image. Then I'm drawing trajectories on it. I just havestrokeandcolorproperty values, they are3forstrokeandTAlphaColors.Blackforcolor. Opacity value in Object Inspector forTImageis1(if this is what you are asking about).
– brecho
Mar 23 at 15:57
I'm just having problem with understanding why the same FireMonkey code works under Win32 but doesn't work under Android. I'm pretty new to Delphi and I believed that the same code will work identically under both of them. Embarcadero wiki isn't really that helpful for me with my limited knowledge. Will using TPaintBox will be better than TImage in my situation when I want to draw multiple trajectories on it (so editing it in loop that works for about 1000steps)?
– brecho
Mar 23 at 16:11
Thanks for responding to my comment, but please add that info to your question, here in the comments it is so easily overlooked. My q regarding opacity stems from your line:Image1.Bitmap.Canvas.DrawLine(p1, p2, 100);. The third parameter is the opacity, 0..1.0 acc docs, but ok, anything above 1.0 is considered 1.0.
– Tom Brunberg
Mar 23 at 17:25
add a comment |
Drawing inside an image control isn't really the proper way to draw on the screen. Try drawing directly onto the form canvas from within the form'sOnPaintevent handler.
– Jerry Dodge
Mar 23 at 14:29
Please always provide details like variable initialization and types. E.g. What value doPXandPYhave at entry? What if they happen to be 123456? What is the context of the code? Event handler? Your defined method? What are thebrushandstrokepropertiy values? Bonus question: What is the opacity value for a fully opaque line?
– Tom Brunberg
Mar 23 at 15:49
@TomBrunberg Sorry for that. BothPXandPYare 200, andTImageis 400x400 so they really just represent the centre of theTImage. The code is underButtonClickprocedure - I just want to draw radar-like surface on the image. Then I'm drawing trajectories on it. I just havestrokeandcolorproperty values, they are3forstrokeandTAlphaColors.Blackforcolor. Opacity value in Object Inspector forTImageis1(if this is what you are asking about).
– brecho
Mar 23 at 15:57
I'm just having problem with understanding why the same FireMonkey code works under Win32 but doesn't work under Android. I'm pretty new to Delphi and I believed that the same code will work identically under both of them. Embarcadero wiki isn't really that helpful for me with my limited knowledge. Will using TPaintBox will be better than TImage in my situation when I want to draw multiple trajectories on it (so editing it in loop that works for about 1000steps)?
– brecho
Mar 23 at 16:11
Thanks for responding to my comment, but please add that info to your question, here in the comments it is so easily overlooked. My q regarding opacity stems from your line:Image1.Bitmap.Canvas.DrawLine(p1, p2, 100);. The third parameter is the opacity, 0..1.0 acc docs, but ok, anything above 1.0 is considered 1.0.
– Tom Brunberg
Mar 23 at 17:25
Drawing inside an image control isn't really the proper way to draw on the screen. Try drawing directly onto the form canvas from within the form's
OnPaint event handler.– Jerry Dodge
Mar 23 at 14:29
Drawing inside an image control isn't really the proper way to draw on the screen. Try drawing directly onto the form canvas from within the form's
OnPaint event handler.– Jerry Dodge
Mar 23 at 14:29
Please always provide details like variable initialization and types. E.g. What value do
PX and PY have at entry? What if they happen to be 123456? What is the context of the code? Event handler? Your defined method? What are the brush and stroke propertiy values? Bonus question: What is the opacity value for a fully opaque line?– Tom Brunberg
Mar 23 at 15:49
Please always provide details like variable initialization and types. E.g. What value do
PX and PY have at entry? What if they happen to be 123456? What is the context of the code? Event handler? Your defined method? What are the brush and stroke propertiy values? Bonus question: What is the opacity value for a fully opaque line?– Tom Brunberg
Mar 23 at 15:49
@TomBrunberg Sorry for that. Both
PX and PY are 200, and TImage is 400x400 so they really just represent the centre of the TImage. The code is under ButtonClick procedure - I just want to draw radar-like surface on the image. Then I'm drawing trajectories on it. I just have stroke and color property values, they are 3 for stroke and TAlphaColors.Black for color. Opacity value in Object Inspector for TImage is 1 (if this is what you are asking about).– brecho
Mar 23 at 15:57
@TomBrunberg Sorry for that. Both
PX and PY are 200, and TImage is 400x400 so they really just represent the centre of the TImage. The code is under ButtonClick procedure - I just want to draw radar-like surface on the image. Then I'm drawing trajectories on it. I just have stroke and color property values, they are 3 for stroke and TAlphaColors.Black for color. Opacity value in Object Inspector for TImage is 1 (if this is what you are asking about).– brecho
Mar 23 at 15:57
I'm just having problem with understanding why the same FireMonkey code works under Win32 but doesn't work under Android. I'm pretty new to Delphi and I believed that the same code will work identically under both of them. Embarcadero wiki isn't really that helpful for me with my limited knowledge. Will using TPaintBox will be better than TImage in my situation when I want to draw multiple trajectories on it (so editing it in loop that works for about 1000steps)?
– brecho
Mar 23 at 16:11
I'm just having problem with understanding why the same FireMonkey code works under Win32 but doesn't work under Android. I'm pretty new to Delphi and I believed that the same code will work identically under both of them. Embarcadero wiki isn't really that helpful for me with my limited knowledge. Will using TPaintBox will be better than TImage in my situation when I want to draw multiple trajectories on it (so editing it in loop that works for about 1000steps)?
– brecho
Mar 23 at 16:11
Thanks for responding to my comment, but please add that info to your question, here in the comments it is so easily overlooked. My q regarding opacity stems from your line:
Image1.Bitmap.Canvas.DrawLine(p1, p2, 100);. The third parameter is the opacity, 0..1.0 acc docs, but ok, anything above 1.0 is considered 1.0.– Tom Brunberg
Mar 23 at 17:25
Thanks for responding to my comment, but please add that info to your question, here in the comments it is so easily overlooked. My q regarding opacity stems from your line:
Image1.Bitmap.Canvas.DrawLine(p1, p2, 100);. The third parameter is the opacity, 0..1.0 acc docs, but ok, anything above 1.0 is considered 1.0.– Tom Brunberg
Mar 23 at 17:25
add a comment |
1 Answer
1
active
oldest
votes
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;
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55314349%2ffmx-graphics-tcanvas-drawellipse-doesnt-work-on-android%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
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;
add a comment |
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;
add a comment |
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;
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;
edited Mar 24 at 21:56
Jerry Dodge
15.5k22112269
15.5k22112269
answered Mar 23 at 16:37
nolaspeakernolaspeaker
1,1191329
1,1191329
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55314349%2ffmx-graphics-tcanvas-drawellipse-doesnt-work-on-android%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Drawing inside an image control isn't really the proper way to draw on the screen. Try drawing directly onto the form canvas from within the form's
OnPaintevent handler.– Jerry Dodge
Mar 23 at 14:29
Please always provide details like variable initialization and types. E.g. What value do
PXandPYhave at entry? What if they happen to be 123456? What is the context of the code? Event handler? Your defined method? What are thebrushandstrokepropertiy values? Bonus question: What is the opacity value for a fully opaque line?– Tom Brunberg
Mar 23 at 15:49
@TomBrunberg Sorry for that. Both
PXandPYare 200, andTImageis 400x400 so they really just represent the centre of theTImage. The code is underButtonClickprocedure - I just want to draw radar-like surface on the image. Then I'm drawing trajectories on it. I just havestrokeandcolorproperty values, they are3forstrokeandTAlphaColors.Blackforcolor. Opacity value in Object Inspector forTImageis1(if this is what you are asking about).– brecho
Mar 23 at 15:57
I'm just having problem with understanding why the same FireMonkey code works under Win32 but doesn't work under Android. I'm pretty new to Delphi and I believed that the same code will work identically under both of them. Embarcadero wiki isn't really that helpful for me with my limited knowledge. Will using TPaintBox will be better than TImage in my situation when I want to draw multiple trajectories on it (so editing it in loop that works for about 1000steps)?
– brecho
Mar 23 at 16:11
Thanks for responding to my comment, but please add that info to your question, here in the comments it is so easily overlooked. My q regarding opacity stems from your line:
Image1.Bitmap.Canvas.DrawLine(p1, p2, 100);. The third parameter is the opacity, 0..1.0 acc docs, but ok, anything above 1.0 is considered 1.0.– Tom Brunberg
Mar 23 at 17:25