Package wx :: Class GraphicsContext
[frames | no frames]

Type GraphicsContext

object --+        
         |        
    Object --+    
             |    
GraphicsObject --+
                 |
                GraphicsContext


A wx.GraphicsContext instance is the object that is drawn upon. It is created by a renderer using the CreateContext calls, this can be done either directly using a renderer instance, or indirectly using the static convenience CreateXXX functions of wx.GraphicsContext that always delegate the task to the default renderer.


Method Summary
  __init__(self)
  __del__(self)
  Clip(self, x, y, w, h)
Clips drawings to the rectangle.
  ClipRegion(self, region)
Clips drawings to the region, combined to current clipping region.
  ConcatTransform(self, matrix)
Concatenates the passed in transform with the current transform of this context.
GraphicsContext Create(dc)
Create(Window window) -> GraphicsContext (Static method)
GraphicsBrush CreateBrush(self, brush)
Creates a native brush from a wx.Brush.
GraphicsFont CreateFont(self, font, col)
Creates a native graphics font from a wx.Font and a text colour.
GraphicsContext CreateFromNative(context)
Creates a wx.GraphicsContext from a native context. (Static method)
GraphicsContext CreateFromNativeWindow(window)
Creates a wx.GraphicsContext from a native window. (Static method)
GraphicsBrush CreateLinearGradientBrush(self, x1, y1, x2, y2, c1, c2)
Creates a native brush, having a linear gradient, starting at (x1,y1) with color c1 to (x2,y2) with color c2.
GraphicsMatrix CreateMatrix(self, a, b, c, d, tx, ty)
Creates a native affine transformation matrix from the passed in values.
GraphicsContext CreateMeasuringContext()
Create a lightwieght context that can be used for measuring text only. (Static method)
GraphicsPath CreatePath(self)
Creates a native graphics path which is initially empty.
GraphicsPen CreatePen(self, pen)
Creates a native pen from a wx.Pen.
GraphicsBrush CreateRadialGradientBrush(self, xo, yo, xc, yc, radius, oColor, cColor)
Creates a native brush, having a radial gradient originating at point (xo,yc) with color oColour and ends on a circle around (xc,yc) with radius r and color cColour.
  DrawBitmap(self, bmp, x, y, w, h)
Draws the bitmap.
  DrawEllipse(self, x, y, w, h)
Draws an ellipse.
  DrawIcon(self, icon, x, y, w, h)
Draws the icon.
  DrawLines(self, points, fillStyle)
Draws a polygon.
  DrawPath(self, path, fillStyle)
Draws the path by first filling and then stroking.
  DrawRectangle(self, x, y, w, h)
Draws a rectangle.
  DrawRotatedText(self, str, x, y, angle, backgroundBrush)
Draws a text string at the defined position, at the specified angle, which is given in radians.
  DrawRoundedRectangle(self, x, y, w, h, radius)
Draws a rounded rectangle
  DrawText(self, str, x, y, backgroundBrush)
Draws a text string at the defined position.
  FillPath(self, path, fillStyle)
Fills a path with the current brush.
  GetFullTextExtent(*args, **kwargs)
GetFullTextExtent(self, text) --> (width, height, descent, externalLeading)
int GetLogicalFunction(self)
Returns the current logical function.
void GetNativeContext(self)
Returns the native context (CGContextRef for Core Graphics, Graphics pointer for GDIPlus and cairo_t pointer for cairo).
[widths] GetPartialTextExtents(self, text)
Returns a list of widths from the beginning of text to the coresponding character in text.
  GetTextExtent(*args, **kwargs)
GetTextExtent(self, text) --> (width, height)
GraphicsMatrix GetTransform(self)
Gets the current transformation matrix of this context.
  PopState(self)
Pops a stored state from the stack
  PushState(self)
Push the current state of the context, (ie the transformation matrix) on a stack
  ResetClip(self)
Resets the clipping to original shape.
  Rotate(self, angle)
Rotate the current transformation matrix of the context.
  Scale(self, xScale, yScale)
Scale the current transformation matrix of the context.
  SetBrush(self, brush)
SetBrush(self, Brush brush)
  SetFont(self, font)
SetFont(self, Font font, Colour colour=*wxBLACK)
bool SetLogicalFunction(self, function)
Sets the current logical function, returns True if it supported
  SetPen(self, pen)
SetPen(self, Pen pen)
  SetTransform(self, matrix)
