Bezier curves and anti-aliasing

Please discuss general Delphi programming topics here.

Bezier curves and anti-aliasing

Postby Johnny_Bit » January 13th, 2005, 11:23 am

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?
Johnny_Bit
VIP Member
VIP Member
 
Posts: 455
Joined: June 15th, 2003, 9:56 am

Postby Stefan » January 13th, 2005, 11:52 am

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
User avatar
Stefan
Moderator
Moderator
 
Posts: 128
Joined: September 27th, 2004, 9:40 am
Location: Tilburg, The Netherlands

Postby Johnny_Bit » January 17th, 2005, 4:49 pm

OK, got tat, bu how about this whole anti-aliasing thing?
Johnny_Bit
VIP Member
VIP Member
 
Posts: 455
Joined: June 15th, 2003, 9:56 am

Postby Stefan » January 19th, 2005, 10:35 am

indeed :)

umm, would anti-aliasing the line-pieces of the curve be enough?
User avatar
Stefan
Moderator
Moderator
 
Posts: 128
Joined: September 27th, 2004, 9:40 am
Location: Tilburg, The Netherlands

Postby Johnny_Bit » January 19th, 2005, 3:56 pm

I quite don't understand...
Johnny_Bit
VIP Member
VIP Member
 
Posts: 455
Joined: June 15th, 2003, 9:56 am

Postby Stefan » January 19th, 2005, 5:34 pm

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...
User avatar
Stefan
Moderator
Moderator
 
Posts: 128
Joined: September 27th, 2004, 9:40 am
Location: Tilburg, The Netherlands


Return to Delphi Programming

Who is online

Users browsing this forum: No registered users and 15 guests

cron