1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657
|
.. wxPython Phoenix documentation
This file was generated by Phoenix's sphinx generator and associated
tools, do not edit by hand.
Copyright: (c) 2011-2020 by Total Control Software
License: wxWindows License
.. include:: headings.inc
.. _wx.GraphicsPath:
==========================================================================================================================================
|phoenix_title| **wx.GraphicsPath**
==========================================================================================================================================
A :ref:`wx.GraphicsPath` is a native representation of a geometric path.
The contents are specific and private to the respective renderer. Instances are reference counted and can therefore be assigned as usual. The only way to get a valid instance is by using :meth:`wx.GraphicsContext.CreatePath` or :meth:`wx.GraphicsRenderer.CreatePath` .
|
|class_hierarchy| Class Hierarchy
=================================
.. raw:: html
<div id="toggleBlock" onclick="return toggleVisibility(this)" class="closed" style="cursor:pointer;">
<img id="toggleBlock-trigger" src="_static/images/closed.png"/>
Inheritance diagram for class <strong>GraphicsPath</strong>:
</div>
<div id="toggleBlock-summary" style="display:block;"></div>
<div id="toggleBlock-content" style="display:none;">
<p class="graphviz">
<center><img src="_static/images/inheritance/wx.GraphicsPath_inheritance.png" alt="Inheritance diagram of GraphicsPath" usemap="#dummy" class="inheritance"/></center>
<script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
<map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.GraphicsPath.html" title="wx.GraphicsPath" alt="" coords="12,160,143,189"/> <area shape="rect" id="node2" href="wx.GraphicsObject.html" title="wx.GraphicsObject" alt="" coords="5,83,149,112"/> <area shape="rect" id="node3" href="wx.Object.html" title="wx.Object" alt="" coords="34,5,121,35"/> </map>
</p>
</div>
|
|method_summary| Methods Summary
================================
================================================================================ ================================================================================
:meth:`~wx.GraphicsPath.AddArc` Adds an arc of a circle.
:meth:`~wx.GraphicsPath.AddArcToPoint` Adds an arc (of a circle with radius `r`) that is tangent to the line connecting current point and (`x1`, `y1`) and to the line connecting (`x1`, `y1`) and (`x2`, `y2`).
:meth:`~wx.GraphicsPath.AddCircle` Appends a circle around (`x`,`y`) with radius `r` as a new closed subpath.
:meth:`~wx.GraphicsPath.AddCurveToPoint` Adds a cubic bezier curve from the current point, using two control points and an end point.
:meth:`~wx.GraphicsPath.AddEllipse` Appends an ellipse fitting into the passed in rectangle as a new closed subpath.
:meth:`~wx.GraphicsPath.AddLineToPoint` Adds a straight line from the current point to (`x`,`y`).
:meth:`~wx.GraphicsPath.AddPath` Adds another path onto the current path.
:meth:`~wx.GraphicsPath.AddQuadCurveToPoint` Adds a quadratic bezier curve from the current point, using a control point and an end point.
:meth:`~wx.GraphicsPath.AddRectangle` Appends a rectangle as a new closed subpath.
:meth:`~wx.GraphicsPath.AddRoundedRectangle` Appends a rounded rectangle as a new closed subpath.
:meth:`~wx.GraphicsPath.CloseSubpath` Closes the current sub-path.
:meth:`~wx.GraphicsPath.Contains`
:meth:`~wx.GraphicsPath.GetBox` Gets the bounding box enclosing all points (possibly including control points).
:meth:`~wx.GraphicsPath.GetCurrentPoint` Gets the last point of the current path, (0,0) if not yet set.
:meth:`~wx.GraphicsPath.GetNativePath` Returns the native path (CGPathRef for Core Graphics, Path pointer for GDIPlus and a cairo_path_t pointer for cairo).
:meth:`~wx.GraphicsPath.MoveToPoint` Begins a new subpath at (`x`,`y`).
:meth:`~wx.GraphicsPath.Transform` Transforms each point of this path by the matrix.
:meth:`~wx.GraphicsPath.UnGetNativePath` Gives back the native path returned by :meth:`~GraphicsPath.GetNativePath` because there might be some deallocations necessary (e.g.
================================================================================ ================================================================================
|
|property_summary| Properties Summary
=====================================
================================================================================ ================================================================================
:attr:`~wx.GraphicsPath.Box` See :meth:`~wx.GraphicsPath.GetBox`
:attr:`~wx.GraphicsPath.CurrentPoint` See :meth:`~wx.GraphicsPath.GetCurrentPoint`
:attr:`~wx.GraphicsPath.NativePath` See :meth:`~wx.GraphicsPath.GetNativePath`
================================================================================ ================================================================================
|
|api| Class API
===============
.. class:: wx.GraphicsPath(GraphicsObject)
A GraphicsPath is a native representation of a geometric path.
.. method:: AddArc(self, *args, **kw)
Adds an arc of a circle.
The circle is defined by the coordinates of its centre (`x`, `y`) or `c` and its radius `r`. The arc goes from the starting angle `startAngle` to `endAngle` either clockwise or counter-clockwise depending on the value of `clockwise` argument.
The angles are measured in radians but, contrary to the usual mathematical convention, are always `clockwise` from the horizontal axis.
If for clockwise arc `endAngle` is less than `startAngle` it will be progressively increased by 2pi until it is greater than `startAngle`. If for counter-clockwise arc `endAngle` is greater than `startAngle` it will be progressively decreased by 2pi until it is less than `startAngle`.
If there is a current point set, an initial line segment will be added to the path to connect the current point to the beginning of the arc.
|overload| Overloaded Implementations:
:html:`<hr class="overloadsep" /><br />`
**AddArc** `(self, x, y, r, startAngle, endAngle, clockwise)`
:param `x`:
:type `x`: wx.Double
:param `y`:
:type `y`: wx.Double
:param `r`:
:type `r`: wx.Double
:param `startAngle`:
:type `startAngle`: wx.Double
:param `endAngle`:
:type `endAngle`: wx.Double
:param `clockwise`:
:type `clockwise`: bool
:html:`<hr class="overloadsep" /><br />`
**AddArc** `(self, c, r, startAngle, endAngle, clockwise)`
:param `c`:
:type `c`: wx.Point2D
:param `r`:
:type `r`: wx.Double
:param `startAngle`:
:type `startAngle`: wx.Double
:param `endAngle`:
:type `endAngle`: wx.Double
:param `clockwise`:
:type `clockwise`: bool
:html:`<hr class="overloadsep" /><br />`
.. method:: AddArcToPoint(self, x1, y1, x2, y2, r)
Adds an arc (of a circle with radius `r`) that is tangent to the line connecting current point and (`x1`, `y1`) and to the line connecting (`x1`, `y1`) and (`x2`, `y2`).
If the current point and the starting point of the arc are different, a straight line connecting these points is also appended. If there is no current point before the call to :meth:`AddArcToPoint` this function will behave as if preceded by a call to MoveToPoint(0, 0). After this call the current point will be at the ending point of the arc.
.. figure:: _static/images/overviews/drawing-addarctopoint.png
:align: center
|
:param `x1`:
:type `x1`: wx.Double
:param `y1`:
:type `y1`: wx.Double
:param `x2`:
:type `x2`: wx.Double
:param `y2`:
:type `y2`: wx.Double
:param `r`:
:type `r`: wx.Double
.. method:: AddCircle(self, x, y, r)
Appends a circle around (`x`,`y`) with radius `r` as a new closed subpath.
After this call the current point will be at ( `x+` `r` `,` `y`).
:param `x`:
:type `x`: wx.Double
:param `y`:
:type `y`: wx.Double
:param `r`:
:type `r`: wx.Double
.. method:: AddCurveToPoint(self, *args, **kw)
|overload| Overloaded Implementations:
:html:`<hr class="overloadsep" /><br />`
**AddCurveToPoint** `(self, cx1, cy1, cx2, cy2, x, y)`
Adds a cubic bezier curve from the current point, using two control points and an end point.
If there is no current point before the call to :meth:`AddCurveToPoint` this function will behave as if preceded by a call to MoveToPoint(`cx1`, `cy1`).
:param `cx1`:
:type `cx1`: wx.Double
:param `cy1`:
:type `cy1`: wx.Double
:param `cx2`:
:type `cx2`: wx.Double
:param `cy2`:
:type `cy2`: wx.Double
:param `x`:
:type `x`: wx.Double
:param `y`:
:type `y`: wx.Double
:html:`<hr class="overloadsep" /><br />`
**AddCurveToPoint** `(self, c1, c2, e)`
Adds a cubic bezier curve from the current point, using two control points and an end point.
If there is no current point before the call to :meth:`AddCurveToPoint` this function will behave as if preceded by a call to MoveToPoint(`c1`).
:param `c1`:
:type `c1`: wx.Point2D
:param `c2`:
:type `c2`: wx.Point2D
:param `e`:
:type `e`: wx.Point2D
:html:`<hr class="overloadsep" /><br />`
.. method:: AddEllipse(self, x, y, w, h)
Appends an ellipse fitting into the passed in rectangle as a new closed subpath.
After this call the current point will be at ( `x+` `w` `,` `y+` `h/2` `)` .
:param `x`:
:type `x`: wx.Double
:param `y`:
:type `y`: wx.Double
:param `w`:
:type `w`: wx.Double
:param `h`:
:type `h`: wx.Double
.. method:: AddLineToPoint(self, *args, **kw)
|overload| Overloaded Implementations:
:html:`<hr class="overloadsep" /><br />`
**AddLineToPoint** `(self, x, y)`
Adds a straight line from the current point to (`x`,`y`).
If current point is not yet set before the call to :meth:`AddLineToPoint` this function will behave as :meth:`MoveToPoint` .
:param `x`:
:type `x`: wx.Double
:param `y`:
:type `y`: wx.Double
:html:`<hr class="overloadsep" /><br />`
**AddLineToPoint** `(self, p)`
Adds a straight line from the current point to `p`.
If current point is not yet set before the call to :meth:`AddLineToPoint` this function will behave as :meth:`MoveToPoint` .
:param `p`:
:type `p`: wx.Point2D
:html:`<hr class="overloadsep" /><br />`
.. method:: AddPath(self, path)
Adds another path onto the current path.
After this call the current point will be at the added path's current point. For Direct2D the path being appended shouldn't contain a started non-empty subpath when this function is called.
:param `path`:
:type `path`: wx.GraphicsPath
.. method:: AddQuadCurveToPoint(self, cx, cy, x, y)
Adds a quadratic bezier curve from the current point, using a control point and an end point.
If there is no current point before the call to :meth:`AddQuadCurveToPoint` this function will behave as if preceded by a call to MoveToPoint(`cx`, `cy`).
:param `cx`:
:type `cx`: wx.Double
:param `cy`:
:type `cy`: wx.Double
:param `x`:
:type `x`: wx.Double
:param `y`:
:type `y`: wx.Double
.. method:: AddRectangle(self, x, y, w, h)
Appends a rectangle as a new closed subpath.
After this call the current point will be at (`x`, `y`).
:param `x`:
:type `x`: wx.Double
:param `y`:
:type `y`: wx.Double
:param `w`:
:type `w`: wx.Double
:param `h`:
:type `h`: wx.Double
.. method:: AddRoundedRectangle(self, x, y, w, h, radius)
Appends a rounded rectangle as a new closed subpath.
If `radius` equals 0 this function will behave as :meth:`AddRectangle` , otherwise after this call the current point will be at ( `x+` `w` `,` `y+` `h/2` `)` .
:param `x`:
:type `x`: wx.Double
:param `y`:
:type `y`: wx.Double
:param `w`:
:type `w`: wx.Double
:param `h`:
:type `h`: wx.Double
:param `radius`:
:type `radius`: wx.Double
.. method:: CloseSubpath(self)
Closes the current sub-path.
After this call the current point will be at the joined endpoint of the sub-path.
.. method:: Contains(self, *args, **kw)
:returns:
``True`` if the point is within the path.
|overload| Overloaded Implementations:
:html:`<hr class="overloadsep" /><br />`
**Contains** `(self, c, fillStyle=ODDEVEN_RULE)`
:param `c`:
:type `c`: wx.Point2D
:param `fillStyle`:
:type `fillStyle`: wx.PolygonFillMode
:rtype: `bool`
:html:`<hr class="overloadsep" /><br />`
**Contains** `(self, x, y, fillStyle=ODDEVEN_RULE)`
:param `x`:
:type `x`: wx.Double
:param `y`:
:type `y`: wx.Double
:param `fillStyle`:
:type `fillStyle`: wx.PolygonFillMode
:rtype: `bool`
:html:`<hr class="overloadsep" /><br />`
.. method:: GetBox(self)
Gets the bounding box enclosing all points (possibly including control points).
:rtype: :ref:`wx.Rect2D`
.. method:: GetCurrentPoint(self)
Gets the last point of the current path, (0,0) if not yet set.
:rtype: :ref:`wx.Point2D`
.. method:: GetNativePath(self)
Returns the native path (CGPathRef for Core Graphics, Path pointer for GDIPlus and a cairo_path_t pointer for cairo).
.. method:: MoveToPoint(self, *args, **kw)
|overload| Overloaded Implementations:
:html:`<hr class="overloadsep" /><br />`
**MoveToPoint** `(self, x, y)`
Begins a new subpath at (`x`,`y`).
:param `x`:
:type `x`: wx.Double
:param `y`:
:type `y`: wx.Double
:html:`<hr class="overloadsep" /><br />`
**MoveToPoint** `(self, p)`
Begins a new subpath at `p`.
:param `p`:
:type `p`: wx.Point2D
:html:`<hr class="overloadsep" /><br />`
.. method:: Transform(self, matrix)
Transforms each point of this path by the matrix.
For Direct2D the current path shouldn't contain a started non-empty subpath when this function is called.
:param `matrix`:
:type `matrix`: wx.GraphicsMatrix
.. method:: UnGetNativePath(self, p)
Gives back the native path returned by :meth:`GetNativePath` because there might be some deallocations necessary (e.g.
on cairo the native path returned by :meth:`GetNativePath` is newly allocated each time).
:param `p`:
.. attribute:: Box
See :meth:`~wx.GraphicsPath.GetBox`
.. attribute:: CurrentPoint
See :meth:`~wx.GraphicsPath.GetCurrentPoint`
.. attribute:: NativePath
See :meth:`~wx.GraphicsPath.GetNativePath`
|