Subversion Repositories filter_foundry

Rev

Rev 193 | Go to most recent revision | Blame | Last modification | View Log | RSS feed

  1. /*  
  2.     This file is part of Curvaceous, a BŽzier drawing demo
  3.     Copyright (C) 1992-2006 Toby Thain, toby@telegraphics.com.au
  4.  
  5.     This program is free software; you can redistribute it and/or modify
  6.     it under the terms of the GNU General Public License as published by  
  7.     the Free Software Foundation; either version 2 of the License, or
  8.     (at your option) any later version.
  9.  
  10.     This program is distributed in the hope that it will be useful,
  11.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.     GNU General Public License for more details.
  14.  
  15.     You should have received a copy of the GNU General Public License  
  16.     along with this program; if not, write to the Free Software
  17.     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  18. */
  19.  
  20. #ifndef CURVETO_H
  21. #define CURVETO_H
  22.  
  23. #ifdef macintosh
  24. #include <quickdraw.h>
  25. #include <fp.h>
  26. #endif
  27.  
  28. #define F(x) ((x)<<16) /* integer as Fixed */
  29. #define I(x) ((x)>>16) /* (truncated) Fixed as integer */
  30. #define P(p) I((p).x),I((p).y)
  31.  
  32. #define FIX_FLOOR I
  33. #define FIX_CEIL(x) I((x)+0xffff)
  34. #define FIX_ROUND(x) I((x)+0x8000)
  35.  
  36. typedef struct{ Fixed x,y; }pt; /* a fixed-point analogue to Point */
  37.  
  38. pt fpt(int x,int y);
  39. void mid(pt *a,pt *b,pt *c);
  40. void curve_bounds_fix(pt c[],Fixed *l,Fixed *t,Fixed *r,Fixed *b);
  41. void curve_bounds(pt c[],Rect *r);
  42. void divide_curve(pt c[],pt z[]);
  43. int sgn(int x);
  44. double sqr(double x);
  45. int curve_step(pt c[],pt z[]);
  46. int curve_step2(pt c[],pt z[],int d);
  47. void curveto(pt c[]);
  48. void curveto_rgn(pt c[],RgnHandle rgn);
  49. Boolean curve_pick(pt c[],pt *p,Fixed tol,Fixed *t);
  50. Boolean curve_pick_step(pt c[],pt *p,Fixed tol,Fixed *param,Fixed p0,Fixed p1);
  51. void mark(pt *p,Boolean f);
  52.  
  53. void curveto2(pt c[],int d);// draw the entire curve described by c[0..3]
  54.  
  55. #endif // CURVETO_H
  56.