What I have: a frame with a semi-arc that represents a gauge for information like temperature. See the attached image. Each of these controls are into a frame which I create in runtime depending from what I receive from my server.
The structure is: TFrame->TRectangle->TPaintBox.
The issue: when I run with Windows the arcs are correctly drawn, I sent the Value so it draws fine the correct gauge. When I run with Android, using the example attached with 3 gauges, all the 3 gauges will get redraw with the same value, even I am pointing to only one.
I am using a code I found a modified later, but most of it is close to the original, it will use anti-aliasing to draw the arc, the code is bellow:
type
TAAArcSettings = record
AStart, AEnd, Opacity: single;
AThickStart, AThinkEnd: integer;
Color: TAlphaColor;
end;
procedure TframeGauge.DrawArcAA(AParams: TAAArcSettings);
var
path: TPathData;
poly: TPolygon;
begin
path := TPathData.Create;
path.AddArc(rect.CenterPoint, TPointF.Create(rw, rh), AParams.AStart, AParams.AEnd);
path.AddArc(rect.CenterPoint(), TPointF.Create(rw - AParams.AThickStart, rh - AParams.AThinkEnd), AParams.AStart + AParams.AEnd,
-AParams.AEnd);
path.ClosePath();
path.FlattenToPolygon(poly);
APaintBox.Canvas.Fill.DefaultColor := TAlphaColorRec.Blue;
APaintBox.Canvas.Stroke.Kind := TBrushKind.Solid;
APaintBox.Canvas.Fill.Color := AParams.Color;
APaintBox.Canvas.FillPolygon(poly, AParams.Opacity);
path.DisposeOf;
end;
I make some calculations to define the initial and final angle plus the percent for the value representation. To intent set a value the code below is used:
ArcSetting.AEnd := AEndAngle;
ArcSetting.AStart := START_ANGLE;
Rectangle1.BeginUpdate;
APaintBox.Canvas.BeginScene;
APaintBox.Repaint; // this will trigger the PaintBoxPaint() method and there inside I can the DrawArcAAA()
APaintBox.Canvas.EndScene;
Rectangle1.EndUpdate;
There is a procedure TframeGauge.setGaugeValue(Value: integer) which will make the code above. In the main form it detects the frame and will call this procedure, but as I say all of any gauges will be drawn with the new value. This won't happen with Windows (both 32 and 64 bit).
Maybe FMX for Android it is required something else beyond I know 😞
Thanks for reading and any clue where I could search for?