Graphics

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
Subtopics

Graphics

[proc]
begin_drawing
( atom dc )

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.


Graphics

[proc]
clear_dc
( atom dc )

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

[proc]
draw_line
( atom dc, sequence points )

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

[proc]
draw_point
( atom dc, atom x, atom y )

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:

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

[proc]
end_drawing
( atom dc )

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

[func]
find_color
( sequence name )

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

[func]
get_dc_size
( atom dc )

Category: Graphics

Returns: Width and height

Returns the width and height of the dc in pixels.


Graphics

[func]
get_dc_text_extent
( atom dc, sequence text )

Category: Graphics

Returns: Dimensions of the specified text

Gets the dimensions of text using the font in the current dc.


Graphics

[func]
get_first_region
( atom iter )

Category: Graphics

Returns a sequence with the x, y and width and height of the first region.


Graphics

[func]
get_font
( atom dc )

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

[func]
get_next_region
( atom iter )

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

[func]
get_regions
( atom window )

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

[func]
get_text_extent
( atom win, sequence text, atom font )

Category: Graphics

Returns: Dimensions of the specified text

Gets the dimensions of text using the specified font.


Graphics

[func]
get_user_scale
( atom dc, atom x, atom y )

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

[proc]
set_background_mode
( atom dc, atom mode )

Category: Graphics

mode may be either wxSOLID (text is drawn with a background color) or wxTRANSPARENT (text is drawn without a background color).


Graphics

[proc]
set_back_brush
( atom dc, atom brush )

Category: Graphics

Sets background brush to be the current wxBrush for dc wxDC.


Graphics

[proc]
set_brush
( atom dc, atom brush )

Category: Graphics

Sets brush to be the current wxBrush for dc wxDC.


Graphics

[proc]
set_default_font
( atom win, atom font )

Category: Graphics

Sets the default font for a window.


Graphics

[proc]
set_font
( atom dc, atom font )

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

[proc]
set_pen
( atom dc, atom pen )

Category: Graphics

Sets pen to be the current wxPen for dc wxDC.


Graphics

[proc]
set_text_back_color
( atom dc, object color )

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

[proc]
set_text_color
( atom dc, object color )

Category: Graphics

Set the current text foreground color. color can be either an RGB sequence, or a pointer to a wxColour object.


Graphics

[proc]
set_user_scale
( atom dc, atom x, atom y )

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:

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:

text is a sequence containing the text to be drawn