~ubuntu-branches/ubuntu/karmic/fltk1.1/karmic

« back to all changes in this revision

Viewing changes to src/fl_arci.cxx

  • Committer: Bazaar Package Importer
  • Author(s): Aaron M. Ucko
  • Date: 2005-05-22 13:57:06 UTC
  • mfrom: (2.1.1 hoary)
  • Revision ID: james.westby@ubuntu.com-20050522135706-mchag24yf42lu7bu
Tags: 1.1.6-5
* Revert previous change, which seems to have been ineffective for some
  reason, in favor of commenting out the problematic Makefile rule
  altogether.  (Closes: #310151.)
* debian/control: Go back to specifying the URL as part of the
  description rather than via a non-standard field that doesn't seem to
  have caught on.  (Closes: #310240.)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
//
2
 
// "$Id: fl_arci.cxx,v 1.4.2.5.2.5 2004/04/11 04:38:59 easysw Exp $"
 
2
// "$Id: fl_arci.cxx,v 1.4.2.5.2.9 2004/08/27 00:22:28 matthiaswm Exp $"
3
3
//
4
4
// Arc (integer) drawing functions for the Fast Light Tool Kit (FLTK).
5
5
//
38
38
#ifdef WIN32
39
39
#include <FL/math.h>
40
40
#endif
 
41
#ifdef __APPLE__
 
42
#include <config.h>
 
43
#endif
41
44
 
42
45
void fl_arc(int x,int y,int w,int h,double a1,double a2) {
43
46
  if (w <= 0 || h <= 0) return;
47
50
  int xb = x+w/2+int(w*cos(a2/180.0*M_PI));
48
51
  int yb = y+h/2-int(h*sin(a2/180.0*M_PI));
49
52
  Arc(fl_gc, x, y, x+w, y+h, xa, ya, xb, yb); 
50
 
#elif defined(__APPLE__)
 
53
#elif defined(__APPLE_QD__)
51
54
  Rect r; r.left=x; r.right=x+w; r.top=y; r.bottom=y+h;
52
55
  a1 = a2-a1; a2 = 450-a2;
53
56
  FrameArc(&r, (short int)a2, (short int)a1);
 
57
#elif defined(__APPLE_QUARTZ__)
 
58
  a1 = (-a1)/180.0f*M_PI; a2 = (-a2)/180.0f*M_PI;
 
59
  float cx = x + 0.5f*w - 0.5f, cy = y + 0.5f*h - 0.5f;
 
60
  if (w!=h) {
 
61
    CGContextSaveGState(fl_gc);
 
62
    CGContextTranslateCTM(fl_gc, cx, cy);
 
63
    CGContextScaleCTM(fl_gc, w-1.0f, h-1.0f);
 
64
    CGContextAddArc(fl_gc, 0, 0, 0.5, a1, a2, 1);
 
65
    CGContextRestoreGState(fl_gc);
 
66
  } else {
 
67
    float r = (w+h)*0.25f-0.5f;
 
68
    CGContextAddArc(fl_gc, cx, cy, r, a1, a2, 1);
 
69
  }
 
70
  CGContextStrokePath(fl_gc);
54
71
#else
55
72
  XDrawArc(fl_display, fl_window, fl_gc, x,y,w-1,h-1, int(a1*64),int((a2-a1)*64));
56
73
#endif
66
83
  int yb = y+h/2-int(h*sin(a2/180.0*M_PI));
67
84
  SelectObject(fl_gc, fl_brush());
68
85
  Pie(fl_gc, x, y, x+w, y+h, xa, ya, xb, yb); 
69
 
#elif defined(__APPLE__)
 
86
#elif defined(__APPLE_QD__)
70
87
  Rect r; r.left=x; r.right=x+w; r.top=y; r.bottom=y+h;
71
88
  a1 = a2-a1; a2 = 450-a2;
72
89
  PaintArc(&r, (short int)a2, (short int)a1);
 
90
#elif defined(__APPLE_QUARTZ__)
 
91
  a1 = (-a1)/180.0f*M_PI; a2 = (-a2)/180.0f*M_PI;
 
92
  float cx = x + 0.5f*w - 0.5f, cy = y + 0.5f*h - 0.5f;
 
93
  if (w!=h) {
 
94
    CGContextSaveGState(fl_gc);
 
95
    CGContextTranslateCTM(fl_gc, cx, cy);
 
96
    CGContextScaleCTM(fl_gc, w, h);
 
97
    CGContextAddArc(fl_gc, 0, 0, 0.5, a1, a2, 1);
 
98
    CGContextAddLineToPoint(fl_gc, 0, 0);
 
99
    CGContextClosePath(fl_gc);
 
100
    CGContextRestoreGState(fl_gc);
 
101
  } else {
 
102
    float r = (w+h)*0.25f;
 
103
    CGContextAddArc(fl_gc, cx, cy, r, a1, a2, 1);
 
104
    CGContextAddLineToPoint(fl_gc, cx, cy);
 
105
    CGContextClosePath(fl_gc);
 
106
  }
 
107
  CGContextFillPath(fl_gc);
73
108
#else
74
109
  XFillArc(fl_display, fl_window, fl_gc, x,y,w,h, int(a1*64),int((a2-a1)*64));
75
110
#endif
76
111
}
77
112
 
78
113
//
79
 
// End of "$Id: fl_arci.cxx,v 1.4.2.5.2.5 2004/04/11 04:38:59 easysw Exp $".
 
114
// End of "$Id: fl_arci.cxx,v 1.4.2.5.2.9 2004/08/27 00:22:28 matthiaswm Exp $".
80
115
//