Bezier curves and anti-aliasing

Posted:
January 13th, 2005, 11:23 am
by Johnny_Bit
1. how calculate where should be positioned points and control points in bezier curve (windows implementation), so the curve would go trouught specified list of points?
2. How to anti-alias that curve, so it would look smooth?

Posted:
January 13th, 2005, 11:52 am
by Stefan

Posted:
January 17th, 2005, 4:49 pm
by Johnny_Bit
OK, got tat, bu how about this whole anti-aliasing thing?

Posted:
January 19th, 2005, 10:35 am
by Stefan
indeed
umm, would anti-aliasing the line-pieces of the curve be enough?

Posted:
January 19th, 2005, 3:56 pm
by Johnny_Bit
I quite don't understand...

Posted:
January 19th, 2005, 5:34 pm
by Stefan
Here's some code I use in TExtGraph to get all the line-parts of a bézier curve:
- Code: Select all
BeginPath(Canvas.Handle);
PolyBezier(Canvas.Handle, points, 4);
EndPath(Canvas.Handle);
FlattenPath(Canvas.Handle);
NumLine := getpath(Canvas.Handle, lpPoints, lpTypes, 0);
setlength(lppoints, NumLine);
setlength(lptypes, NumLine);
GetPath(Canvas.Handle, lppoints[0], lptypes[0], NumLine);
for i := 0 to NumLine-1 do begin
case lpTypes[i] of
PT_MOVETO: Canvas.MoveTo(lppoints[i].x, lppoints[i].y);
PT_LINETO: Canvas.LineTo(lppoints[i].x, lppoints[i].y);
end;
end;
after this you could (in the for-loop) anti-alias all the lines...