]>
git.saurik.com Git - wxWidgets.git/blob - src/common/dcbase.cpp
1 /////////////////////////////////////////////////////////////////////////////
8 // Copyright: (c) wxWindows team
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"
28 #include "wx/msw/private.h"
33 void wxDCBase::DrawLines(const wxList
*list
, wxCoord xoffset
, wxCoord yoffset
)
35 int n
= list
->Number();
36 wxPoint
*points
= new wxPoint
[n
];
39 for ( wxNode
*node
= list
->First(); node
; node
= node
->Next(), i
++ )
41 wxPoint
*point
= (wxPoint
*)node
->Data();
42 points
[i
].x
= point
->x
;
43 points
[i
].y
= point
->y
;
46 DoDrawLines(n
, points
, xoffset
, yoffset
);
52 void wxDCBase::DrawPolygon(const wxList
*list
,
53 wxCoord xoffset
, wxCoord yoffset
,
56 int n
= list
->Number();
57 wxPoint
*points
= new wxPoint
[n
];
60 for ( wxNode
*node
= list
->First(); node
; node
= node
->Next(), i
++ )
62 wxPoint
*point
= (wxPoint
*)node
->Data();
63 points
[i
].x
= point
->x
;
64 points
[i
].y
= point
->y
;
67 DoDrawPolygon(n
, points
, xoffset
, yoffset
, fillStyle
);
75 // TODO: this API needs fixing (wxPointList, why (!const) "wxList *"?)
76 void wxDCBase::DrawSpline(wxCoord x1
, wxCoord y1
, wxCoord x2
, wxCoord y2
, wxCoord x3
, wxCoord y3
)
80 wxPoint
*point1
= new wxPoint
;
81 point1
->x
= x1
; point1
->y
= y1
;
82 point_list
.Append((wxObject
*)point1
);
84 wxPoint
*point2
= new wxPoint
;
85 point2
->x
= x2
; point2
->y
= y2
;
86 point_list
.Append((wxObject
*)point2
);
88 wxPoint
*point3
= new wxPoint
;
89 point3
->x
= x3
; point3
->y
= y3
;
90 point_list
.Append((wxObject
*)point3
);
92 DrawSpline(&point_list
);
94 for( wxNode
*node
= point_list
.First(); node
; node
= node
->Next() )
96 wxPoint
*p
= (wxPoint
*)node
->Data();
101 void wxDCBase::DrawSpline(int n
, wxPoint points
[])
104 for (int i
=0; i
< n
; i
++)
106 list
.Append((wxObject
*)&points
[i
]);
112 #endif // wxUSE_SPLINES