]>
Commit | Line | Data |
---|---|---|
6d61d718 RD |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: _graphics.i | |
3 | // Purpose: Wrapper definitions for wx.GraphicsPath, wx.GraphicsContext | |
4 | // | |
5 | // Author: Robin Dunn | |
6 | // | |
7 | // Created: 2-Oct-2006 | |
8 | // RCS-ID: $Id$ | |
9 | // Copyright: (c) 2006 by Total Control Software | |
10 | // Licence: wxWindows license | |
11 | ///////////////////////////////////////////////////////////////////////////// | |
12 | ||
13 | // Not a %module | |
14 | ||
15 | ||
16 | //--------------------------------------------------------------------------- | |
17 | %newgroup | |
18 | ||
19 | %{ | |
20 | #include <wx/graphics.h> | |
21 | %} | |
22 | ||
281c54cc RD |
23 | // Turn off the aquisition of the Global Interpreter Lock for the classes and |
24 | // functions in this file | |
25 | %threadWrapperOff | |
26 | ||
6d61d718 RD |
27 | //--------------------------------------------------------------------------- |
28 | ||
29 | ||
30 | %{ | |
31 | #if !wxUSE_GRAPHICS_CONTEXT | |
32 | // C++ stub classes for platforms that don't have wxGraphicsContext yet. | |
33 | ||
34 | class wxGraphicsPath | |
35 | { | |
36 | public : | |
37 | wxGraphicsPath() { | |
38 | wxPyBlock_t blocked = wxPyBeginBlockThreads(); | |
39 | PyErr_SetString(PyExc_NotImplementedError, | |
40 | "wxGraphicsPath is not available on this platform."); | |
41 | wxPyEndBlockThreads(blocked); | |
42 | } | |
43 | virtual ~wxGraphicsPath() {} | |
44 | ||
45 | void MoveToPoint( wxDouble, wxDouble ) {} | |
46 | void AddLineToPoint( wxDouble, wxDouble ) {} | |
47 | void AddCurveToPoint( wxDouble, wxDouble, wxDouble, wxDouble, wxDouble, wxDouble ) {} | |
48 | void CloseSubpath() {} | |
49 | void GetCurrentPoint( wxDouble&, wxDouble&) {} | |
50 | void AddArc( wxDouble, wxDouble, wxDouble, wxDouble, wxDouble, bool ) {} | |
51 | ||
52 | void AddQuadCurveToPoint( wxDouble, wxDouble, wxDouble, wxDouble ) {} | |
53 | void AddRectangle( wxDouble, wxDouble, wxDouble, wxDouble ) {} | |
54 | void AddCircle( wxDouble, wxDouble, wxDouble ) {} | |
55 | void AddArcToPoint( wxDouble, wxDouble , wxDouble, wxDouble, wxDouble ) {} | |
56 | ||
57 | wxPoint2DDouble GetCurrentPoint() { return wxPoint2DDouble(0,0); } | |
58 | void MoveToPoint( const wxPoint2DDouble& ) {} | |
59 | void AddLineToPoint( const wxPoint2DDouble&) {} | |
60 | void AddCurveToPoint( const wxPoint2DDouble&, const wxPoint2DDouble&, const wxPoint2DDouble&) {} | |
61 | void AddArc( const wxPoint2DDouble&, wxDouble, wxDouble, wxDouble, bool) {} | |
62 | }; | |
63 | ||
64 | ||
65 | class wxGraphicsContext | |
66 | { | |
67 | public: | |
68 | wxGraphicsContext() { | |
69 | wxPyBlock_t blocked = wxPyBeginBlockThreads(); | |
70 | PyErr_SetString(PyExc_NotImplementedError, | |
71 | "wxGraphicsContext is not available on this platform."); | |
72 | wxPyEndBlockThreads(blocked); | |
73 | } | |
74 | virtual ~wxGraphicsContext() {} | |
75 | ||
76 | static wxGraphicsContext* Create( const wxWindowDC&) { | |
77 | wxPyBlock_t blocked = wxPyBeginBlockThreads(); | |
78 | PyErr_SetString(PyExc_NotImplementedError, | |
79 | "wxGraphicsPath is not available on this platform."); | |
80 | wxPyEndBlockThreads(blocked); | |
81 | return NULL; | |
82 | } | |
b876c1e4 RD |
83 | |
84 | static wxGraphicsContext* CreateFromNative( void * ) { | |
85 | wxPyBlock_t blocked = wxPyBeginBlockThreads(); | |
86 | PyErr_SetString(PyExc_NotImplementedError, | |
87 | "wxGraphicsContext is not available on this platform."); | |
88 | wxPyEndBlockThreads(blocked); | |
89 | return NULL; | |
90 | } | |
91 | ||
050441c8 | 92 | wxGraphicsPath * CreatePath() { return NULL; } |
6d61d718 RD |
93 | void PushState() {} |
94 | void PopState() {} | |
95 | void Clip( const wxRegion & ) {} | |
b876c1e4 RD |
96 | void Clip( wxDouble, wxDouble, wxDouble, wxDouble ) {} |
97 | void ResetClip() {} | |
98 | void * GetNativeContext() { return NULL; } | |
6d61d718 RD |
99 | void Translate( wxDouble , wxDouble ) {} |
100 | void Scale( wxDouble , wxDouble ) {} | |
101 | void Rotate( wxDouble ) {} | |
102 | void SetPen( const wxPen & ) {} | |
103 | void SetBrush( const wxBrush & ) {} | |
104 | void SetLinearGradientBrush( wxDouble , wxDouble , wxDouble , wxDouble , | |
105 | const wxColour&, const wxColour&) {} | |
106 | void SetRadialGradientBrush( wxDouble , wxDouble , wxDouble , wxDouble , wxDouble , | |
107 | const wxColour &, const wxColour &) {} | |
108 | void SetFont( const wxFont & ) {} | |
2742805a | 109 | void SetTextColour( const wxColour & ) {} |
6d61d718 RD |
110 | void StrokePath( const wxGraphicsPath * ) {} |
111 | void FillPath( const wxGraphicsPath *, int ) {} | |
112 | void DrawPath( const wxGraphicsPath *, int ) {} | |
113 | void DrawText( const wxString &, wxDouble , wxDouble ) {} | |
114 | void DrawText( const wxString &, wxDouble , wxDouble , wxDouble ) {} | |
115 | void GetTextExtent( const wxString &, wxDouble *, wxDouble *, | |
116 | wxDouble *, wxDouble * ) const {} | |
117 | void GetPartialTextExtents(const wxString& , wxArrayDouble& ) const {} | |
118 | void DrawBitmap( const wxBitmap &, wxDouble , wxDouble , wxDouble , wxDouble ) {} | |
119 | void DrawIcon( const wxIcon &, wxDouble , wxDouble , wxDouble , wxDouble ) {} | |
120 | void StrokeLine( wxDouble , wxDouble , wxDouble , wxDouble ) {} | |
121 | void StrokeLines( size_t , const wxPoint2DDouble *) {} | |
122 | void StrokeLines( size_t , const wxPoint2DDouble *, const wxPoint2DDouble *) {} | |
123 | void DrawLines( size_t , const wxPoint2DDouble *, int ) {} | |
124 | void DrawRectangle( wxDouble , wxDouble , wxDouble , wxDouble ) {} | |
125 | void DrawEllipse( wxDouble , wxDouble, wxDouble , wxDouble) {} | |
126 | void DrawRoundedRectangle( wxDouble , wxDouble , wxDouble , wxDouble , wxDouble ) {} | |
127 | }; | |
128 | ||
129 | ||
130 | class wxGCDC: public wxWindowDC | |
131 | { | |
132 | public: | |
133 | wxGCDC(const wxWindowDC&) { | |
134 | wxPyBlock_t blocked = wxPyBeginBlockThreads(); | |
135 | PyErr_SetString(PyExc_NotImplementedError, | |
136 | "wxGCDC is not available on this platform."); | |
137 | wxPyEndBlockThreads(blocked); | |
138 | } | |
139 | ||
140 | wxGCDC() { | |
141 | wxPyBlock_t blocked = wxPyBeginBlockThreads(); | |
142 | PyErr_SetString(PyExc_NotImplementedError, | |
143 | "wxGCDC is not available on this platform."); | |
144 | wxPyEndBlockThreads(blocked); | |
145 | } | |
146 | ||
147 | virtual ~wxGCDC() {} | |
148 | ||
b876c1e4 RD |
149 | wxGraphicsContext* GetGraphicsContext() { return NULL; } |
150 | void SetGraphicsContext( wxGraphicsContext* ) {} | |
6d61d718 RD |
151 | }; |
152 | ||
153 | #endif | |
154 | %} | |
155 | ||
156 | //--------------------------------------------------------------------------- | |
157 | //--------------------------------------------------------------------------- | |
158 | ||
281c54cc RD |
159 | |
160 | %typemap(in) (size_t points, wxPoint2D* points_array ) { | |
161 | $2 = wxPoint2D_LIST_helper($input, &$1); | |
162 | if ($2 == NULL) SWIG_fail; | |
163 | } | |
164 | %typemap(freearg) (size_t points, wxPoint2D* points_array ) { | |
165 | if ($2) delete [] $2; | |
166 | } | |
167 | ||
168 | ||
169 | ||
6d61d718 RD |
170 | MustHaveApp(wxGraphicsPath); |
171 | MustHaveApp(wxGraphicsContext); | |
172 | MustHaveApp(wxGCDC); | |
173 | ||
174 | //#define wxDouble double | |
175 | typedef double wxDouble; | |
176 | ||
177 | ||
178 | // TODO: Decide which of the overloaded methods should use the primary names | |
179 | ||
180 | class wxGraphicsPath | |
181 | { | |
182 | public : | |
183 | //wxGraphicsPath(); *** This class is an ABC, so we can't allow instances to be created directly | |
184 | virtual ~wxGraphicsPath(); | |
185 | ||
186 | ||
187 | DocDeclStr( | |
188 | virtual void , MoveToPoint( wxDouble x, wxDouble y ), | |
189 | "Begins a new subpath at (x,y)", ""); | |
190 | // void MoveToPoint( const wxPoint2D& p); | |
191 | ||
192 | ||
193 | DocDeclStr( | |
194 | virtual void , AddLineToPoint( wxDouble x, wxDouble y ), | |
195 | "Adds a straight line from the current point to (x,y) ", ""); | |
196 | // void AddLineToPoint( const wxPoint2D& p); | |
197 | ||
198 | ||
199 | DocDeclStr( | |
200 | virtual void , AddCurveToPoint( wxDouble cx1, wxDouble cy1, | |
201 | wxDouble cx2, wxDouble cy2, | |
202 | wxDouble x, wxDouble y ), | |
203 | "Adds a cubic Bezier curve from the current point, using two control | |
204 | points and an end point", ""); | |
205 | // void AddCurveToPoint( const wxPoint2D& c1, const wxPoint2D& c2, const wxPoint2D& e); | |
206 | ||
207 | ||
208 | DocDeclStr( | |
209 | virtual void , CloseSubpath(), | |
210 | "closes the current sub-path", ""); | |
211 | ||
212 | ||
213 | //virtual void , GetCurrentPoint( wxDouble& x, wxDouble&y), | |
214 | DocDeclStr( | |
215 | wxPoint2D , GetCurrentPoint(), | |
216 | "Gets the last point of the current path, (0,0) if not yet set", ""); | |
217 | ||
218 | ||
219 | DocDeclStr( | |
220 | virtual void , AddArc( wxDouble x, wxDouble y, wxDouble r, | |
221 | wxDouble startAngle, wxDouble endAngle, bool clockwise ), | |
222 | "Adds an arc of a circle centering at (x,y) with radius (r) from | |
223 | startAngle to endAngle", ""); | |
224 | // void AddArc( const wxPoint2D& c, wxDouble r, wxDouble startAngle, wxDouble endAngle, bool clockwise); | |
225 | ||
226 | ||
227 | DocDeclStr( | |
228 | virtual void , AddQuadCurveToPoint( wxDouble cx, wxDouble cy, wxDouble x, wxDouble y ), | |
229 | "Adds a quadratic Bezier curve from the current point, using a control | |
230 | point and an end point", ""); | |
231 | ||
232 | ||
233 | DocDeclStr( | |
234 | virtual void , AddRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h ), | |
235 | "Appends a rectangle as a new closed subpath", ""); | |
236 | ||
237 | ||
238 | DocDeclStr( | |
239 | virtual void , AddCircle( wxDouble x, wxDouble y, wxDouble r ), | |
281c54cc | 240 | "Appends a circle as a new closed subpath with the given radius.", ""); |
6d61d718 RD |
241 | |
242 | ||
243 | DocDeclStr( | |
244 | virtual void , AddArcToPoint( wxDouble x1, wxDouble y1 , wxDouble x2, wxDouble y2, wxDouble r ) , | |
245 | "Draws a an arc to two tangents connecting (current) to (x1,y1) and (x1,y1) | |
246 | to (x2,y2), also a straight line from (current) to (x1,y1)", ""); | |
247 | ||
248 | ||
249 | }; | |
250 | ||
8292b82b RD |
251 | //--------------------------------------------------------------------------- |
252 | ||
253 | /* | |
254 | class wxGraphicsMatrix | |
255 | { | |
256 | public : | |
257 | wxGraphicsMatrix() {} | |
258 | ||
259 | virtual ~wxGraphicsMatrix() {} | |
260 | ||
261 | wxGraphicsMatrix* Concat( const wxGraphicsMatrix *t ) const; | |
262 | ||
263 | // returns the inverse matrix | |
264 | wxGraphicsMatrix* Invert() const; | |
265 | ||
266 | // returns true if the elements of the transformation matrix are equal ? | |
267 | bool operator==(const wxGraphicsMatrix& t) const; | |
268 | ||
269 | // return true if this is the identity matrix | |
270 | bool IsIdentity(); | |
271 | ||
272 | // | |
273 | // transformation | |
274 | // | |
275 | ||
276 | // translate | |
277 | virtual void Translate( wxDouble dx , wxDouble dy ) = 0; | |
278 | ||
279 | // scale | |
280 | virtual void Scale( wxDouble xScale , wxDouble yScale ) = 0; | |
281 | ||
282 | // rotate (radians) | |
283 | virtual void Rotate( wxDouble angle ) = 0; | |
284 | } ; | |
285 | */ | |
286 | ||
287 | ||
6d61d718 RD |
288 | //--------------------------------------------------------------------------- |
289 | ||
290 | ||
291 | class wxGraphicsContext | |
292 | { | |
293 | public: | |
294 | // wxGraphicsContext() This is also an ABC, use Create to make an instance... | |
295 | virtual ~wxGraphicsContext(); | |
8292b82b | 296 | |
2742805a | 297 | %newobject Create; |
8292b82b | 298 | %nokwargs Create; |
2742805a RD |
299 | %pythonAppend Create |
300 | "val.__dc = args[0] # save a ref so the dc will not be deleted before self"; | |
6d61d718 | 301 | static wxGraphicsContext* Create( const wxWindowDC& dc); |
8292b82b RD |
302 | |
303 | static wxGraphicsContext* Create( wxWindow* window ) ; | |
304 | ||
2742805a | 305 | %newobject CreateFromNative; |
8292b82b RD |
306 | static wxGraphicsContext* CreateFromNative( void * context ) ; |
307 | ||
6d61d718 | 308 | |
2742805a | 309 | %newobject CreatePath; |
6d61d718 RD |
310 | // creates a path instance that corresponds to the type of graphics context, ie GDIPlus, cairo, CoreGraphics ... |
311 | DocDeclStr( | |
312 | virtual wxGraphicsPath * , CreatePath(), | |
313 | "", ""); | |
314 | ||
8292b82b RD |
315 | /* |
316 | // create a 'native' matrix corresponding to these values | |
317 | virtual wxGraphicsMatrix* CreateMatrix( wxDouble a=1.0, wxDouble b=0.0, | |
318 | wxDouble c=0.0, wxDouble d=1.0, | |
319 | wxDouble tx=0.0, wxDouble ty=0.0) = 0; | |
320 | */ | |
6d61d718 | 321 | |
8292b82b | 322 | |
6d61d718 RD |
323 | // push the current state of the context, ie the transformation matrix on a stack |
324 | DocDeclStr( | |
325 | virtual void , PushState(), | |
326 | "", ""); | |
327 | ||
328 | ||
329 | // pops a stored state from the stack | |
330 | DocDeclStr( | |
331 | virtual void , PopState(), | |
332 | "", ""); | |
333 | ||
334 | ||
335 | // clips drawings to the region | |
8292b82b | 336 | DocDeclStrName( |
6d61d718 | 337 | virtual void , Clip( const wxRegion ®ion ), |
8292b82b RD |
338 | "", "", |
339 | ClipRegion); | |
340 | ||
341 | // clips drawings to the rect | |
342 | DocDeclStr( | |
343 | virtual void , Clip( wxDouble x, wxDouble y, wxDouble w, wxDouble h ), | |
344 | "", ""); | |
345 | ||
346 | ||
347 | // resets the clipping to original extent | |
348 | DocDeclStr( | |
349 | virtual void , ResetClip(), | |
6d61d718 RD |
350 | "", ""); |
351 | ||
352 | ||
8292b82b RD |
353 | // returns the native context |
354 | DocDeclStr( | |
355 | virtual void * , GetNativeContext(), | |
356 | "", ""); | |
357 | ||
358 | ||
359 | ||
6d61d718 | 360 | // |
8292b82b | 361 | // transformation: changes the current transformation matrix CTM of the context |
6d61d718 RD |
362 | // |
363 | ||
364 | // translate | |
365 | DocDeclStr( | |
366 | virtual void , Translate( wxDouble dx , wxDouble dy ), | |
367 | "", ""); | |
368 | ||
369 | ||
370 | // scale | |
371 | DocDeclStr( | |
372 | virtual void , Scale( wxDouble xScale , wxDouble yScale ), | |
373 | "", ""); | |
374 | ||
375 | ||
376 | // rotate (radians) | |
377 | DocDeclStr( | |
378 | virtual void , Rotate( wxDouble angle ), | |
379 | "", ""); | |
380 | ||
381 | ||
382 | // | |
383 | // setting the paint | |
384 | // | |
385 | ||
386 | // sets the pan | |
387 | DocDeclStr( | |
388 | virtual void , SetPen( const wxPen &pen ), | |
389 | "", ""); | |
390 | ||
391 | ||
392 | // sets the brush for filling | |
393 | DocDeclStr( | |
394 | virtual void , SetBrush( const wxBrush &brush ), | |
395 | "", ""); | |
396 | ||
397 | ||
398 | // sets the brush to a linear gradient, starting at (x1,y1) with color c1 to (x2,y2) with color c2 | |
399 | DocDeclStr( | |
400 | virtual void , SetLinearGradientBrush( wxDouble x1, wxDouble y1, wxDouble x2, wxDouble y2, | |
401 | const wxColour&c1, const wxColour&c2), | |
402 | "", ""); | |
403 | ||
404 | ||
2742805a RD |
405 | // sets the brush to a radial gradient originating at (xo,yc) with color oColour and ends on a circle around (xc,yc) |
406 | // with radius r and color cColour | |
6d61d718 RD |
407 | DocDeclStr( |
408 | virtual void , SetRadialGradientBrush( wxDouble xo, wxDouble yo, wxDouble xc, wxDouble yc, | |
409 | wxDouble radius, | |
2742805a | 410 | const wxColour &oColour, const wxColour &cColour), |
6d61d718 RD |
411 | "", ""); |
412 | ||
413 | ||
414 | // sets the font | |
415 | DocDeclStr( | |
416 | virtual void , SetFont( const wxFont &font ), | |
417 | "", ""); | |
418 | ||
419 | ||
420 | // sets the text color | |
421 | DocDeclStr( | |
2742805a | 422 | virtual void , SetTextColour( const wxColour &col ), |
6d61d718 RD |
423 | "", ""); |
424 | ||
425 | ||
426 | // strokes along a path with the current pen | |
427 | DocDeclStr( | |
428 | virtual void , StrokePath( const wxGraphicsPath *path ), | |
429 | "", ""); | |
430 | ||
431 | ||
432 | // fills a path with the current brush | |
433 | DocDeclStr( | |
434 | virtual void , FillPath( const wxGraphicsPath *path, int fillStyle = wxWINDING_RULE ), | |
435 | "", ""); | |
436 | ||
437 | ||
438 | // draws a path by first filling and then stroking | |
439 | DocDeclStr( | |
440 | virtual void , DrawPath( const wxGraphicsPath *path, int fillStyle = wxWINDING_RULE ), | |
441 | "", ""); | |
442 | ||
443 | ||
444 | // | |
445 | // text | |
446 | // | |
447 | ||
448 | DocDeclStr( | |
449 | virtual void , DrawText( const wxString &str, wxDouble x, wxDouble y ), | |
450 | "", ""); | |
451 | ||
452 | ||
281c54cc | 453 | DocDeclStrName( |
6d61d718 | 454 | virtual void , DrawText( const wxString &str, wxDouble x, wxDouble y, wxDouble angle ), |
281c54cc RD |
455 | "", "", |
456 | DrawRotatedText); | |
6d61d718 RD |
457 | |
458 | ||
752d967c | 459 | DocDeclAStrName( |
6d61d718 RD |
460 | virtual void , GetTextExtent( const wxString &text, |
461 | wxDouble *OUTPUT /*width*/, | |
462 | wxDouble *OUTPUT /*height*/, | |
463 | wxDouble *OUTPUT /*descent*/, | |
464 | wxDouble *OUTPUT /*externalLeading*/ ) const , | |
752d967c RD |
465 | "GetFullTextExtent(self, text) --> (width, height, descent, externalLeading)", |
466 | "", "", | |
467 | GetFullTextExtent); | |
468 | ||
469 | %extend { | |
470 | DocAStr(GetTextExtent, | |
471 | "GetTextExtent(self, text) --> (width, height)", | |
472 | "", ""); | |
473 | ||
474 | PyObject* GetTextExtent( const wxString &text ) | |
475 | { | |
476 | wxDouble width = 0.0, | |
477 | height = 0.0; | |
478 | self->GetTextExtent(text, &width, &height, NULL, NULL); | |
479 | // thread wrapers are turned off for this .i file, so no need to acquire GIL... | |
480 | PyObject* rv = PyTuple_New(2); | |
481 | PyTuple_SET_ITEM(rv, 0, PyFloat_FromDouble(width)); | |
482 | PyTuple_SET_ITEM(rv, 1, PyFloat_FromDouble(height)); | |
483 | return rv; | |
484 | } | |
485 | } | |
6d61d718 RD |
486 | |
487 | ||
281c54cc RD |
488 | %extend { |
489 | DocAStr(GetPartialTextExtents, | |
490 | "GetPartialTextExtents(self, text) -> [widths]", | |
491 | "", ""); | |
492 | wxArrayDouble GetPartialTextExtents(const wxString& text) { | |
493 | wxArrayDouble widths; | |
494 | self->GetPartialTextExtents(text, widths); | |
495 | return widths; | |
496 | } | |
497 | } | |
6d61d718 RD |
498 | |
499 | ||
500 | // | |
501 | // image support | |
502 | // | |
503 | ||
504 | DocDeclStr( | |
505 | virtual void , DrawBitmap( const wxBitmap &bmp, wxDouble x, wxDouble y, wxDouble w, wxDouble h ), | |
506 | "", ""); | |
507 | ||
508 | ||
509 | DocDeclStr( | |
510 | virtual void , DrawIcon( const wxIcon &icon, wxDouble x, wxDouble y, wxDouble w, wxDouble h ), | |
511 | "", ""); | |
512 | ||
513 | ||
514 | // | |
515 | // convenience methods | |
516 | // | |
517 | ||
518 | // strokes a single line | |
519 | DocDeclStr( | |
520 | virtual void , StrokeLine( wxDouble x1, wxDouble y1, wxDouble x2, wxDouble y2), | |
521 | "", ""); | |
6d61d718 | 522 | |
281c54cc | 523 | |
6d61d718 | 524 | // stroke lines connecting each of the points |
281c54cc RD |
525 | DocDeclAStr( |
526 | virtual void , StrokeLines( size_t points, const wxPoint2D *points_array), | |
527 | "StrokeLines(self, List points)", | |
6d61d718 RD |
528 | "", ""); |
529 | ||
530 | ||
281c54cc RD |
531 | // // stroke disconnected lines from begin to end points |
532 | // virtual void StrokeLines( size_t n, const wxPoint2D *beginPoints, const wxPoint2D *endPoints); | |
533 | ||
281c54cc | 534 | %extend { |
aa43bcc7 | 535 | void StrokeLineSegements(PyObject* beginPoints, PyObject* endPoints) |
281c54cc RD |
536 | { |
537 | size_t c1, c2, count; | |
538 | wxPoint2D* beginP = wxPoint2D_LIST_helper(beginPoints, &c1); | |
539 | wxPoint2D* endP = wxPoint2D_LIST_helper(endPoints, &c2); | |
540 | ||
541 | if ( beginP != NULL && endP != NULL ) | |
542 | { | |
543 | count = wxMin(c1, c2); | |
544 | self->StrokeLines(count, beginP, endP); | |
545 | } | |
546 | delete [] beginP; | |
547 | delete [] endP; | |
548 | } | |
549 | } | |
6d61d718 RD |
550 | |
551 | // draws a polygon | |
552 | DocDeclStr( | |
281c54cc | 553 | virtual void , DrawLines( size_t points, const wxPoint2D *points_array, int fillStyle = wxWINDING_RULE ), |
6d61d718 RD |
554 | "", ""); |
555 | ||
556 | ||
557 | // draws a polygon | |
558 | DocDeclStr( | |
559 | virtual void , DrawRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h), | |
560 | "", ""); | |
561 | ||
562 | ||
563 | // draws an ellipse | |
564 | DocDeclStr( | |
565 | virtual void , DrawEllipse( wxDouble x, wxDouble y, wxDouble w, wxDouble h), | |
566 | "", ""); | |
567 | ||
568 | ||
569 | // draws a rounded rectangle | |
570 | DocDeclStr( | |
571 | virtual void , DrawRoundedRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h, wxDouble radius), | |
572 | "", ""); | |
573 | ||
6d61d718 RD |
574 | }; |
575 | ||
576 | ||
577 | //--------------------------------------------------------------------------- | |
578 | ||
6240681f RD |
579 | %{ |
580 | #include "wx/dcgraph.h" | |
581 | %} | |
6d61d718 RD |
582 | |
583 | class wxGCDC: public wxDC | |
584 | { | |
585 | public: | |
0e4e6012 RD |
586 | %pythonAppend wxGCDC |
587 | "self.__dc = args[0] # save a ref so the other dc will not be deleted before self"; | |
6d61d718 RD |
588 | wxGCDC(const wxWindowDC& dc); |
589 | //wxGCDC(); | |
590 | virtual ~wxGCDC(); | |
591 | ||
8292b82b RD |
592 | wxGraphicsContext* GetGraphicsContext(); |
593 | virtual void SetGraphicsContext( wxGraphicsContext* ctx ); | |
594 | ||
595 | %property(GraphicsContext, GetGraphicsContext, SetGraphicsContext); | |
6d61d718 RD |
596 | }; |
597 | ||
598 | ||
281c54cc | 599 | //--------------------------------------------------------------------------- |
6d61d718 | 600 | |
281c54cc RD |
601 | // Turn GIL acquisition back on. |
602 | %threadWrapperOn | |
6d61d718 | 603 |