Graphics
Drawing, Text, Fonts
This section details functions and classes that are used to draw
on windows. This includes drawing text (when a wxTextCtrl or
wxStaticText don't do what you need).
Functions/Procedures
- proc begin_drawing( atom dc )
- proc blit( atom dstDC, integer dstX, integer dstY, atom srcDC, integer srcX, integer srcY, integer height, integer width, integer operation )
- proc clear_dc( atom dc )
- proc draw_bitmap( atom dc, atom bitmap, integer x, integer y, integer trans )
- proc draw_icon( atom dc, atom icon, atom x, atom y)
- proc draw_line( atom dc, sequence points )
- proc draw_polygon( atom dc, sequence points, atom x, atom y, atom style )
- proc end_drawing( atom dc )
- func get_dc_size( atom dc )
- func get_dc_text_extent( atom dc, sequence text )
- func get_first_region( atom iter )
- func get_next_region( atom iter )
- func get_regions( atom window )
- func get_text_extent( atom win, sequence text, atom font )
- func get_user_scale( atom dc, atom x, atom y )
- proc set_background_mode( atom dc, atom mode )
- proc set_back_brush( atom dc, atom brush )
- proc set_brush( atom dc, atom brush )
- proc set_default_font( atom win, atom font )
- proc set_font( atom dc, atom font )
- proc set_pen( atom dc, atom pen )
- proc set_text_back_color( atom dc, object color )
- proc set_text_color( atom dc, object color )
- proc set_user_scale( atom dc, atom x, atom y )
- proc wx_printf( object win, sequence text, object format )
- proc wx_puts( object win, sequence text )
Subtopics
Graphics
Category:
Graphics
This must be called before you begin drawing to any window (i.e., not to
a wxMemoryDC), and must be followed with a call to end_drawing() when
finished.
Graphics
[proc]
blit ( atom dstDC, integer dstX, integer dstY, atom srcDC, integer srcX, integer srcY, integer height, integer width, integer operation )
Category:
Graphics
Copy a bitmap from one DC to another.
- dstDC The destination DC
- dstX X coordinate in the destination DC
- dstY Y coordinate in the destination DC
- srcDC Source DC
- srcX X coordinate of image to copy in the source
- srcY y coordinate of image to copy in the source
- width of image to copy in the source
- height of image to copy in the source
- operation Logigal operation to use (wxCOPY, wxAND, wxOR, etc)
Graphics
Category:
Graphics
Clears the image currently in the dc.
Graphics
[proc]
draw_bitmap ( atom dc, atom bitmap, integer x, integer y, integer trans )
Category:
Graphics
Draw a wxBitmap onto dc dest. Set trans to 1 if it has an associated mask, and should
be drawn with transparency.
Graphics
[proc]
draw_icon ( atom dc, atom icon, atom x, atom y)
Category:
Graphics
Draws a wxIcon to the DC dc.
Graphics
Category:
Graphics
Draws a line using the current wxPen. points should be a 4-element sequence:
draw_line( dc, {x1, y1, x2, y2})
Graphics
[proc]
draw_polygon ( atom dc, sequence points, atom x, atom y, atom style )
Category:
Graphics
Draws a polygon in the specified dc. points is a sequence containing all of the
points to be drawn. It should be of the form {x1,y1,x2,y2,...,xn,yn}. x and y are
offset coordinates. The last argument specifies the fill rule:
- wxODDEVEN_RULE
- wxWINDING_RULE
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.
Graphics
Category:
Graphics
This stops drawing to the specified DC. You should use this and
begin_drawing to specify when drawing should begin and end on a
wxDC.
Graphics
Category:
Graphics
Returns the width and height of the dc in pixels.
Graphics
Category:
Graphics
Graphics
Category:
Graphics
Graphics
Category:
Graphics
Returns a sequence with the x, y and width and height of the next
region, or an empty sequence if the last region has already been accessed.
Graphics
Category:
Graphics
Returns a wxRegionIterator, which can be used in conjunction
with get_next_region() to get all of the regions to be
updated in an on paint event. This should only be called from
within an on paint event.
Graphics
Category:
Graphics
Graphics
Category:
Graphics
Returns the scaling factors for the DC.
Graphics
Category:
Graphics
mode may be either wxSOLID (text is drawn with a background color)
or wxTRANSPARENT (text is drawn without a background color).
Graphics
Category:
Graphics
Sets background brush to be the current wxBrush for dc wxDC.
Graphics
Category:
Graphics
Sets brush to be the current wxBrush for dc wxDC.
Graphics
Category:
Graphics
Sets the default font for a window.
Graphics
Category:
Graphics
Sets the font for a specified wxDC or wxPaintDC assiciated with a window. To set the default
font for a window or control, you should use set_default_font().
Graphics
Category:
Graphics
Sets pen to be the current wxPen for dc wxDC.
Graphics
Category:
Graphics
This sets a back color to the DC. Color can either be an RGB sequence {Red,Green,Blue} or a
pointer to a wxColour.
Graphics
Category:
Graphics
Set the current text foreground color. color can be either an RGB sequence, or a pointer to
a wxColour object.
Graphics
Category:
Graphics
Sets the scaling factors for the DC.
Graphics
[proc]
wx_printf ( object win, sequence text, object format )
Category:
Graphics
Works similar to printf().
win can take several forms:
- this pointer to a wxWindow
- { this, x, y }
- { this, x, y, dc }
- x and y set the place in the window to start drawing text, otherwise the default of 0,0 is used
- dc is a wxDC or wxPaintDC for the window. If you already have the dc, then it is
faster to pass it to wx_printf() than for wx_printf() to create a new dc on the fly.
Graphics
[proc]
wx_puts ( object win, sequence text )
Category:
Graphics
Works similar to puts().
- win can take several forms:
- this pointer to a wxWindow
- { this, x, y }
- x and y set the place in the window to start drawing text, otherwise the default of 0,0 is used
- { this, x, y, dc }
- x and y set the place in the window to start drawing text, otherwise the default of 0,0 is used
- dc is a wxDC (or some derivative of wxDC, such as wxMemoryDC) or wxPaintDC for the window.
If you already have the dc, then it is faster to pass it to wx_puts() than for wx_puts() to
create a new dc on the fly.
- text is a sequence containing the text to be drawn