Table Of Contents

Previous topic

dcgraphics

Next topic

dcGraphicsMatrix

This Page

phoenix_title dcGraphicsContext


class_hierarchy Inheritance Diagram

Inheritance diagram for class dcGraphicsContext

Inheritance diagram of dcGraphicsContext


method_summary Methods Summary

__init__ The incoming co-ordinates have a bottom left origin with increasing
ConcatTransform Modifies the current transformation matrix by applying matrix
Create The created pGraphicsContext instance uses the dc itself
CreateMatrix Create a new matrix object.
CreatePath Create a new path obejct.
DrawBitmap Draw the bitmap at (x,y), ignoring w, h
DrawPath Draws the path using current pen and brush.
DrawText Set the dc font at the required size.
FillPath Fills the path using the current brush.
PopState Restore the most recently saved state which was saved with PushState.
PushState Makes a copy of the current state of the context and saves it
Scale Sets the dc userscale factor
SetBrush Set the Brush to be used for filling shapes in future drawing
SetFont Sets the wx.Font to be used for drawing text.
SetPen Set the wx.Pen to be used for stroking lines in future drawing
StrokePath Strokes the path (draws the lines) using the current pen.

api Class API



class dcGraphicsContext(object)

Methods



__init__(self, context=None, yoffset=0, have_cairo=False)

The incoming co-ordinates have a bottom left origin with increasing y downwards (so y values are all negative). The DC origin is top left also with increasing y down. yoffset informs us of the page height. wx.DC and wx.GraphicsContext fonts are too big in the ratio of pixels per inch to points per inch. If screen rendering used Cairo, printed fonts need to be scaled but if wx.GC was used, they are already scaled



ConcatTransform(self, matrix)

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



static Create(dc, yoffset, have_cairo)

The created pGraphicsContext instance uses the dc itself



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.



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

Draw the bitmap at (x,y), ignoring w, h



DrawPath(self, path, fillStyle=ODDEVEN_RULE)

Draws the path using current pen and brush.



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

Set the dc font at the required size. Ensure original font is not altered Draw the text at (x,y) using the current font. Ignore backgroundBrush



FillPath(self, path, fillStyle=ODDEVEN_RULE)

Fills the path using the current brush.



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.



Scale(self, xScale, yScale)

Sets the dc userscale factor



SetBrush(self, brush)

Set the Brush to be used for filling shapes in future drawing operations.



SetFont(self, font, colour=None)

Sets the wx.Font to be used for drawing text. Don’t set the dc font yet as it may need to be scaled



SetPen(self, pen)

Set the wx.Pen to be used for stroking lines in future drawing operations.



StrokePath(self, path)

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