FireMonkey:Android 上缺少抗锯齿和抖动效果

时间:2020-12-29 11:07:50

标签: android delphi firemonkey

我在 Delphi 10.4 (FMX) 中使用 TArc 创建了一个进度动画,但在 Android 上运行该应用程序时出现了一些奇怪的渲染行为。

  1. 像 TArc 或 TLine 这样的简单形状似乎都没有抗锯齿功能。将 TForm.Quality 设置为 HighQuality 似乎没有效果。

  2. 设置 Arc1.Stroke.Cap := TStrokeCap.Round; 似乎对 Android 没有影响。末端根本不圆。*

  3. TFloatAnimation 似乎存在某种抖动问题,但我不知道为什么。*

Preview on Android and Windows

*在 Windows (10) 上运行应用程序时,一切看起来和运行良好,但在 Android 上存在这些故障,我想知道问题是什么。特别是缺少抗锯齿功能。智能手机上的显示屏是高密度的,但缺少的抗锯齿功能仍然非常清晰可见。以下是从 Android 设备和运行 Windows 10 的台式电脑捕获的视频:

https://youtu.be/MyNva5ymSWU

这是一个示例代码:

Unit1.fmx

object Form1: TForm1
  Left = 0
  Top = 0
  Caption = 'Form1'
  ClientHeight = 344
  ClientWidth = 427
  Fill.Color = claLightskyblue
  Fill.Kind = Solid
  FormFactor.Width = 320
  FormFactor.Height = 480
  FormFactor.Devices = [Desktop]
  DesignerMasterStyle = 0
  object Arc1: TArc
    Align = Center
    Size.Width = 60.000000000000000000
    Size.Height = 60.000000000000000000
    Size.PlatformDefault = False
    Stroke.Color = claWhite
    Stroke.Thickness = 5.000000000000000000
    Stroke.Cap = Round
    EndAngle = 90.000000000000000000
    object FloatAnimationStartAngle: TFloatAnimation
      Enabled = True
      Duration = 2.000000000000000000
      Loop = True
      PropertyName = 'StartAngle'
      StartValue = 0.000000000000000000
      StopValue = 360.000000000000000000
    end
    object FloatAnimationEndAngle: TFloatAnimation
      Enabled = True
      Duration = 2.000000000000000000
      OnFinish = FloatAnimationEndAngleFinish
      PropertyName = 'EndAngle'
      StartValue = 1.000000000000000000
      StopValue = 360.000000000000000000
    end
  end
end

Unit1.pas

// ...stripped code here at top...
implementation

var
  increasing: Boolean = True;

{$R *.fmx}

procedure TForm1.FloatAnimationEndAngleFinish(Sender: TObject);
begin
  FloatAnimationEndAngle.Enabled := false;
  FloatAnimationEndAngle.Inverse := not FloatAnimationEndAngle.Inverse;

  if increasing then
    FloatAnimationEndAngle.Duration := FloatAnimationEndAngle.Duration * 2.0
  else
    FloatAnimationEndAngle.Duration := FloatAnimationEndAngle.Duration / 2.0;

  increasing := not increasing;
  FloatAnimationEndAngle.Enabled := true;
  FloatAnimationEndAngle.Start();
end;

0 个答案:

没有答案