Package wx :: Package lib :: Module graphics :: Class GraphicsContext
[frames | no frames]

Type GraphicsContext

    object --+    
             |    
GraphicsObject --+
                 |
                GraphicsContext


The GraphicsContext is the object which facilitates drawing to a surface.


Method Summary
  __init__(self, context)
  Clear(self, colour)
Clear the context using the given color or the currently set brush.
  Clip(self, x, y, w, h)
Adds the rectangle to the current clipping region.
  ClipPath(self, path)
Set the clip region to the path.
  ClipRegion(self, region)
Adds the wx.Region to the current clipping region.
  ConcatTransform(self, matrix)
Modifies the current transformation matrix by applying matrix as an additional transformation.
  Create(dc)
(Static method)
  CreateBrush(self, brush)
Create a brush from a wx.Brush.
  CreateFont(self, font, colour)
Create a font from a wx.Font
  CreateFromNative(cairoContext)
(Static method)
  CreateFromSurface(surface)
Wrap a context around the given cairo Surface. (Static method)
  CreateLinearGradientBrush(self, x1, y1, x2, y2, c1, c2)
Create a gradient brush that morphs from colour c1 at (x1,y1) to colour c2 at (x2,y2).
  CreateMatrix(self, a, b, c, d, tx, ty)
Create a new matrix object.
  CreateMeasuringContext()
(Static method)
  CreatePath(self)
Create a new path obejct.
  CreatePen(self, pen)
Create a new pen from a wx.Pen.
  CreateRadialGradientBrush(self, xo, yo, xc, yc, radius, oColour, cColour)
Creates a brush with a radial gradient originating at (xo,yo) with colour oColour and ends on a circle around (xc,yc) with radius r and colour cColour.
  DrawBitmap(self, bmp, x, y, w, h)
Draw the bitmap at (x,y).
  DrawCircle(self, x, y, radius)
Stroke and fill a circle centered at (x,y) with the given radius, using the current pen and brush.
  DrawEllipse(self, x, y, w, h)
Stroke and fill an elipse that fits in the given rectangle, using the current pen and current brush.
  DrawIcon(self, icon, x, y, w, h)
  DrawLines(self, points, fillStyle)
Stroke and fill a series of connected lines using the current pen and current brush.
  DrawPath(self, path, fillStyle)
Draws the path by first filling it and then stroking it.
  DrawRectangle(self, x, y, w, h)
Stroke and fill a rectangle using the current pen and current brush.
  DrawRotatedText(self, text, x, y, angle, backgroundBrush)
Draw the text at (x,y) using the current font and rotated angle radians.
  DrawRoundedRectangle(self, x, y, w, h, radius)
Stroke and fill a rounded rectangle using the current pen and current brush.
  DrawText(self, text, x, y, backgroundBrush)
Draw the text at (x,y) using the current font.
  FillPath(self, path, fillStyle)
Fills the path using the current brush.
  GetAntialiasMode(self)
Returns the current antialias mode.
  GetCompositingOperator(self)
Returns the current compositing operator for the context.
  GetFulltextExtent(self, text)
Returns the (width, height, descent, externalLeading) of the text using the current font.
  GetLogicalFunction(self)
  GetNativeContext(self)
  GetPartialTextExtents(self, text)
  GetTextExtent(self, text)
Returns the (width, height) of the text using the current font.
  GetTransform(self)
Returns the context's current transformation matrix.
  IsNull(self)
  PopState(self)
Restore the most recently saved state which was saved with PushState.
  PushState(self)
Makes a copy of the current state of the context and saves it on an internal stack of saved states.
  ResetClip(self)
Resets the clipping region to the original shape of the context.
  Rotate(self, angle)
Modifies the current transformation matrix by rotating the user-space axes by angle radians.
  Scale(self, xScale, yScale)
Modifies the current transformation matrix by translating the user-space axes by xScale and yScale.
  SetAntialiasMode(self, mode)
Set the antialiasing mode of the rasterizer used for drawing shapes.
  SetBrush(self, brush)
Set the brush to be used for filling shapes in future drawing operations.
  SetCompositingOperator(self, op)
Sets the compositin operator to be used for all drawing operations.
  SetFont(self, font, colour)
Sets the font to be used for drawing text.
  SetLogicalFunction(self, function)
  SetPen(self, pen)
Set the pen to be used for stroking lines in future drawing operations.
  SetTransform(self, matrix)
Set the context's current transformation matrix to matrix.
  StrokeLine(self, x1, y1, x2, y2)
Strokes a single line using the current pen.
  StrokeLines(self, points)
Stroke a series of conencted lines using the current pen.
  StrokeLineSegments(self, beginPoints, endPoints)
Stroke a series of lines using the current pen.
  StrokePath(self, path)
Strokes the path (draws the lines) using the current pen.
  Translate(self, dx, dy)
Modifies the current transformation matrix by translating the user-space origin by (dx, dy).

Property Summary
  Context

Instance Method Details

Clear(self, colour=None)

Clear the context using the given color or the currently set brush.

Clip(self, x, y, w, h)

Adds the rectangle to the current clipping region. The clipping region causes drawing operations to be limited to the clipped areas of the context.

