]> git.saurik.com Git - wxWidgets.git/blob - src/common/dcbase.cpp
just to resolve a dummy conflict
[wxWidgets.git] / src / common / dcbase.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: dc.cpp
3 // Purpose: wxDC Class
4 // Author: Brian Macy
5 // Modified by:
6 // Created: 05/25/99
7 // RCS-ID: $Id$
8 // Copyright: (c) wxWindows team
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifdef __GNUG__
13 #pragma implementation "dcbase.h"
14 #endif
15
16 // For compilers that support precompilation, includes "wx.h".
17 #include "wx/wxprec.h"
18
19 #ifdef __BORLANDC__
20 #pragma hdrstop
21 #endif
22
23 #ifndef WX_PRECOMP
24 #include "wx/window.h"
25 #endif
26
27 #ifdef __WXMSW__
28 #include "wx/msw/private.h"
29 #endif
30
31 #include "wx/dc.h"
32
33 void wxDCBase::DrawLines(const wxList *list, long xoffset, long yoffset)
34 {
35 int n = list->Number();
36 wxPoint *points = new wxPoint[n];
37
38 int i = 0;
39 for ( wxNode *node = list->First(); node; node = node->Next(), i++ )
40 {
41 wxPoint *point = (wxPoint *)node->Data();
42 points[i].x = point->x;
43 points[i].y = point->y;
44 }
45
46 DoDrawLines(n, points, xoffset, yoffset);
47
48 delete [] points;
49 }
50
51
52 void wxDCBase::DrawPolygon(const wxList *list,
53 long xoffset, long yoffset,
54 int fillStyle)
55 {
56 int n = list->Number();
57 wxPoint *points = new wxPoint[n];
58
59 int i = 0;
60 for ( wxNode *node = list->First(); node; node = node->Next(), i++ )
61 {
62 wxPoint *point = (wxPoint *)node->Data();
63 points[i].x = point->x;
64 points[i].y = point->y;
65 }
66
67 DoDrawPolygon(n, points, xoffset, yoffset, fillStyle);
68
69 delete [] points;
70 }
71
72
73 #if wxUSE_SPLINES
74
75 // TODO: this API needs fixing (wxPointList, why (!const) "wxList *"?)
76 void wxDCBase::DrawSpline(long x1, long y1, long x2, long y2, long x3, long y3)
77 {
78 wxList point_list;
79
80 wxPoint *point1 = new wxPoint;
81 point1->x = x1; point1->y = y1;
82 point_list.Append((wxObject*)point1);
83
84 wxPoint *point2 = new wxPoint;
85 point2->x = x2; point2->y = y2;
86 point_list.Append((wxObject*)point2);
87
88 wxPoint *point3 = new wxPoint;
89 point3->x = x3; point3->y = y3;
90 point_list.Append((wxObject*)point3);
91
92 DrawSpline(&point_list);
93
94 for( wxNode *node = point_list.First(); node; node = node->Next() )
95 {
96 wxPoint *p = (wxPoint *)node->Data();
97 delete p;
98 }
99 }
100
101 void wxDCBase::DrawSpline(int n, wxPoint points[])
102 {
103 wxList list;
104 for (int i =0; i < n; i++)
105 {
106 list.Append((wxObject*)&points[i]);
107 }
108
109 DrawSpline(&list);
110 }
111
112 #endif // wxUSE_SPLINES