FireMonkey – drawing a 1 pixel line without anti-aliasing in Windows


I had no success trying to draw a 1-pixel line. I tried setting the Quality param in the form to all the three available options, but this does not change the result: always get a line with anti-aliasing. Conversely, somehow, the tRectangle class draws a clean 1-pixel width border, meaning that is possible to disable the anti-aliasing mode. The question is how. Follows an example of the code I’m using:

procedure tMyLine.Paint;
with Canvas do begin
Stroke.Cap := Flat;
Stroke.Color := tAlphaColor.Blue;
Stroke.Join := Miter;
Stroke.Kind := Solid;
Stroke.Thickness := 1;
DrawLine (tPointF (10, 10), tPointF (100, 10), 1);

Thickness less than one does not work either.

Comments are closed.