Drawing Smoothed Shapes

I am trying to improve the part of the drawing that I am doing in my project by providing anti-aliasing. I play with a simple project using the Graphics32 library instead of the standard Canvas features. I test simple shapes and notice a blur and wonder if it can 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 smoothed triangle has a much smoother hypotenuse, but the two straight lines look as if they are blurred, which makes sense because it is smoothed. Is there a way to get the best of both worlds, where the vertical and horizontal lines do not mix, but smooth the hypotenuse?

Edit: The Graphic32 version I'm using is the top of the lead branch from Official Github Fork since last release is 1.9.1 from 2012.

+6
source share

Source: https://habr.com/ru/post/1012513/


All Articles