Package wx :: Package lib :: Package ogl :: Class DrawnShape

[frames | no frames]

## Type DrawnShape

         object --+
                  |
    ShapeEvtHandler --+
                      |
                  Shape --+
                          |
             RectangleShape --+
                              |
                             DrawnShape

Draws a pseudo-metafile shape, which can be loaded from a simple Windows metafile.

wxDrawnShape allows you to specify a different shape for each of four orientations (North, West, South and East). It also provides a set of drawing functions for programmatic drawing of a shape, so that during construction of the shape you can draw into it as if it were a device context.

Derived from:
  RectangleShape

Method Summary
| `__init__(self)`
| ``CalculateSize`(self)` Calculate the wxDrawnShape size from the current metafile.
| ``DestroyClippingRect`(self)` Destroy the clipping rectangle.
| `DetermineMetaFile(self, rotation)`
| ``DrawArc`(self, centrePt, startPt, endPt)` Draw an arc.
| ``DrawAtAngle`(self, angle)` Set the metafile for the given orientation, which can be one of:
| `DrawEllipse(self, rect)`
| ``DrawEllipticArc`(self, rect, startAngle, endAngle)` Draw an elliptic arc.
| `DrawLine(self, pt1, pt2)`
| `DrawLines(self, pts)`
| `DrawPoint(self, pt)`
| ``DrawPolygon`(self, pts, flags)` Draw a polygon.
| `DrawRectangle(self, rect)`
| ``DrawRoundedRectangle`(self, rect, radius)` Draw a rounded rectangle.
| `DrawSpline(self, pts)`
| `DrawText(self, text, pt)`
| ``GetAngle`(self)` Return the current orientation, which can be one of:
| ``GetMetaFile`(self, which)` Return a reference to the internal 'pseudo-metafile'.
| ``GetPerimeterPoint`(self, x1, y1, x2, y2)` Get the point at which the line from (x1, y1) to (x2, y2) hits the shape.
| ``GetRotation`(self)` Return the current rotation of the shape in radians.
| ``LoadFromMetaFile`(self, filename)` Load a (very simple) Windows metafile, created for example by Top Draw, the Windows shareware graphics package.
| `OnDraw(self, dc)`
| `OnDrawOutline(self, dc, x, y, w, h)`
| ``Rotate`(self, x, y, theta)` Rotate about the given axis by the given amount in radians.
| ``Scale`(self, sx, sy)` Scale the shape by the given amount.
| ``SetClippingRect`(self, rect)` Set the clipping rectangle.
| ``SetDrawnBackgroundColour`(self, colour)` Set the current background colour for the current metafile.
| ``SetDrawnBackgroundMode`(self, mode)` Set the current background mode for the current metafile.
| ``SetDrawnBrush`(self, brush, isFill)` Set the brush for this metafile.
| `SetDrawnFont(self, font)`
| ``SetDrawnPen`(self, pen, isOutline)` Set the pen for this metafile.
| ``SetDrawnTextColour`(self, colour)` Set the current text colour for the current metafile.
| ``SetSaveToFile`(self, save)` If save is True, the image will be saved along with the shape's other attributes.
| `SetSize(self, w, h, recursive)`
| ``Translate`(self, x, y)` Translate the shape by the given amount.

Class Variable Summary

Method Details

### CalculateSize(self)

Calculate the wxDrawnShape size from the current metafile.

Call this after you have drawn into the shape.

### DestroyClippingRect(self)

Destroy the clipping rectangle.

### DrawArc(self, centrePt, startPt, endPt)

Draw an arc.

### DrawAtAngle(self, angle)

Set the metafile for the given orientation, which can be one of:

- DRAWN_ANGLE_0
- DRAWN_ANGLE_90
- DRAWN_ANGLE_180
- DRAWN_ANGLE_270

### DrawEllipticArc(self, rect, startAngle, endAngle)

Draw an elliptic arc.

### DrawPolygon(self, pts, flags=0)

Draw a polygon.

flags can be one or more of: METAFLAGS_OUTLINE (use this polygon for the drag outline) and METAFLAGS_ATTACHMENTS (use the vertices of this polygon for attachments).

### DrawRoundedRectangle(self, rect, radius)

Draw a rounded rectangle.

radius is the corner radius. If radius is negative, it expresses the radius as a proportion of the smallest dimension of the rectangle.

### GetAngle(self)

Return the current orientation, which can be one of:

- DRAWN_ANGLE_0
- DRAWN_ANGLE_90
- DRAWN_ANGLE_180
- DRAWN_ANGLE_270

### GetMetaFile(self, which=0)

Return a reference to the internal 'pseudo-metafile'.

### GetPerimeterPoint(self, x1, y1, x2, y2)

Get the point at which the line from (x1, y1) to (x2, y2) hits the shape. Returns False if the line doesn't hit the perimeter.

  Overrides:
    `wx.lib.ogl.RectangleShape.GetPerimeterPoint` (inherited documentation)

### GetRotation(self)

Return the current rotation of the shape in radians.

  Overrides:
    `wx.lib.ogl.Shape.GetRotation`

### LoadFromMetaFile(self, filename)

Load a (very simple) Windows metafile, created for example by Top Draw, the Windows shareware graphics package.

### Rotate(self, x, y, theta)

Rotate about the given axis by the given amount in radians.

  Overrides:
    `wx.lib.ogl.Shape.Rotate`

### Scale(self, sx, sy)

Scale the shape by the given amount.

### SetClippingRect(self, rect)

Set the clipping rectangle.

### SetDrawnBackgroundColour(self, colour)

Set the current background colour for the current metafile.

### SetDrawnBackgroundMode(self, mode)

Set the current background mode for the current metafile.

### SetDrawnBrush(self, brush, isFill=False)

Set the brush for this metafile.

If isFill is True, the brush is used as the fill brush.

### SetDrawnPen(self, pen, isOutline=False)

Set the pen for this metafile.

If isOutline is True, this pen is taken to indicate the outline (and if the outline pen is changed for the whole shape, the pen will be replaced with the outline pen).

### SetDrawnTextColour(self, colour)

Set the current text colour for the current metafile.

### SetSaveToFile(self, save)

If save is True, the image will be saved along with the shape's other attributes. The reason why this might not be desirable is that if there are many shapes with the same image, it would be more efficient for the application to save one copy, and not duplicate the information for every shape. The default is True.

### Translate(self, x, y)

Translate the shape by the given amount.

Generated by Epydoc 2.1.20050511.rpd on Thu Mar 22 12:14:41 2007 | http://epydoc.sf.net