Page 1 of 1

Bezier curves and anti-aliasing

PostPosted: 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?

PostPosted: January 13th, 2005, 11:52 am
by Stefan
As for question no.1 check out this article:

http://groups.google.nl/groups?hl=nl&lr;=&selm;=3666E4C4.6F65%40math.okstate.edu&rnum;=5

Cheers,
Stefan

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

PostPosted: January 19th, 2005, 10:35 am
by Stefan
indeed :)

umm, would anti-aliasing the line-pieces of the curve be enough?

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

PostPosted: 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...