Home | Trees | Index | Help |
|
---|
Package wx :: Class PseudoDC |
|
object
--+ |Object
--+ | PseudoDC
A PseudoDC is an object that can be used as if it were a wx.DC
. All
commands issued to the PseudoDC are stored in a list. You can then
play these commands back to a real DC object using the DrawToDC
method. Commands in the command list are indexed by ID. You can use
this to clear the operations associated with a single ID and then
re-draw the object associated with that ID.
Method Summary | |
---|---|
PseudoDC |
Constructs a new Pseudo device context for recording dc operations |
__del__(self)
| |
Allows for optimization of drawing code on platforms that need it. | |
Clears the device context using the current background brush. | |
Removes all operations associated with id so the object can be redrawn. | |
Displays a cross hair using the current pen. | |
Displays a cross hair using the current pen. | |
Draws an arc of a circle, centred on the center point (xc, yc), from the first point to the second. | |
Draws an arc of a circle, centred on the center point (xc, yc), from the first point to the second. | |
Draw a bitmap on the device context at the specified point. | |
Draw a bitmap on the device context at the specified point. | |
Draws a check mark inside the given rectangle. | |
Draws a check mark inside the given rectangle. | |
Draws a circle with the given center point and radius. | |
Draws a circle with the given center point and radius. | |
Draws an ellipse contained in the specified rectangle. | |
Draws an ellipse contained in the specified rectangle. | |
Draws an ellipse contained in the specified rectangle. | |
Draws an arc of an ellipse, with the given rectangle defining the bounds of the ellipse. | |
Draws an arc of an ellipse, with the given rectangle defining the bounds of the ellipse. | |
Draw an icon on the display (does nothing if the device context is PostScript). | |
Draw an icon on the display (does nothing if the device context is PostScript). | |
Draw recorded operations of id to dc. | |
Draw text and an image (which may be wx.NullBitmap to skip drawing it) within the specified rectangle, abiding by the alignment flags. | |
Draw text within the specified rectangle, abiding by the alignment flags. | |
Draws a line from the first point to the second. | |
Draws a line from the first point to the second. | |
Draws lines using a sequence of wx.Point objects, adding the
optional offset coordinate. | |
Draws a point using the current pen. | |
Draws a point using the current pen. | |
Draws a filled polygon using a sequence of wx.Point objects, adding
the optional offset coordinate. | |
Draws a rectangle with the given top left corner, and with the given size. | |
Draws a rectangle with the given top left corner, and with the given size. | |
Draws a rectangle with the given top left corner, and with the given size. | |
Draws the text rotated by angle degrees, if supported by the platform. | |
Draws the text rotated by angle degrees, if supported by the platform. | |
Draws a rectangle with the given top left corner, and with the given size. | |
Draws a rectangle with the given top left corner, and with the given size. | |
Draws a rectangle with the given top left corner, and with the given size. | |
Draws a spline between all given control points, (a list of wx.Point
objects) using the current pen. | |
Draws a text string at the specified point, using the current text font, and the current text foreground and background colours. | |
Draws a text string at the specified point, using the current text font, and the current text foreground and background colours. | |
Draws the recorded operations to dc. | |
Draws the recorded operations to dc unless the operation is known to be outside rect. | |
Draws the recorded operations to dc unless the operation is known to be outside rect. | |
Ends the group of drawing primitives started with BeginDrawing , and
invokes whatever optimization is available for this DC type on the
current platform. | |
PyObject |
Returns a list of all the id's that draw a pixel with color not equal to bg within radius of (x,y). |
PyObject |
Returns a list of all the id's whose bounding boxes include (x,y). |
Flood fills the device context starting from the given point, using the current brush colour, and using a style: | |
Flood fills the device context starting from the given point, using the current brush colour, and using a style: | |
Rect |
Returns the bounding rectangle previouly set with SetIdBounds. |
bool |
Get whether an object is drawn greyed out or not. |
int |
Returns the number of operations in the recorded list. |
Removes all objects and operations from the recorded list. | |
Remove the object node (and all operations) associated with an id. | |
Sets the current background brush for the DC. | |
mode may be one of wx.SOLID and wx.TRANSPARENT. | |
Sets the current brush for the DC. | |
Sets the current font for the DC. | |
Sets the id to be associated with subsequent operations. | |
Set the bounding rect of a given object. | |
Set whether an object is drawn greyed out or not. | |
Sets the current logical function for the device context. | |
If this is a window DC or memory DC, assigns the given palette to the window or bitmap associated with the DC. | |
Sets the current pen for the DC. | |
Sets the current text background colour for the DC. | |
Sets the current text foreground colour for the DC. | |
Translate the operations of id by dx,dy. |
Property Summary | |
---|---|
IdBounds : See GetIdBounds and SetIdBounds | |
Len : See GetLen | |
thisown : The membership flag |
Method Details |
---|
__init__(self)
|
BeginDrawing(self)Allows for optimization of drawing code on platforms that need it. On
other platforms this is just an empty function and is harmless. To
take advantage of this postential optimization simply enclose each
group of calls to the drawing primitives within calls to
|
Clear(self)Clears the device context using the current background brush. |
ClearId(self, id)Removes all operations associated with id so the object can be redrawn.
|
CrossHair(self, x, y)Displays a cross hair using the current pen. This is a vertical and horizontal line the height and width of the window, centred on the given point.
|
CrossHairPoint(self, pt)Displays a cross hair using the current pen. This is a vertical and horizontal line the height and width of the window, centred on the given point.
|
DrawArc(self, x1, y1, x2, y2, xc, yc)Draws an arc of a circle, centred on the center point (xc, yc), from the first point to the second. The current pen is used for the outline and the current brush for filling the shape. The arc is drawn in an anticlockwise direction from the start point to the end point.
|
DrawArcPoint(self, pt1, pt2, center)Draws an arc of a circle, centred on the center point (xc, yc), from the first point to the second. The current pen is used for the outline and the current brush for filling the shape. The arc is drawn in an anticlockwise direction from the start point to the end point.
|
DrawBitmap(self, bmp, x, y, useMask=False)Draw a bitmap on the device context at the specified point. If transparent is true and the bitmap has a transparency mask, (or alpha channel on the platforms that support it) then the bitmap will be drawn transparently. When drawing a mono-bitmap, the current text foreground colour will be used to draw the foreground of the bitmap (all bits set to 1), and the current text background colour to draw the background (all bits set to 0).
|
DrawBitmapPoint(self, bmp, pt, useMask=False)Draw a bitmap on the device context at the specified point. If transparent is true and the bitmap has a transparency mask, (or alpha channel on the platforms that support it) then the bitmap will be drawn transparently. When drawing a mono-bitmap, the current text foreground colour will be used to draw the foreground of the bitmap (all bits set to 1), and the current text background colour to draw the background (all bits set to 0).
|
DrawCheckMark(self, x, y, width, height)Draws a check mark inside the given rectangle.
|
DrawCheckMarkRect(self, rect)Draws a check mark inside the given rectangle.
|
DrawCircle(self, x, y, radius)Draws a circle with the given center point and radius. The current pen is used for the outline and the current brush for filling the shape.
|
DrawCirclePoint(self, pt, radius)Draws a circle with the given center point and radius. The current pen is used for the outline and the current brush for filling the shape.
|
DrawEllipse(self, x, y, width, height)Draws an ellipse contained in the specified rectangle. The current pen is used for the outline and the current brush for filling the shape.
|
DrawEllipsePointSize(self, pt, sz)Draws an ellipse contained in the specified rectangle. The current pen is used for the outline and the current brush for filling the shape.
|
DrawEllipseRect(self, rect)Draws an ellipse contained in the specified rectangle. The current pen is used for the outline and the current brush for filling the shape.
|
DrawEllipticArc(self, x, y, w, h, start, end)Draws an arc of an ellipse, with the given rectangle defining the bounds of the ellipse. The current pen is used for drawing the arc and the current brush is used for drawing the pie. The start and end parameters specify the start and end of the arc relative to the three-o'clock position from the center of the rectangle. Angles are specified in degrees (360 is a complete circle). Positive values mean counter-clockwise motion. If start is equal to end, a complete ellipse will be drawn.
|
DrawEllipticArcPointSize(self, pt, sz, start, end)Draws an arc of an ellipse, with the given rectangle defining the bounds of the ellipse. The current pen is used for drawing the arc and the current brush is used for drawing the pie. The start and end parameters specify the start and end of the arc relative to the three-o'clock position from the center of the rectangle. Angles are specified in degrees (360 is a complete circle). Positive values mean counter-clockwise motion. If start is equal to end, a complete ellipse will be drawn.
|
DrawIcon(self, icon, x, y)Draw an icon on the display (does nothing if the device context is PostScript). This can be the simplest way of drawing bitmaps on a window.
|
DrawIconPoint(self, icon, pt)Draw an icon on the display (does nothing if the device context is PostScript). This can be the simplest way of drawing bitmaps on a window.
|
DrawIdToDC(self, id, dc)Draw recorded operations of id to dc.
|
DrawImageLabel(self, text, image, rect, alignment=wxALIGN_LEFT|wxALIGN_TOP, indexAccel=-1)Draw text and an image (which may be wx.NullBitmap to skip drawing it) within the specified rectangle, abiding by the alignment flags. Will additionally emphasize the character at indexAccel if it is not -1.
|
DrawLabel(self, text, rect, alignment=wxALIGN_LEFT|wxALIGN_TOP, indexAccel=-1)Draw text within the specified rectangle, abiding by the alignment flags. Will additionally emphasize the character at indexAccel if it is not -1.
|
DrawLine(self, x1, y1, x2, y2)Draws a line from the first point to the second. The current pen is used for drawing the line. Note that the second point is not part of the line and is not drawn by this function (this is consistent with the behaviour of many other toolkits).
|
DrawLinePoint(self, pt1, pt2)Draws a line from the first point to the second. The current pen is used for drawing the line. Note that the second point is not part of the line and is not drawn by this function (this is consistent with the behaviour of many other toolkits).
|
DrawLines(self, points, xoffset=0, yoffset=0)Draws lines using a sequence of
|
DrawPoint(self, x, y)Draws a point using the current pen.
|
DrawPointPoint(self, pt)Draws a point using the current pen.
|
DrawPolygon(self, points, xoffset=0, yoffset=0, fillStyle=ODDEVEN_RULE)Draws a filled polygon using a sequence of The current pen is used for drawing the outline, and the current brush for filling the shape. Using a transparent brush suppresses filling. Note that wxWidgets automatically closes the first and last points.
|
DrawRectangle(self, x, y, width, height)Draws a rectangle with the given top left corner, and with the given size. The current pen is used for the outline and the current brush for filling the shape.
|
DrawRectanglePointSize(self, pt, sz)Draws a rectangle with the given top left corner, and with the given size. The current pen is used for the outline and the current brush for filling the shape.
|
DrawRectangleRect(self, rect)Draws a rectangle with the given top left corner, and with the given size. The current pen is used for the outline and the current brush for filling the shape.
|
DrawRotatedText(self, text, x, y, angle)Draws the text rotated by angle degrees, if supported by the platform. NOTE: Under Win9x only TrueType fonts can be drawn by this function. In particular, a font different from wx.NORMAL_FONT should be used as the it is not normally a TrueType font. wx.SWISS_FONT is an example of a font which is.
|
DrawRotatedTextPoint(self, text, pt, angle)Draws the text rotated by angle degrees, if supported by the platform. NOTE: Under Win9x only TrueType fonts can be drawn by this function. In particular, a font different from wx.NORMAL_FONT should be used as the it is not normally a TrueType font. wx.SWISS_FONT is an example of a font which is.
|
DrawRoundedRectangle(self, x, y, width, height, radius)Draws a rectangle with the given top left corner, and with the given size. The corners are quarter-circles using the given radius. The current pen is used for the outline and the current brush for filling the shape. If radius is positive, the value is assumed to be the radius of the rounded corner. If radius is negative, the absolute value is assumed to be the proportion of the smallest dimension of the rectangle. This means that the corner can be a sensible size relative to the size of the rectangle, and also avoids the strange effects X produces when the corners are too big for the rectangle.
|
DrawRoundedRectanglePointSize(self, pt, sz, radius)Draws a rectangle with the given top left corner, and with the given size. The corners are quarter-circles using the given radius. The current pen is used for the outline and the current brush for filling the shape. If radius is positive, the value is assumed to be the radius of the rounded corner. If radius is negative, the absolute value is assumed to be the proportion of the smallest dimension of the rectangle. This means that the corner can be a sensible size relative to the size of the rectangle, and also avoids the strange effects X produces when the corners are too big for the rectangle.
|
DrawRoundedRectangleRect(self, r, radius)Draws a rectangle with the given top left corner, and with the given size. The corners are quarter-circles using the given radius. The current pen is used for the outline and the current brush for filling the shape. If radius is positive, the value is assumed to be the radius of the rounded corner. If radius is negative, the absolute value is assumed to be the proportion of the smallest dimension of the rectangle. This means that the corner can be a sensible size relative to the size of the rectangle, and also avoids the strange effects X produces when the corners are too big for the rectangle.
|
DrawSpline(self, points)Draws a spline between all given control points, (a list of
|
DrawText(self, text, x, y)Draws a text string at the specified point, using the current text font, and the current text foreground and background colours. The coordinates refer to the top-left corner of the rectangle bounding
the string. See NOTE: under wxGTK the current logical function is used by this function but it is ignored by wxMSW. Thus, you should avoid using logical functions with this function in portable programs.
|
DrawTextPoint(self, text, pt)Draws a text string at the specified point, using the current text font, and the current text foreground and background colours. The coordinates refer to the top-left corner of the rectangle bounding
the string. See NOTE: under wxGTK the current logical function is used by this function but it is ignored by wxMSW. Thus, you should avoid using logical functions with this function in portable programs.
|
DrawToDC(self, dc)Draws the recorded operations to dc.
|
DrawToDCClipped(self, dc, rect)Draws the recorded operations to dc unless the operation is known to be outside rect.
|
DrawToDCClippedRgn(self, dc, region)Draws the recorded operations to dc unless the operation is known to be outside rect.
|
EndDrawing(self)Ends the group of drawing primitives started with |
FindObjects(self, x, y, radius=1, bg=*wxWHITE)Returns a list of all the id's that draw a pixel with color not equal to bg within radius of (x,y). Returns an empty list if nothing is found. The list is in reverse drawing order so list[0] is the top id.
|
FindObjectsByBBox(self, x, y)Returns a list of all the id's whose bounding boxes include (x,y). Returns an empty list if nothing is found. The list is in reverse drawing order so list[0] is the top id.
|
FloodFill(self, x, y, col, style=FLOOD_SURFACE)Flood fills the device context starting from the given point, using the current brush colour, and using a style:
Returns False if the operation failed. Note: The present implementation for non-Windows platforms may fail to find colour borders if the pixels do not match the colour exactly. However the function will still return true.
|
FloodFillPoint(self, pt, col, style=FLOOD_SURFACE)Flood fills the device context starting from the given point, using the current brush colour, and using a style:
Returns False if the operation failed. Note: The present implementation for non-Windows platforms may fail to find colour borders if the pixels do not match the colour exactly. However the function will still return true.
|
GetIdBounds(self, id)Returns the bounding rectangle previouly set with SetIdBounds. If no bounds have been set, it returns wx.Rect(0,0,0,0).
|
GetIdGreyedOut(self, id)Get whether an object is drawn greyed out or not.
|
GetLen(self)Returns the number of operations in the recorded list.
|
RemoveAll(self)Removes all objects and operations from the recorded list. |
RemoveId(self, id)Remove the object node (and all operations) associated with an id.
|
SetBackground(self, brush)Sets the current background brush for the DC.
|
SetBackgroundMode(self, mode)mode may be one of wx.SOLID and wx.TRANSPARENT. This setting determines whether text will be drawn with a background colour or not.
|
SetBrush(self, brush)Sets the current brush for the DC. If the argument is wx.NullBrush, the current brush is selected out of the device context, and the original brush restored, allowing the current brush to be destroyed safely.
|
SetFont(self, font)Sets the current font for the DC. It must be a valid font, in particular you should not pass wx.NullFont to this method.
|
SetId(self, id)Sets the id to be associated with subsequent operations.
|
SetIdBounds(self, id, rect)Set the bounding rect of a given object. This will create an object node if one doesn't exist.
|
SetIdGreyedOut(self, id, greyout=True)Set whether an object is drawn greyed out or not.
|
SetLogicalFunction(self, function)Sets the current logical function for the device context. This determines how a source pixel (from a pen or brush colour, combines with a destination pixel in the current device context. The possible values and their meaning in terms of source and destination pixel values are as follows:
The default is wx.COPY, which simply draws with the current colour. The others combine the current colour and the background using a logical operation. wx.INVERT is commonly used for drawing rubber bands or moving outlines, since drawing twice reverts to the original colour.
|
SetPalette(self, palette)If this is a window DC or memory DC, assigns the given palette to the window or bitmap associated with the DC. If the argument is wx.NullPalette, the current palette is selected out of the device context, and the original palette restored.
|
SetPen(self, pen)Sets the current pen for the DC. If the argument is wx.NullPen, the current pen is selected out of the device context, and the original pen restored.
|
SetTextBackground(self, colour)Sets the current text background colour for the DC.
|
SetTextForeground(self, colour)Sets the current text foreground colour for the DC.
|
TranslateId(self, id, dx, dy)Translate the operations of id by dx,dy.
|
Property Details |
---|
IdBoundsSee
|
LenSee
|
thisownThe membership flag |
Home | Trees | Index | Help |
|
---|
Generated by Epydoc 2.1.20050511.rpd on Thu Mar 22 12:14:08 2007 | http://epydoc.sf.net |