Firemonkey: Is it possible to have all controls pixel-aligned? [on hold]

  

Is there a general method to round all controls positions and sizes? Floating point values lead to weird anti-aliasing on some controls

For example, I put 2 labels on a new win32 FMX form. Set both align to scale. (Please dont ask in comments why I want to use the TAlignLayout.Scale. If you never use it, it doesn’t mean others should not too).

Then I align label1 to rounded values:

procedure TForm17.Label1Resized(Sender: TObject);
begin
Label1.Position.X := round (Label2.Position.X);
Label1.Width := round (Label2.Width);
end;

Lets run this app, resize the form couple times and see how both labels are drawn (pictures below are 4x scaled)

Look the “T” and “L” letters, Label1 (rounded) is always the same look, while label2 has blury effect.

Currently I found an ugly solution to prevent AA text artefacts: patch the

procedure TControl.PaintInternal;
{…}
begin
Canvas.SetMatrix(Round(AbsoluteMatrix));
Paint;
end;

Comments are closed.