ClipPath(self, path)

Set the clip region to the path.

ClipRegion(self, region)

Adds the wx.Region to the current clipping region.

ConcatTransform(self, matrix)

Modifies the current transformation matrix by applying matrix as an additional transformation.

CreateBrush(self, brush)

Create a brush from a wx.Brush.

CreateFont(self, font, colour=None)

Create a font from a wx.Font

CreateLinearGradientBrush(self, x1, y1, x2, y2, c1, c2)

Create a gradient brush that morphs from colour c1 at (x1,y1) to colour c2 at (x2,y2).

CreateMatrix(self, a=1.0, b=0, c=0, d=1.0, tx=0, ty=0)

Create a new matrix object.

CreatePath(self)

Create a new path obejct.

CreatePen(self, pen)

Create a new pen from a wx.Pen.

CreateRadialGradientBrush(self, xo, yo, xc, yc, radius, oColour, cColour)

Creates a brush with a radial gradient originating at (xo,yo) with colour oColour and ends on a circle around (xc,yc) with radius r and colour cColour.

DrawBitmap(self, bmp, x, y, w=-1, h=-1)

Draw the bitmap at (x,y). If the width and height parameters are passed then the bitmap is scaled to fit that size. Either a wx.Bitmap or a GraphicsBitmap may be used.

DrawCircle(self, x, y, radius)

Stroke and fill a circle centered at (x,y) with the given radius, using the current pen and brush.

DrawEllipse(self, x, y, w, h)

Stroke and fill an elipse that fits in the given rectangle, using the current pen and current brush.

DrawLines(self, points, fillStyle=1)

Stroke and fill a series of connected lines using the current pen and current brush.

DrawPath(self, path, fillStyle=1)

Draws the path by first filling it and then stroking it.

DrawRectangle(self, x, y, w, h)

Stroke and fill a rectangle using the current pen and current brush.

DrawRotatedText(self, text, x, y, angle, backgroundBrush=None)

Draw the text at (x,y) using the current font and rotated angle radians. If backgroundBrush is set then it is used to fill the rectangle behind the text.

DrawRoundedRectangle(self, x, y, w, h, radius)

Stroke and fill a rounded rectangle using the current pen and current brush.

DrawText(self, text, x, y, backgroundBrush=None)

Draw the text at (x,y) using the current font. If backgroundBrush is set then it is used to fill the rectangle behind the text.

FillPath(self, path, fillStyle=1)

Fills the path using the current brush.

GetAntialiasMode(self)

Returns the current antialias mode.

GetCompositingOperator(self)

Returns the current compositing operator for the context.

GetFulltextExtent(self, text)

Returns the (width, height, descent, externalLeading) of the text using the current font.

GetTextExtent(self, text)

Returns the (width, height) of the text using the current font.

GetTransform(self)

Returns the context's current transformation matrix.

PopState(self)

Restore the most recently saved state which was saved with PushState.

PushState(self)

Makes a copy of the current state of the context and saves it on an internal stack of saved states. The saved state will be restored when PopState is called.

ResetClip(self)

Resets the clipping region to the original shape of the context.

Rotate(self, angle)

Modifies the current transformation matrix by rotating the user-space axes by angle radians.

Scale(self, xScale, yScale)

Modifies the current transformation matrix by translating the user-space axes by xScale and yScale.

SetAntialiasMode(self, mode=0)

Set the antialiasing mode of the rasterizer used for drawing shapes. This value is a hint, and a particular backend may or may not support a particular value.

SetBrush(self, brush)

Set the brush to be used for filling shapes in future drawing operations. Either a wx.Brush or a GraphicsBrush object may be used.

SetCompositingOperator(self, op)

Sets the compositin operator to be used for all drawing operations. The default operator is OPERATOR_OVER.

SetFont(self, font, colour=None)

Sets the font to be used for drawing text. Either a wx.Font or a GrpahicsFont may be used.

SetPen(self, pen)

Set the pen to be used for stroking lines in future drawing operations. Either a wx.Pen or a GraphicsPen object may be used.

SetTransform(self, matrix)

Set the context's current transformation matrix to matrix.

StrokeLine(self, x1, y1, x2, y2)

Strokes a single line using the current pen.

StrokeLines(self, points)

Stroke a series of conencted lines using the current pen. Points is a sequence of points or 2-tuples, and lines are drawn from point to point through the end of the sequence.

StrokeLineSegments(self, beginPoints, endPoints)

Stroke a series of lines using the current pen. For each line the begin point is taken from the beginPoints sequence and the ending point is taken from the endPoints sequence.

StrokePath(self, path)

Strokes the path (draws the lines) using the current pen.

Translate(self, dx, dy)

Modifies the current transformation matrix by translating the user-space origin by (dx, dy).


Static Method Details

CreateFromSurface(surface)

Wrap a context around the given cairo Surface. Note that a GraphicsBitmap contains a cairo ImageSurface which is accessible via the Surface property.


Property Details

Context

Get Method:
fget(...)

Generated by Epydoc 2.1.20050511.rpd on Mon Feb 16 12:52:27 2009 http://epydoc.sf.net