I'm try to improve some of the drawing that I'm doing in my project by provide antialiasing. I'm playing with a simple project using the Graphics32 Library instead of the standard delphi Canvas functions. I am testing with simple shapes and noticed a blurring affect and was wondering if it could be fixed.
procedure TForm1.FormPaint(Sender: TObject);
var
Points : TArrayOfFixedPoint;
ar: array [0 .. 6] of Tpoint;
begin
// Antialiased Triangle
SetLength(Points, 3);
Points[0] := FixedPoint(20, 20);
Points[1] := FixedPoint(20 + 100, 20 + 20);
Points[2] := FixedPoint(20, 20 + 20);
PolygonFS(self.mBitmap, FixedPointToFloatPoint(Points), clYellow32, pfAlternate, nil); // Draw Filled Polygon
PolylineFS(self.mBitmap, FixedPointToFloatPoint(Points), clBlack32, true, 1); // Draw Outline
self.mBitmap.DrawTo(self.Canvas.Handle, 0, 0);
// Normal Triangle
ar[0] := point(20, 150);
ar[1] := point(20 + 100, 150 + 20);
ar[2] := point(20, 150 + 20);
ar[3] := point(20, 150);
self.Canvas.Brush.Color := clYellow;
self.Canvas.Polygon(slice(ar, 3));
end;
The antialiased triangle has a much smoother hypotenuse, but the two straight lines looks like they're blurred, which makes sense since it's antialiased. Is there a way to get the best of both worlds where the vertical and horizontal lines don't blend, while smoothing out the hypotenuse?
Edit: The version of Graphic32 I'm using is the top of the master branch from the Official Github Fork since the last release appears to be 1.9.1 from 2012.
TAntialiasMode
? I recall there are overloaded methods where you can specifyaaMode
. You did not say which version of GR32 you are using, so I can't say if it applies to your project.You could ofcourse also provide the missing parts of your test to make it more easy for those that would take the time to try and help you. In other words a MCVE. – Cottonseed