Sets the current transform of this context.
bool ShouldOffset(self)
helper to determine if a 0.5 offset should be applied for the drawing operation
  StrokeLine(self, x1, y1, x2, y2)
Strokes a single line.
  StrokeLines(self, points)
Stroke lines connecting each of the points
  StrokeLineSegements(*args, **kwargs)
StrokeLineSegments(self, List beginPoints, List endPoints)
  StrokePath(self, path)
Strokes along a path with the current pen.
  Translate(self, dx, dy)
Translates the current transformation matrix.

Property Summary
  thisown: The membership flag

Instance Method Details

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

Clips drawings to the rectangle.

Parameters:
x
           (type=Double)

y
           (type=Double)

w
           (type=Double)

h
           (type=Double)

ClipRegion(self, region)

Clips drawings to the region, combined to current clipping region.

Parameters:
region
           (type=Region)

ConcatTransform(self, matrix)

Concatenates the passed in transform with the current transform of this context.

Parameters:
matrix
           (type=GraphicsMatrix)

CreateBrush(self, brush)

Creates a native brush from a wx.Brush.

Parameters:
brush
           (type=Brush)

Returns:
GraphicsBrush

CreateFont(self, font, col=*wxBLACK)

Creates a native graphics font from a wx.Font and a text colour.

Parameters:
font
           (type=Font)

col
           (type=Colour)

Returns:
GraphicsFont

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

Creates a native brush, having a linear gradient, starting at (x1,y1) with color c1 to (x2,y2) with color c2.

Parameters:
x1
           (type=Double)

y1
           (type=Double)

x2
           (type=Double)

y2
           (type=Double)

c1
           (type=Colour)

c2
           (type=Colour)

Returns:
GraphicsBrush

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

Creates a native affine transformation matrix from the passed in values. The defaults result in an identity matrix.

Parameters:
a
           (type=Double)

b
           (type=Double)

c
           (type=Double)

d
           (type=Double)

tx
           (type=Double)

ty
           (type=Double)

Returns:
GraphicsMatrix

CreatePath(self)

Creates a native graphics path which is initially empty.

Returns:
GraphicsPath

CreatePen(self, pen)

Creates a native pen from a wx.Pen.

Parameters:
pen
           (type=Pen)

Returns:
GraphicsPen

CreateRadialGradientBrush(self, xo, yo, xc, yc, radius, oColor, cColor)

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

Parameters:
xo
           (type=Double)

yo
           (type=Double)

xc
           (type=Double)

yc
           (type=Double)

radius
           (type=Double)

oColor
           (type=Colour)

cColor
           (type=Colour)

Returns:
GraphicsBrush

DrawBitmap(self, bmp, x, y, w, h)

Draws the bitmap. In case of a mono bitmap, this is treated as a mask and the current brush is used for filling.

Parameters:
bmp
           (type=Bitmap)

x
           (type=Double)

y
           (type=Double)

w
           (type=Double)

h
           (type=Double)

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

Draws an ellipse.

Parameters:
x
           (type=Double)

y
           (type=Double)

w
           (type=Double)

h
           (type=Double)

DrawIcon(self, icon, x, y, w, h)

Draws the icon.

Parameters:
icon
           (type=Icon)

x
           (type=Double)

y
           (type=Double)

w
           (type=Double)

h
           (type=Double)

DrawLines(self, points, fillStyle=ODDEVEN_RULE)

Draws a polygon.

Parameters:
points
           (type=size_t)

fillStyle
           (type=int)

DrawPath(self, path, fillStyle=ODDEVEN_RULE)

Draws the path by first filling and then stroking.

Parameters:
path
           (type=GraphicsPath)

fillStyle
           (type=int)

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

Draws a rectangle.

Parameters:
x
           (type=Double)

y
           (type=Double)

w
           (type=Double)

h
           (type=Double)

DrawRotatedText(self, str, x, y, angle, backgroundBrush=NullGraphicsBrush)

Draws a text string at the defined position, at the specified angle, which is given in radians.

Parameters:
str
           (type=String)

x
           (type=Double)

y
           (type=Double)

angle
           (type=Double)

backgroundBrush
           (type=GraphicsBrush)

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

Draws a rounded rectangle

Parameters:
x
           (type=Double)

y
           (type=Double)

w
           (type=Double)

h
           (type=Double)

radius
           (type=Double)

DrawText(self, str, x, y, backgroundBrush=NullGraphicsBrush)

