]>
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"
24 #include "wx/window.h"
26 #include "wx/msw/private.h"
32 void wxDCBase::DrawLines(const wxList
*list
, long xoffset
, long yoffset
)
34 int n
= list
->Number();
35 wxPoint
*points
= new wxPoint
[n
];
38 for ( wxNode
*node
= list
->First(); node
; node
= node
->Next(), i
++ )
40 wxPoint
*point
= (wxPoint
*)node
->Data();
41 points
[i
].x
= point
->x
;
42 points
[i
].y
= point
->y
;
45 DoDrawLines(n
, points
, xoffset
, yoffset
);
51 void wxDCBase::DrawPolygon(const wxList
*list
,
52 long xoffset
, long yoffset
,
55 int n
= list
->Number();
56 wxPoint
*points
= new wxPoint
[n
];
59 for ( wxNode
*node
= list
->First(); node
; node
= node
->Next(), i
++ )
61 wxPoint
*point
= (wxPoint
*)node
->Data();
62 points
[i
].x
= point
->x
;
63 points
[i
].y
= point
->y
;
66 DoDrawPolygon(n
, points
, xoffset
, yoffset
, fillStyle
);
74 // TODO: this API needs fixing (wxPointList, why (!const) "wxList *"?)
75 void wxDCBase::DrawSpline(long x1
, long y1
, long x2
, long y2
, long x3
, long y3
)
79 wxPoint
*point1
= new wxPoint
;
80 point1
->x
= x1
; point1
->y
= y1
;
81 point_list
.Append((wxObject
*)point1
);
83 wxPoint
*point2
= new wxPoint
;
84 point2
->x
= x2
; point2
->y
= y2
;
85 point_list
.Append((wxObject
*)point2
);
87 wxPoint
*point3
= new wxPoint
;
88 point3
->x
= x3
; point3
->y
= y3
;
89 point_list
.Append((wxObject
*)point3
);
91 DrawSpline(&point_list
);
93 for( wxNode
*node
= point_list
.First(); node
; node
= node
->Next() )
95 wxPoint
*p
= (wxPoint
*)node
->Data();
100 void wxDCBase::DrawSpline(int n
, wxPoint points
[])
103 for (int i
=0; i
< n
; i
++)
105 list
.Append((wxObject
*)&points
[i
]);
111 #endif // wxUSE_SPLINES