]>
git.saurik.com Git - wxWidgets.git/blob - src/common/dcbase.cpp
1 /////////////////////////////////////////////////////////////////////////////
8 // Copyright: (c) Julian Smart and Markus Holzem
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "dcbase.h"
16 // For compilers that support precompilation, includes "wx.h".
17 #include "wx/wxprec.h"
29 void wxDCBase::DrawLines(const wxList
*list
, long xoffset
, long yoffset
)
31 int n
= list
->Number();
32 wxPoint
*points
= new wxPoint
[n
];
35 for ( wxNode
*node
= list
->First(); node
; node
= node
->Next(), i
++ )
37 wxPoint
*point
= (wxPoint
*)node
->Data();
38 points
[i
].x
= point
->x
;
39 points
[i
].y
= point
->y
;
42 DoDrawLines(n
, points
, xoffset
, yoffset
);
48 void wxDCBase::DrawPolygon(const wxList
*list
,
49 long xoffset
, long yoffset
,
52 int n
= list
->Number();
53 wxPoint
*points
= new wxPoint
[n
];
56 for ( wxNode
*node
= list
->First(); node
; node
= node
->Next(), i
++ )
58 wxPoint
*point
= (wxPoint
*)node
->Data();
59 points
[i
].x
= point
->x
;
60 points
[i
].y
= point
->y
;
63 DoDrawPolygon(n
, points
, xoffset
, yoffset
, fillStyle
);
71 // TODO: this API needs fixing (wxPointList, why (!const) "wxList *"?)
72 void wxDCBase::DrawSpline(long x1
, long y1
, long x2
, long y2
, long x3
, long y3
)
76 wxPoint
*point1
= new wxPoint
;
77 point1
->x
= x1
; point1
->y
= y1
;
78 point_list
.Append((wxObject
*)point1
);
80 wxPoint
*point2
= new wxPoint
;
81 point2
->x
= x2
; point2
->y
= y2
;
82 point_list
.Append((wxObject
*)point2
);
84 wxPoint
*point3
= new wxPoint
;
85 point3
->x
= x3
; point3
->y
= y3
;
86 point_list
.Append((wxObject
*)point3
);
88 DrawSpline(&point_list
);
90 for( wxNode
*node
= point_list
.First(); node
; node
= node
->Next() )
92 wxPoint
*p
= (wxPoint
*)node
->Data();
97 void wxDCBase::DrawSpline(int n
, wxPoint points
[])
100 for (int i
=0; i
< n
; i
++)
102 list
.Append((wxObject
*)&points
[i
]);
108 #endif // wxUSE_SPLINES