Draws a text string at the defined position.

Parameters:
str
           (type=String)

x
           (type=Double)

y
           (type=Double)

backgroundBrush
           (type=GraphicsBrush)

FillPath(self, path, fillStyle=ODDEVEN_RULE)

Fills a path with the current brush.

Parameters:
path
           (type=GraphicsPath)

fillStyle
           (type=int)

GetFullTextExtent(*args, **kwargs)

GetFullTextExtent(self, text) --> (width, height, descent, externalLeading)

Gets the dimensions of the string using the currently selected font. text is the string to measure, w and h are the total width and height respectively, descent is the dimension from the baseline of the font to the bottom of the descender, and externalLeading is any extra vertical space added to the font by the font designer (usually is zero).

GetLogicalFunction(self)

Returns the current logical function.

Returns:
int

GetNativeContext(self)

Returns the native context (CGContextRef for Core Graphics, Graphics pointer for GDIPlus and cairo_t pointer for cairo).

Returns:
void

GetPartialTextExtents(self, text)

Returns a list of widths from the beginning of text to the coresponding character in text.

Returns:
[widths]

GetTextExtent(*args, **kwargs)

GetTextExtent(self, text) --> (width, height)

Gets the dimensions of the string using the currently selected font. text is the string to measure, w and h are the total width and height respectively.

GetTransform(self)

Gets the current transformation matrix of this context.

Returns:
GraphicsMatrix

PopState(self)

Pops a stored state from the stack

PushState(self)

Push the current state of the context, (ie the transformation matrix) on a stack

ResetClip(self)

Resets the clipping to original shape.

Rotate(self, angle)

Rotate the current transformation matrix of the context. angle is specified in radians.

Parameters:
angle
           (type=Double)

Scale(self, xScale, yScale)

Scale the current transformation matrix of the context.

Parameters:
xScale
           (type=Double)

yScale
           (type=Double)

SetBrush(self, brush)

SetBrush(self, Brush brush)

Sets the brush for filling

Parameters:
brush
           (type=GraphicsBrush)

SetFont(self, font)

SetFont(self, Font font, Colour colour=*wxBLACK)

Sets the font

Parameters:
font
           (type=GraphicsFont)

SetLogicalFunction(self, function)

Sets the current logical function, returns True if it supported

Parameters:
function
           (type=int)

Returns:
bool

SetPen(self, pen)

SetPen(self, Pen pen)

Sets the stroke pen

Parameters:
pen
           (type=GraphicsPen)

SetTransform(self, matrix)

Sets the current transform of this context.

Parameters:
matrix
           (type=GraphicsMatrix)

ShouldOffset(self)

helper to determine if a 0.5 offset should be applied for the drawing operation

Returns:
bool

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

Strokes a single line.

Parameters:
x1
           (type=Double)

y1
           (type=Double)

x2
           (type=Double)

y2
           (type=Double)

StrokeLines(self, points)

Stroke lines connecting each of the points

Parameters:
points
           (type=List)

StrokeLineSegements(*args, **kwargs)

StrokeLineSegments(self, List beginPoints, List endPoints)

Stroke disconnected lines from begin to end points

StrokePath(self, path)

Strokes along a path with the current pen.

Parameters:
path
           (type=GraphicsPath)

Translate(self, dx, dy)

Translates the current transformation matrix.

Parameters:
dx
           (type=Double)

dy
           (type=Double)


Static Method Details

Create(dc)

Create(Window window) -> GraphicsContext

Creates a wx.GraphicsContext either from a window or a DC.

Parameters:
dc
           (type=WindowDC)

Returns:
GraphicsContext

CreateFromNative(context)

Creates a wx.GraphicsContext from a native context. This native context must be eg a CGContextRef for Core Graphics, a Graphics pointer for GDIPlus or a cairo_t pointer for Cairo. NOTE: For wxPython we still need a way to make this value usable.

Parameters:
context
           (type=void)

Returns:
GraphicsContext

CreateFromNativeWindow(window)

Creates a wx.GraphicsContext from a native window. NOTE: For wxPython we still need a way to make this value usable.

Parameters:
window
           (type=void)

Returns:
GraphicsContext

CreateMeasuringContext()

Create a lightwieght context that can be used for measuring text only.

Returns:
GraphicsContext

Property Details

thisown

The membership flag


Generated by Epydoc 2.1.20050511.rpd on Thu Mar 22 12:09:23 2007 http://epydoc.sf.net