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_arc( atom dc, atom x1, atom y1, atom x2, atom y2, atom xc, atom yc )
- proc draw_bitmap( atom dc, atom bitmap, integer x, integer y, integer trans )
- proc draw_check_mark( atom dc, atom x, atom y, atom width, atom height )
- proc draw_circle( atom dc, atom x, atom y, atom radius )
- proc draw_ellipse( atom dc, atom x, atom y, atom width, atom height )
- proc draw_elliptic_arc( atom dc, atom x, atom y, atom width, atom height, object angle_start, object angle_end )
- proc draw_icon( atom dc, atom icon, atom x, atom y)
- proc draw_label( atom dc, object text, atom bitmap, object rect, atom alignment )
- proc draw_line( atom dc, sequence points )
- proc draw_point( atom dc, atom x, atom y )
- proc draw_polygon( atom dc, sequence points, atom x, atom y, atom style )
- proc draw_rectangle( atom dc, atom x, atom y, atom width, atom height )
- proc draw_rounded_rectangle( atom dc, atom x, atom y, atom width, atom height, object radius )
- proc end_drawing( atom dc )
- func find_color( sequence name )
- proc flood_fill( atom dc, atom x, atom y, atom color, atom style )
- func get_dc_size( atom dc )
- func get_dc_text_extent( atom dc, sequence text )
- func get_first_region( atom iter )
- func get_font( atom dc )
- 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 gradient_fill( atom dc, object rect, atom initialColor, atom destColor, atom nDirection )
- 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_arc ( atom dc, atom x1, atom y1, atom x2, atom y2, atom xc, atom yc )
Category:
Graphics
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_check_mark ( atom dc, atom x, atom y, atom width, atom height )
Category:
Graphics
Graphics
[proc]
draw_circle ( atom dc, atom x, atom y, atom radius )
Category:
Graphics
Graphics
[proc]
draw_ellipse ( atom dc, atom x, atom y, atom width, atom height )
Category:
Graphics
Graphics
[proc]
draw_elliptic_arc ( atom dc, atom x, atom y, atom width, atom height, object angle_start, object angle_end )
Category:
Graphics
Graphics
[proc]
draw_icon ( atom dc, atom icon, atom x, atom y)
Category:
Graphics
Draws a wxIcon to the DC dc.
Graphics
[proc]
draw_label ( atom dc, object text, atom bitmap, object rect, atom alignment )
Category:
Graphics
Draw optional bitmap and the text into the given rectangle and aligns it as specified by alignment parameter.
Graphics
Category:
Graphics
Draws a line using the current wxPen. points should be a 4-element sequence:
Example:
draw_line( dc, {x1, y1, x2, y2} )
Graphics
Category:
Graphics
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
[proc]
draw_rectangle ( atom dc, atom x, atom y, atom width, atom height )
Category:
Graphics
Graphics
[proc]
draw_rounded_rectangle ( atom dc, atom x, atom y, atom width, atom height, object radius )
Category:
Graphics
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
Finds a colour given the name.
Graphics
[proc]
flood_fill ( atom dc, atom x, atom y, atom color, atom style )
Category:
Graphics
Graphics
Category:
Graphics
Returns: Width and height
Returns the width and height of the dc in pixels.
Graphics
Category:
Graphics
Returns: Dimensions of the specified text
Gets the dimensions of text using the font in the current dc.
Graphics
Category:
Graphics
Returns a sequence with the x, y and width and height of the first region.
Graphics
Category:
Graphics
Returns: Font object
Gets the current font. Notice that even although each device context object has some default font after creation,
this method would return a wxNullFont initially and only after calling set_font a valid font is returned.
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
Returns: Dimensions of the specified text
Gets the dimensions of text using the specified font.
Graphics
Category:
Graphics
Returns: Scaling factors
Returns the scaling factors for the DC.
Graphics
[proc]
gradient_fill ( atom dc, object rect, atom initialColor, atom destColor, atom nDirection )
Category:
Graphics
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 }
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 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.)
text is a sequence containing the text to be drawn
format is the object(s) to be insertined into
text
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