Class: Wx::DC

Inherits:
ReadOnlyDC show all
Defined in:
lib/wx/doc/gen/dc.rb,
lib/wx/doc/dc.rb

Overview

Note:

This class is untracked and should not be derived from nor instances extended!

A DC is a “device context” onto which graphics and text can be drawn.

It is intended to represent different output devices and offers a common abstract API for drawing on any of them. DC also provides functions for coordinate transformation and computing text metrics and extends that are inherited from its base class ReadOnlyDC. wxWidgets offers an alternative drawing API based on the modern drawing backends GDI+, CoreGraphics, Cairo and Direct2D. See GraphicsContext, GraphicsRenderer and related classes. There is also a GCDC linking the APIs by offering the DC API on top of a GraphicsContext. DC is an abstract base class and cannot be created directly. Use PaintDC for drawing on screen, MemoryDC for off-screen drawing or PRT::PrinterDC for printing (the remaining drawing contexts ClientDC, WindowDC and ScreenDC are deprecated and don’t work on all platforms any longer). Notice that PaintDC uses the window font and colours by default (starting with wxWidgets 2.9.0) but the other device context classes use system-default values so you always must set the appropriate fonts and colours before using them. In addition to the classes listed above, you can use InfoDC which can only provide information about the device context but not draw on it. This class is useful when you need a device context associated with a window outside of the paint event handler, i.e. when PaintDC can’t be used. In addition to the versions of the methods documented below, there are also versions which accept single Point parameter instead of the two Coord ones or Point and Size instead of the four Coord parameters. Beginning with wxWidgets 2.9.0 the entire DC code has been reorganized. All platform dependent code (actually all drawing code) has been moved into backend classes which derive from a common DCImpl class. The user-visible classes such as ClientDC and PaintDC merely forward all calls to the backend implementation. In wxWidgets 3.3.0 the new ReadOnlyDC class was extracted from DC: it contains all the functions that don’t actually draw on the device context, but just return information about it. This class should be rarely used directly, but some function that used to take DC argument but didn’t need to modify it, now accept ReadOnlyDC instead to make this fact explicit, and such functions can now also be called with InfoDC objects as arguments.

Device and logical units

In the DC context there is a distinction between logical units and device units. Device units are the units native to the particular device; e.g. for a screen, a device unit is a pixel. For a printer, the device unit is defined by the resolution of the printer (usually given in DPI: dot-per-inch). All DC functions use instead logical units, unless where explicitly stated. Logical units are arbitrary units mapped to device units using the current mapping mode (see SetMapMode). This mechanism allows reusing the same code which prints on e.g. a window on the screen to print on e.g. a paper.

Support for Transparency / Alpha Channel

In general DC methods don’t support alpha transparency and the alpha component of Colour is simply ignored and you need to use GraphicsContext for full transparency support. There are, however, a few exceptions: first, under macOS and GTK+ 3 colours with alpha channel are supported in all the normal DC-derived classes as they use GraphicsContext internally. Second, under all platforms SVGFileDC also fully supports alpha channel. In both of these cases the instances of Pen or Brush that are built from Colour use the colour’s alpha values when stroking or filling.

Support for Transformation Matrix

On some platforms (currently under MSW, GTK+ 3, macOS) DC has support for applying an arbitrary affine transformation matrix to its coordinate system (since 3.1.1 this feature is also supported by GCDC in all ports). Call ReadOnlyDC#can_use_transform_matrix to check if this support is available and then call ReadOnlyDC#set_transform_matrix if it is. If the transformation matrix is not supported, ReadOnlyDC#set_transform_matrix always simply returns false and doesn’t do anything. This feature is only available when Setup::USE_DC_TRANSFORM_MATRIX build option is enabled.

Category: Device Contexts, Graphics Device Interface (GDI)

TodoPrecise definition of default/initial state. Pixelwise definition of operations (e.g. last point of a line not drawn).

See Also:

  • Contexts
  • GraphicsContext
  • DCFontChanger
  • DCTextColourChanger
  • DCPenChanger
  • DCBrushChanger
  • DCClipper

Instance Method Summary collapse

Methods inherited from ReadOnlyDC

#can_draw_bitmap, #can_get_text_extent, #can_use_transform_matrix, #device_to_logical, #device_to_logical_rel, #device_to_logical_x, #device_to_logical_x_rel, #device_to_logical_y, #device_to_logical_y_rel, #from_dip, #get_char_height, #get_char_width, #get_content_scale_factor, #get_depth, #get_device_origin, #get_dimensions, #get_dimensions_mm, #get_font, #get_font_metrics, #get_layout_direction, #get_logical_origin, #get_logical_scale, #get_map_mode, #get_multi_line_text_extent, #get_multi_line_text_size, #get_ppi, #get_size, #get_size_mm, #get_text_extent, #get_text_size, #get_transform_matrix, #get_user_scale, #is_ok, #logical_to_device, #logical_to_device_rel, #logical_to_device_x, #logical_to_device_x_rel, #logical_to_device_y, #logical_to_device_y_rel, #reset_transform_matrix, #set_axis_orientation, #set_device_origin, #set_font, #set_layout_direction, #set_logical_origin, #set_logical_scale, #set_map_mode, #set_transform_matrix, #set_user_scale, #to_dip

Methods inherited from Object

#clone, #dup, #initialize, #is_same_as, #un_share

Constructor Details

This class inherits a constructor from Wx::Object

Instance Method Details

#blit(xdest, ydest, width, height, source, xsrc, ysrc, logicalFunc = Wx::RasterOperationMode::COPY, useMask = false, xsrcMask = Wx::DEFAULT_COORD, ysrcMask = Wx::DEFAULT_COORD) ⇒ Boolean

Copy from a source DC to this DC.

With this method you can specify the destination coordinates and the size of area to copy which will be the same for both the source and target DCs. If you need to apply scaling while copying, use #stretch_blit. Notice that source DC coordinates xsrc and ysrc are interpreted using the current source DC coordinate system, i.e. the scale, origin position and axis directions are taken into account when transforming them to physical (pixel) coordinates.

Remark:

There is partial support for #blit in PRT::PostScriptDC, under X.

Parameters:

  • xdest (Integer)

    Destination device context x position.

  • ydest (Integer)

    Destination device context y position.

  • width (Integer)

    Width of source area to be copied.

  • height (Integer)

    Height of source area to be copied.

  • source (Wx::DC)

    Source device context.

  • xsrc (Integer)

    Source device context x position.

  • ysrc (Integer)

    Source device context y position.

  • logicalFunc (Wx::RasterOperationMode) (defaults to: Wx::RasterOperationMode::COPY)

    Logical function to use, see #set_logical_function.

  • useMask (Boolean) (defaults to: false)

    If true, Blit does a transparent blit using the mask that is associated with the bitmap selected into the source device context. The Windows implementation does the following if MaskBlt cannot be used:

    - Creates a temporary bitmap and copies the destination area into it.

    - Copies the source area into the temporary bitmap using the specified logical function.

    - Sets the masked area in the temporary bitmap to BLACK by ANDing the mask bitmap with the temp bitmap with the foreground colour set to WHITE and the bg colour set to BLACK.

    - Sets the unmasked area in the destination area to BLACK by ANDing the mask bitmap with the destination area with the foreground colour set to BLACK and the background colour set to WHITE.

    - ORs the temporary bitmap with the destination area.

    - Deletes the temporary bitmap.

    This sequence of operations ensures that the source’s transparent area need not be black, and logical functions are supported.

    Note: on Windows, blitting with masks can be speeded up considerably by compiling wxWidgets with the Setup::USE_DC_CACHEING option enabled. You can also influence whether MaskBlt or the explicit mask blitting code above is used, by using SystemOptions and setting the no-maskblt option to 1.

  • xsrcMask (Integer) (defaults to: Wx::DEFAULT_COORD)

    Source x position on the mask. If both xsrcMask and ysrcMask are -1, xsrc and ysrc will be assumed for the mask source position. Currently only implemented on Windows.

  • ysrcMask (Integer) (defaults to: Wx::DEFAULT_COORD)

    Source y position on the mask. If both xsrcMask and ysrcMask are -1, xsrc and ysrc will be assumed for the mask source position. Currently only implemented on Windows.

Returns:

  • (Boolean)

See Also:



1316
# File 'lib/wx/doc/gen/dc.rb', line 1316

def blit(xdest, ydest, width, height, source, xsrc, ysrc, logicalFunc=Wx::RasterOperationMode::COPY, useMask=false, xsrcMask=Wx::DEFAULT_COORD, ysrcMask=Wx::DEFAULT_COORD) end

#calc_bounding_box(x, y) ⇒ void

This method returns an undefined value.

Adds the specified point to the bounding box which can be retrieved with #min_x, #max_x and #min_y, #max_y functions.

Parameters:

  • x (Integer)
  • y (Integer)

See Also:



1224
# File 'lib/wx/doc/gen/dc.rb', line 1224

def calc_bounding_box(x, y) end

#clearvoid

This method returns an undefined value.

Clears the device context using the current background brush.

Note that #set_background method must be used to set the brush used by #clear, the brush used for filling the shapes set by #set_brush is ignored by it. If no background brush was set, solid white brush is used to clear the device context.



674
# File 'lib/wx/doc/gen/dc.rb', line 674

def clear; end

#copy_attributes(dc) ⇒ void

This method returns an undefined value.

Copy attributes from another DC.

The copied attributes currently are:

  • Font

  • Text foreground and background colours

  • Background brush

  • Layout direction

Note that the scaling factor is not considered to be an attribute of Wx::DC and is not copied by this function.

Parameters:



1483
# File 'lib/wx/doc/gen/dc.rb', line 1483

def copy_attributes(dc) end

#cross_hair(x, y) ⇒ void #cross_hair(pt) ⇒ void

Overloads:

  • #cross_hair(x, y) ⇒ void

    This method returns an undefined value.

    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.

    Parameters:

    • x (Integer)
    • y (Integer)
  • #cross_hair(pt) ⇒ void

    This method returns an undefined value.

    This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

    Parameters:



1095
# File 'lib/wx/doc/gen/dc.rb', line 1095

def cross_hair(*args) end

#destroy_clipping_regionvoid

This method returns an undefined value.

Destroys the current clipping region so that none of the DC is clipped.



1102
# File 'lib/wx/doc/gen/dc.rb', line 1102

def destroy_clipping_region; end

#draw_arc(xStart, yStart, xEnd, yEnd, xc, yc) ⇒ void #draw_arc(ptStart, ptEnd, centre) ⇒ void

Overloads:

  • #draw_arc(xStart, yStart, xEnd, yEnd, xc, yc) ⇒ void

    This method returns an undefined value.

    Draws an arc from the given start to the given end point.

    Note:

    #draw_elliptic_arc has more clear semantics and it is recommended to use it instead of this function.

    The arc drawn is an arc of the circle centered at (xc, yc). Its start point is (xStart, yStart) whereas its end point is the point of intersection of the line passing by (xc, yc) and (xEnd, yEnd) with the circle passing by (xStart, yStart). The arc is drawn in a counter-clockwise direction between the start and the end points. The current pen is used for the outline and the current brush for filling the shape. Notice that unless the brush is transparent, the lines connecting the centre of the circle to the end points of the arc are drawn as well.

    Parameters:

    • xStart (Integer)
    • yStart (Integer)
    • xEnd (Integer)
    • yEnd (Integer)
    • xc (Integer)
    • yc (Integer)
  • #draw_arc(ptStart, ptEnd, centre) ⇒ void

    This method returns an undefined value.

    This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

    Parameters:



701
# File 'lib/wx/doc/gen/dc.rb', line 701

def draw_arc(*args) end

#draw_bitmap(bitmap, x, y, useMask = false) ⇒ void #draw_bitmap(bmp, pt, useMask = false) ⇒ void

Overloads:

  • #draw_bitmap(bitmap, x, y, useMask = false) ⇒ void

    This method returns an undefined value.

    Draw a bitmap on the device context at the specified point.

    If useMask is true and the bitmap has a transparency mask, 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).

    Parameters:

    • bitmap (Wx::Bitmap)
    • x (Integer)
    • y (Integer)
    • useMask (Boolean) (defaults to: false)

    See Also:

  • #draw_bitmap(bmp, pt, useMask = false) ⇒ void

    This method returns an undefined value.

    This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

    Parameters:

    • bmp (Wx::Bitmap)
    • pt (Array(Integer, Integer), Wx::Point)
    • useMask (Boolean) (defaults to: false)


722
# File 'lib/wx/doc/gen/dc.rb', line 722

def draw_bitmap(*args) end

#draw_check_mark(x, y, width, height) ⇒ void #draw_check_mark(rect) ⇒ void

Overloads:

  • #draw_check_mark(x, y, width, height) ⇒ void

    This method returns an undefined value.

    Draws a check mark inside the given rectangle.

    Parameters:

    • x (Integer)
    • y (Integer)
    • width (Integer)
    • height (Integer)
  • #draw_check_mark(rect) ⇒ void

    This method returns an undefined value.

    This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

    Parameters:



735
# File 'lib/wx/doc/gen/dc.rb', line 735

def draw_check_mark(*args) end

#draw_circle(x, y, radius) ⇒ void #draw_circle(pt, radius) ⇒ void

Overloads:

  • #draw_circle(x, y, radius) ⇒ void

    This method returns an undefined value.

    Draws a circle with the given centre and radius.

    Parameters:

    • x (Integer)
    • y (Integer)
    • radius (Integer)

    See Also:

  • #draw_circle(pt, radius) ⇒ void

    This method returns an undefined value.

    This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

    Parameters:

    • pt (Array(Integer, Integer), Wx::Point)
    • radius (Integer)


751
# File 'lib/wx/doc/gen/dc.rb', line 751

def draw_circle(*args) end

#draw_ellipse(x, y, width, height) ⇒ void #draw_ellipse(pt, size) ⇒ void #draw_ellipse(rect) ⇒ void

Overloads:

  • #draw_ellipse(x, y, width, height) ⇒ void

    This method returns an undefined value.

    Draws an ellipse contained in the rectangle specified either with the given top left corner and the given size or directly.

    The current pen is used for the outline and the current brush for filling the shape.

    Parameters:

    • x (Integer)
    • y (Integer)
    • width (Integer)
    • height (Integer)

    See Also:

  • #draw_ellipse(pt, size) ⇒ void

    This method returns an undefined value.

    This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

    Parameters:

  • #draw_ellipse(rect) ⇒ void

    This method returns an undefined value.

    This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

    Parameters:



772
# File 'lib/wx/doc/gen/dc.rb', line 772

def draw_ellipse(*args) end

#draw_elliptic_arc(x, y, width, height, start, end_) ⇒ void #draw_elliptic_arc(pt, sz, sa, ea) ⇒ void

Overloads:

  • #draw_elliptic_arc(x, y, width, height, start, end_) ⇒ void

    This method returns an undefined value.

    Draws an arc of an ellipse.

    The current pen is used for drawing the arc and the current brush is used for drawing the pie. x and y specify the x and y coordinates of the upper-left corner of the rectangle that contains the ellipse. width and height specify the width and height of the rectangle that contains the ellipse. start and end specify the end points of the arc relative to the three-o’clock position from the center of the rectangle. Angles are specified in degrees with 0 degree angle corresponding to the positive horizontal axis (3 o’clock) direction. Independently of whether start is greater than or less than end, the arc is drawn in the counter-clockwise direction. Also, if start is equal to end, a complete ellipse is drawn. Notice that unlike #draw_arc, this function does not draw the lines to the arc ends, even when using non-transparent brush.

    Parameters:

    • x (Integer)
    • y (Integer)
    • width (Integer)
    • height (Integer)
    • start (Float)
    • end_ (Float)
  • #draw_elliptic_arc(pt, sz, sa, ea) ⇒ void

    This method returns an undefined value.

    This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

    Parameters:

    • pt (Array(Integer, Integer), Wx::Point)
    • sz (Array(Integer, Integer), Wx::Size)
    • sa (Float)
    • ea (Float)


797
# File 'lib/wx/doc/gen/dc.rb', line 797

def draw_elliptic_arc(*args) end

#draw_icon(icon, x, y) ⇒ void #draw_icon(icon, pt) ⇒ void

Overloads:

  • #draw_icon(icon, x, y) ⇒ void

    This method returns an undefined value.

    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.

    Parameters:

    • icon (Wx::Icon)
    • x (Integer)
    • y (Integer)
  • #draw_icon(icon, pt) ⇒ void

    This method returns an undefined value.

    This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

    Parameters:



812
# File 'lib/wx/doc/gen/dc.rb', line 812

def draw_icon(*args) end

#draw_label(text, bitmap, rect, alignment = (Wx::Alignment::ALIGN_LEFT|Wx::Alignment::ALIGN_TOP), indexAccel = -1, rectBounding = nil) ⇒ void #draw_label(text, rect, alignment = (Wx::Alignment::ALIGN_LEFT|Wx::Alignment::ALIGN_TOP), indexAccel = -1) ⇒ void

Overloads:

  • #draw_label(text, bitmap, rect, alignment = (Wx::Alignment::ALIGN_LEFT|Wx::Alignment::ALIGN_TOP), indexAccel = -1, rectBounding = nil) ⇒ void

    This method returns an undefined value.

    Draw optional bitmap and the text into the given rectangle and aligns it as specified by alignment parameter; it also will emphasize the character with the given index if it is != -1 and return the bounding rectangle if required.

    Parameters:

    • text (String)
    • bitmap (Wx::Bitmap)
    • rect (Wx::Rect)
    • alignment (Integer) (defaults to: (Wx::Alignment::ALIGN_LEFT|Wx::Alignment::ALIGN_TOP))
    • indexAccel (Integer) (defaults to: -1)
    • rectBounding (Wx::Rect) (defaults to: nil)
  • #draw_label(text, rect, alignment = (Wx::Alignment::ALIGN_LEFT|Wx::Alignment::ALIGN_TOP), indexAccel = -1) ⇒ void

    This method returns an undefined value.

    This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

    Parameters:

    • text (String)
    • rect (Wx::Rect)
    • alignment (Integer) (defaults to: (Wx::Alignment::ALIGN_LEFT|Wx::Alignment::ALIGN_TOP))
    • indexAccel (Integer) (defaults to: -1)


830
# File 'lib/wx/doc/gen/dc.rb', line 830

def draw_label(*args) end

#draw_line(x1, y1, x2, y2) ⇒ void #draw_line(pt1, pt2) ⇒ void

Overloads:

  • #draw_line(x1, y1, x2, y2) ⇒ void

    This method returns an undefined value.

    Draws a line from the first point to the second.

    The current pen is used for drawing the line. Note that the point (x2, y2) is not part of the line and is not drawn by this function (this is consistent with the behaviour of many other toolkits).

    Parameters:

    • x1 (Integer)
    • y1 (Integer)
    • x2 (Integer)
    • y2 (Integer)
  • #draw_line(pt1, pt2) ⇒ void

    This method returns an undefined value.

    This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

    Parameters:



846
# File 'lib/wx/doc/gen/dc.rb', line 846

def draw_line(*args) end

#draw_lines(points, xoffset = 0, yoffset = 0) ⇒ void

This method returns an undefined value.

Draws lines using an array of points of size n adding the optional offset coordinate.

The current pen is used for drawing the lines.

Parameters:

  • points (Array<Wx::Point>, Array<Array<Integer>>)
  • xoffset (Integer) (defaults to: 0)
  • yoffset (Integer) (defaults to: 0)


855
# File 'lib/wx/doc/gen/dc.rb', line 855

def draw_lines(points, xoffset=0, yoffset=0) end

#draw_point(x, y) ⇒ void #draw_point(pt) ⇒ void

Overloads:

  • #draw_point(x, y) ⇒ void

    This method returns an undefined value.

    Draws a point using the color of the current pen.

    Note that the other properties of the pen are not used, such as width.

    Parameters:

    • x (Integer)
    • y (Integer)
  • #draw_point(pt) ⇒ void

    This method returns an undefined value.

    This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

    Parameters:



868
# File 'lib/wx/doc/gen/dc.rb', line 868

def draw_point(*args) end

#draw_poly_polygon(points, xoffset = 0, yoffset = 0, fill_style = Wx::PolygonFillMode::ODDEVEN_RULE) ⇒ void

This method returns an undefined value.

Draws two or more filled polygons using an array of points, adding the optional offset coordinates.

Notice that for the platforms providing a native implementation of this function (Windows and PostScript-based Wx::DC currently), this is more efficient than using #draw_polygon in a loop. n specifies the number of polygons to draw, the array count of size n specifies the number of points in each of the polygons in the points array. The last argument specifies the fill rule: PolygonFillMode::ODDEVEN_RULE (the default) or PolygonFillMode::WINDING_RULE. The current pen is used for drawing the outline, and the current brush for filling the shape. Using a transparent brush suppresses filling. The polygons maybe disjoint or overlapping. Each polygon specified in a call to #draw_poly_polygon must be closed. Unlike polygons created by the #draw_polygon member function, the polygons created by this method are not closed automatically.

Parameters:

  • points (Array<Array<Wx::Point>>, Array<Array<Array<Integer>>>)
  • xoffset (Integer) (defaults to: 0)
  • yoffset (Integer) (defaults to: 0)
  • fill_style (Wx::PolygonFillMode) (defaults to: Wx::PolygonFillMode::ODDEVEN_RULE)


894
# File 'lib/wx/doc/gen/dc.rb', line 894

def draw_poly_polygon(points, xoffset=0, yoffset=0, fill_style=Wx::PolygonFillMode::ODDEVEN_RULE) end

#draw_polygon(points, xoffset = 0, yoffset = 0, fill_style = Wx::PolygonFillMode::ODDEVEN_RULE) ⇒ void

This method returns an undefined value.

Draws a filled polygon using an array of points of size n, adding the optional offset coordinate.

The first and last points are automatically closed. The last argument specifies the fill rule: PolygonFillMode::ODDEVEN_RULE (the default) or PolygonFillMode::WINDING_RULE. The current pen is used for drawing the outline, and the current brush for filling the shape. Using a transparent brush suppresses filling.

Parameters:

  • points (Array<Wx::Point>, Array<Array<Integer>>)
  • xoffset (Integer) (defaults to: 0)
  • yoffset (Integer) (defaults to: 0)
  • fill_style (Wx::PolygonFillMode) (defaults to: Wx::PolygonFillMode::ODDEVEN_RULE)


880
# File 'lib/wx/doc/gen/dc.rb', line 880

def draw_polygon(points, xoffset=0, yoffset=0, fill_style=Wx::PolygonFillMode::ODDEVEN_RULE) end

#draw_rectangle(x, y, width, height) ⇒ void #draw_rectangle(pt, sz) ⇒ void #draw_rectangle(rect) ⇒ void

Overloads:

  • #draw_rectangle(x, y, width, height) ⇒ void

    This method returns an undefined value.

    Draws a rectangle with the given corner coordinate and size.

    Normally, x and y specify the top left corner coordinates and both width and height are positive, however they are also allowed to be negative, in which case the corresponding corner coordinate refers to the right or bottom corner instead. The current pen is used for the outline and the current brush for filling the shape. Special case: If the current pen is transparent, then the current brush is used for the entire rectangle.

    Parameters:

    • x (Integer)
    • y (Integer)
    • width (Integer)
    • height (Integer)
  • #draw_rectangle(pt, sz) ⇒ void

    This method returns an undefined value.

    This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

    Parameters:

  • #draw_rectangle(rect) ⇒ void

    This method returns an undefined value.

    This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

    Parameters:



915
# File 'lib/wx/doc/gen/dc.rb', line 915

def draw_rectangle(*args) end

#draw_rotated_text(text, x, y, angle) ⇒ void #draw_rotated_text(text, point, angle) ⇒ void

Overloads:

  • #draw_rotated_text(text, x, y, angle) ⇒ void

    This method returns an undefined value.

    Draws the text rotated by angle degrees (positive angles are counterclockwise; the full angle is 360 degrees).

    Notice that, as with #draw_text, the text can contain multiple lines separated by the new line ('\n') characters.

    Note:

    Under MSW only TrueType fonts can be drawn by this function. In particular, a font different from NORMAL_FONT should be used as the latter is not a TrueType font. SWISS_FONT is an example of a font which is.

    Parameters:

    • text (String)
    • x (Integer)
    • y (Integer)
    • angle (Float)

    See Also:

  • #draw_rotated_text(text, point, angle) ⇒ void

    This method returns an undefined value.

    This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

    Parameters:

    • text (String)
    • point (Array(Integer, Integer), Wx::Point)
    • angle (Float)


939
# File 'lib/wx/doc/gen/dc.rb', line 939

def draw_rotated_text(*args) end

#draw_rounded_rectangle(x, y, width, height, radius) ⇒ void #draw_rounded_rectangle(pt, sz, radius) ⇒ void #draw_rounded_rectangle(rect, radius) ⇒ void

Overloads:

  • #draw_rounded_rectangle(x, y, width, height, radius) ⇒ void

    This method returns an undefined value.

    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.

    Parameters:

    • x (Integer)
    • y (Integer)
    • width (Integer)
    • height (Integer)
    • radius (Float)
  • #draw_rounded_rectangle(pt, sz, radius) ⇒ void

    This method returns an undefined value.

    This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

    Parameters:

    • pt (Array(Integer, Integer), Wx::Point)
    • sz (Array(Integer, Integer), Wx::Size)
    • radius (Float)
  • #draw_rounded_rectangle(rect, radius) ⇒ void

    This method returns an undefined value.

    This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

    Parameters:



963
# File 'lib/wx/doc/gen/dc.rb', line 963

def draw_rounded_rectangle(*args) end

#draw_spline(points) ⇒ void #draw_spline(x1, y1, x2, y2, x3, y3) ⇒ void

Overloads:

  • #draw_spline(points) ⇒ void

    This method returns an undefined value.

    Draws a spline between all given points using the current pen.

    The number of points must be at least 2 for the spline to be drawn.

    Note:

    Drawn curve is not an interpolating curve - it does not go through all points. It may be considered a smoothing curve.

    Parameters:

    • points (Array<Wx::Point>, Array<Array<Integer>>)
  • #draw_spline(x1, y1, x2, y2, x3, y3) ⇒ void

    This method returns an undefined value.

    This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

    Parameters:

    • x1 (Integer)
    • y1 (Integer)
    • x2 (Integer)
    • y2 (Integer)
    • x3 (Integer)
    • y3 (Integer)


986
# File 'lib/wx/doc/gen/dc.rb', line 986

def draw_spline(*args) end

#draw_text(text, x, y) ⇒ void #draw_text(text, pt) ⇒ void

Overloads:

  • #draw_text(text, x, y) ⇒ void

    This method returns an undefined value.

    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 ReadOnlyDC#get_text_extent for how to get the dimensions of a text string, which can be used to position the text more precisely and #draw_label if you need to align the string differently. Starting from wxWidgets 2.9.2 text parameter can be a multi-line string, i.e. contain new line characters, and will be rendered correctly.

    Note:

    The current logical function is ignored by this function.

    Parameters:

    • text (String)
    • x (Integer)
    • y (Integer)
  • #draw_text(text, pt) ⇒ void

    This method returns an undefined value.

    This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

    Parameters:

    • text (String)
    • pt (Array(Integer, Integer), Wx::Point)


1008
# File 'lib/wx/doc/gen/dc.rb', line 1008

def draw_text(*args) end

#end_docvoid

This method returns an undefined value.

Ends a document (only relevant when outputting to a printer).



1262
# File 'lib/wx/doc/gen/dc.rb', line 1262

def end_doc; end

#end_pagevoid

This method returns an undefined value.

Ends a document page (only relevant when outputting to a printer).



1266
# File 'lib/wx/doc/gen/dc.rb', line 1266

def end_page; end

#flood_fill(x, y, colour, style = Wx::FloodFillStyle::FLOOD_SURFACE) ⇒ Boolean #flood_fill(pt, col, style = Wx::FloodFillStyle::FLOOD_SURFACE) ⇒ Boolean

Overloads:

  • #flood_fill(x, y, colour, style = Wx::FloodFillStyle::FLOOD_SURFACE) ⇒ Boolean

    Flood fills the device context starting from the given point, using the current brush colour, and using a style:

    Currently this method is not implemented in WXOSX and does nothing there. 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.

    Note:

    This method shouldn't be used with PaintDC under non-Windows platforms as it uses #get_pixel internally and this may give wrong results, notably in WXGTK. If you need to flood fill PaintDC, create a temporary MemoryDC, flood fill it and then blit it to, or draw as a bitmap on, PaintDC. See the example of doing this in the drawing sample and BufferedPaintDC class.

    Parameters:

    Returns:

    • (Boolean)
  • #flood_fill(pt, col, style = Wx::FloodFillStyle::FLOOD_SURFACE) ⇒ Boolean

    This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

    Parameters:

    Returns:

    • (Boolean)


1082
# File 'lib/wx/doc/gen/dc.rb', line 1082

def flood_fill(*args) end

#get_as_bitmap(subrect = nil) ⇒ Wx::Bitmap Also known as: as_bitmap

If supported by the platform and the type of DC, fetch the contents of the DC, or a subset of it, as a bitmap.

Parameters:

Returns:



1488
# File 'lib/wx/doc/gen/dc.rb', line 1488

def get_as_bitmap(subrect=nil) end

#get_backgroundWx::Brush Also known as: background

Gets the brush used for painting the background.

Returns:

See Also:



1372
# File 'lib/wx/doc/gen/dc.rb', line 1372

def get_background; end

#get_background_modeInteger Also known as: background_mode

Returns the current background mode: BrushStyle::BRUSHSTYLE_SOLID or BrushStyle::BRUSHSTYLE_TRANSPARENT.

Returns:

  • (Integer)

See Also:



1174
# File 'lib/wx/doc/gen/dc.rb', line 1174

def get_background_mode; end

#get_brushWx::Brush Also known as: brush

Gets the current brush.

Returns:

See Also:



1380
# File 'lib/wx/doc/gen/dc.rb', line 1380

def get_brush; end

#get_clipping_box(x, y) ⇒ Array(Boolean,Integer,Integer) #get_clipping_box(rect) ⇒ Boolean Also known as: clipping_box

Overloads:

  • #get_clipping_box(x, y) ⇒ Array(Boolean,Integer,Integer)

    Gets the rectangle surrounding the current clipping region.

    If no clipping region is set this function returns the extent of the device context.

    Remark:

    Clipping region is given in logical coordinates.

    true if there is a clipping region or false if there is no active clipping region (note that this return value is available only since wxWidgets 3.1.2, this function didn’t return anything in the previous versions).

    Parameters:

    • x (Integer)

      If non-null, filled in with the logical horizontal coordinate of the top left corner of the clipping region if the function returns true or 0 otherwise.

    • y (Integer)

      If non-null, filled in with the logical vertical coordinate of the top left corner of the clipping region if the function returns true or 0 otherwise.

    Returns:

    • (Array(Boolean,Integer,Integer))
  • #get_clipping_box(rect) ⇒ Boolean

    This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

    Parameters:

    Returns:

    • (Boolean)


1123
# File 'lib/wx/doc/gen/dc.rb', line 1123

def get_clipping_box(*args) end

#get_graphics_contextWx::GraphicsContext Also known as: graphics_context

If supported by the platform and the Wx::DC implementation, this method will return the GraphicsContext associated with the DC.

Otherwise nil is returned.

Returns:



1495
# File 'lib/wx/doc/gen/dc.rb', line 1495

def get_graphics_context; end

#get_logical_functionWx::RasterOperationMode Also known as: logical_function

Gets the current logical function.



1421
# File 'lib/wx/doc/gen/dc.rb', line 1421

def get_logical_function; end

#get_penWx::Pen Also known as: pen

Gets the current pen.

Returns:

See Also:



1388
# File 'lib/wx/doc/gen/dc.rb', line 1388

def get_pen; end

#get_pixel(x, y, colour) ⇒ Boolean Also known as: pixel

Gets in colour the colour at the specified location.

This method isn’t available for PRT::PostScriptDC or MetafileDC nor for any DC in WXOSX port and simply returns false there.

Note:

Setting a pixel can be done using #draw_point.

Note:

This method shouldn't be used with PaintDC as accessing the DC while drawing can result in unexpected results, notably in WXGTK.

Parameters:

Returns:

  • (Boolean)


1443
# File 'lib/wx/doc/gen/dc.rb', line 1443

def get_pixel(x, y, colour) end

#get_text_backgroundWx::Colour, ... Also known as: text_background

Gets the current text background colour.

Returns:

See Also:



1182
# File 'lib/wx/doc/gen/dc.rb', line 1182

def get_text_background; end

#get_text_foregroundWx::Colour, ... Also known as: text_foreground

Gets the current text foreground colour.

Returns:

See Also:



1190
# File 'lib/wx/doc/gen/dc.rb', line 1190

def get_text_foreground; end

#gradient_fill_concentric(rect, initialColour, destColour) ⇒ void #gradient_fill_concentric(rect, initialColour, destColour, circleCenter) ⇒ void

Overloads:

  • #gradient_fill_concentric(rect, initialColour, destColour) ⇒ void

    This method returns an undefined value.

    Fill the area specified by rect with a radial gradient, starting from initialColour at the centre of the circle and fading to destColour on the circle outside.

    The circle is placed at the centre of rect.

    Note:

    Currently this function is very slow, don't use it for real-time drawing.

    Parameters:

  • #gradient_fill_concentric(rect, initialColour, destColour, circleCenter) ⇒ void

    This method returns an undefined value.

    Fill the area specified by rect with a radial gradient, starting from initialColour at the centre of the circle and fading to destColour on the circle outside.

    circleCenter are the relative coordinates of centre of the circle in the specified rect.

    Note:

    Currently this function is very slow, don't use it for real-time drawing.

    Parameters:



1039
# File 'lib/wx/doc/gen/dc.rb', line 1039

def gradient_fill_concentric(*args) end

#gradient_fill_linear(rect, initialColour, destColour, nDirection = Wx::Direction::RIGHT) ⇒ void

This method returns an undefined value.

Fill the area specified by rect with a linear gradient, starting from initialColour and eventually fading to destColour.

The nDirection specifies the direction of the colour change, default is to use initialColour on the left part of the rectangle and destColour on the right one.

Parameters:



1049
# File 'lib/wx/doc/gen/dc.rb', line 1049

def gradient_fill_linear(rect, initialColour, destColour, nDirection=Wx::Direction::RIGHT) end

#max_xInteger

Gets the maximum horizontal extent used in drawing commands so far.

Returns:

  • (Integer)


1228
# File 'lib/wx/doc/gen/dc.rb', line 1228

def max_x; end

#max_yInteger

Gets the maximum vertical extent used in drawing commands so far.

Returns:

  • (Integer)


1232
# File 'lib/wx/doc/gen/dc.rb', line 1232

def max_y; end

#min_xInteger

Gets the minimum horizontal extent used in drawing commands so far.

Returns:

  • (Integer)


1236
# File 'lib/wx/doc/gen/dc.rb', line 1236

def min_x; end

#min_yInteger

Gets the minimum vertical extent used in drawing commands so far.

Returns:

  • (Integer)


1240
# File 'lib/wx/doc/gen/dc.rb', line 1240

def min_y; end

#reset_bounding_boxvoid

This method returns an undefined value.

Resets the bounding box: after a call to this function, the bounding box doesn’t contain anything.

See Also:



1247
# File 'lib/wx/doc/gen/dc.rb', line 1247

def reset_bounding_box; end

#set_background(brush) ⇒ void Also known as: background=

This method returns an undefined value.

Sets the current background brush for the DC.

Parameters:



1394
# File 'lib/wx/doc/gen/dc.rb', line 1394

def set_background(brush) end

#set_background_mode(mode) ⇒ void Also known as: background_mode=

This method returns an undefined value.

Change the current background mode.

This setting determines whether text will be drawn with a background colour or not. Default is BrushStyle::BRUSHSTYLE_TRANSPARENT, i.e. text background is not drawn.

Parameters:



1199
# File 'lib/wx/doc/gen/dc.rb', line 1199

def set_background_mode(mode) end

#set_brush(brush) ⇒ void Also known as: brush=

This method returns an undefined value.

Sets the current brush for the DC.

If the argument is NULL_BRUSH (or another invalid brush; see Brush#is_ok), the current brush is selected out of the device context (leaving Wx::DC without any valid brush), allowing the current brush to be destroyed safely.



1404
# File 'lib/wx/doc/gen/dc.rb', line 1404

def set_brush(brush) end

#set_clipping_region(x, y, width, height) ⇒ void #set_clipping_region(pt, sz) ⇒ void #set_clipping_region(rect) ⇒ void Also known as: clipping_region=

Overloads:

  • #set_clipping_region(x, y, width, height) ⇒ void

    This method returns an undefined value.

    Sets the clipping region for this device context to the intersection of the given region described by the parameters of this method and the previously set clipping region.

    The clipping region is an area to which drawing is restricted. Possible uses for the clipping region are for clipping text or for speeding up window redraws when only a known area of the screen is damaged.

    Remark:

    - Clipping region should be given in logical coordinates. - Calling this function can only make the clipping region smaller, never larger. - You need to call #destroy_clipping_region first if you want to set the clipping region exactly to the region specified. - If resulting clipping region is empty, then all drawing on the DC is clipped out (all changes made by drawing operations are masked out).

    Parameters:

    • x (Integer)
    • y (Integer)
    • width (Integer)
    • height (Integer)

    See Also:

  • #set_clipping_region(pt, sz) ⇒ void

    This method returns an undefined value.

    This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

    Parameters:

  • #set_clipping_region(rect) ⇒ void

    This method returns an undefined value.

    This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

    Parameters:



1158
# File 'lib/wx/doc/gen/dc.rb', line 1158

def set_clipping_region(*args) end

#set_device_clipping_region(region) ⇒ void Also known as: device_clipping_region=

This method returns an undefined value.

Sets the clipping region for this device context.

Unlike #set_clipping_region, this function works with physical coordinates and not with the logical ones.

Parameters:



1166
# File 'lib/wx/doc/gen/dc.rb', line 1166

def set_device_clipping_region(region) end

#set_graphics_context(ctx) ⇒ void Also known as: graphics_context=

This method returns an undefined value.

Associate a GraphicsContext with the DC.

Ignored if not supported by the specific Wx::DC implementation. It is unlikely that this will need to be used in application code.

Parameters:



1503
# File 'lib/wx/doc/gen/dc.rb', line 1503

def set_graphics_context(ctx) end

#set_logical_function(function) ⇒ void Also known as: logical_function=

This method returns an undefined value.

Sets the current logical function for the device context.

Note:

This function is not fully supported in all ports, due to the limitations of the underlying drawing model. Notably, RasterOperationMode::INVERT which was commonly used for drawing rubber bands or other moving outlines in the past, is not, and will not, be supported by WXGTK3 and WXOSX. The suggested alternative is to draw temporarily objects normally and refresh the (affected part of the) window to remove them later.

It determines how a source pixel (from a pen or brush colour, or source device context if using #blit) combines with a destination pixel in the current device context. Text drawing is not affected by this function. See RasterOperationMode enumeration values for more info. The default is RasterOperationMode::COPY, which simply draws with the current colour. The others combine the current colour and the background using a logical operation.

Parameters:



1459
# File 'lib/wx/doc/gen/dc.rb', line 1459

def set_logical_function(function) end

#set_palette(palette) ⇒ void Also known as: palette=

This method returns an undefined value.

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 NULL_PALETTE, the current palette is selected out of the device context, and the original palette restored.

Parameters:

See Also:



1468
# File 'lib/wx/doc/gen/dc.rb', line 1468

def set_palette(palette) end

#set_pen(pen) ⇒ void Also known as: pen=

This method returns an undefined value.

Sets the current pen for the DC.

If the argument is NULL_PEN (or another invalid pen; see Pen#is_ok), the current pen is selected out of the device context (leaving Wx::DC without any valid pen), allowing the current pen to be destroyed safely.



1413
# File 'lib/wx/doc/gen/dc.rb', line 1413

def set_pen(pen) end

#set_text_background(colour) ⇒ void Also known as: text_background=

This method returns an undefined value.

Sets the current text background colour for the DC.

Parameters:



1205
# File 'lib/wx/doc/gen/dc.rb', line 1205

def set_text_background(colour) end

#set_text_foreground(colour) ⇒ void Also known as: text_foreground=

This method returns an undefined value.

Sets the current text foreground colour for the DC.



1214
# File 'lib/wx/doc/gen/dc.rb', line 1214

def set_text_foreground(colour) end

#start_doc(message) ⇒ Boolean

Starts a document (only relevant when outputting to a printer).

message is a message to show while printing.

Parameters:

  • message (String)

Returns:

  • (Boolean)


1254
# File 'lib/wx/doc/gen/dc.rb', line 1254

def start_doc(message) end

#start_pagevoid

This method returns an undefined value.

Starts a document page (only relevant when outputting to a printer).



1258
# File 'lib/wx/doc/gen/dc.rb', line 1258

def start_page; end

#stretch_blit(xdest, ydest, dstWidth, dstHeight, source, xsrc, ysrc, srcWidth, srcHeight, logicalFunc = Wx::RasterOperationMode::COPY, useMask = false, xsrcMask = Wx::DEFAULT_COORD, ysrcMask = Wx::DEFAULT_COORD) ⇒ Boolean

Copy from a source DC to this DC possibly changing the scale.

Unlike #blit, this method allows specifying different source and destination region sizes, meaning that it can stretch or shrink it while copying. The same can be achieved by changing the scale of the source or target DC but calling this method is simpler and can also be more efficient if the platform provides a native implementation of it. The meaning of its other parameters is the same as with #blit, in particular all source coordinates are interpreted using the source DC coordinate system, i.e. are affected by its scale, origin translation and axis direction.

There is partial support for #blit in PRT::PostScriptDC, under X. See MemoryDC for typical usage.

Parameters:

  • xdest (Integer)

    Destination device context x position.

  • ydest (Integer)

    Destination device context y position.

  • dstWidth (Integer)

    Width of destination area.

  • dstHeight (Integer)

    Height of destination area.

  • source (Wx::DC)

    Source device context.

  • xsrc (Integer)

    Source device context x position.

  • ysrc (Integer)

    Source device context y position.

  • srcWidth (Integer)

    Width of source area to be copied.

  • srcHeight (Integer)

    Height of source area to be copied.

  • logicalFunc (Wx::RasterOperationMode) (defaults to: Wx::RasterOperationMode::COPY)

    Logical function to use, see #set_logical_function.

  • useMask (Boolean) (defaults to: false)

    If true, Blit does a transparent blit using the mask that is associated with the bitmap selected into the source device context. The Windows implementation does the following if MaskBlt cannot be used:

    - Creates a temporary bitmap and copies the destination area into it.

    - Copies the source area into the temporary bitmap using the specified logical function.

    - Sets the masked area in the temporary bitmap to BLACK by ANDing the mask bitmap with the temp bitmap with the foreground colour set to WHITE and the bg colour set to BLACK.

    - Sets the unmasked area in the destination area to BLACK by ANDing the mask bitmap with the destination area with the foreground colour set to BLACK and the background colour set to WHITE.

    - ORs the temporary bitmap with the destination area.

    - Deletes the temporary bitmap.

    This sequence of operations ensures that the source’s transparent area need not be black, and logical functions are supported.

    Note: on Windows, blitting with masks can be speeded up considerably by compiling wxWidgets with the Setup::USE_DC_CACHEING option enabled. You can also influence whether MaskBlt or the explicit mask blitting code above is used, by using SystemOptions and setting the no-maskblt option to 1.

  • xsrcMask (Integer) (defaults to: Wx::DEFAULT_COORD)

    Source x position on the mask. If both xsrcMask and ysrcMask are Wx::DEFAULT_COORD, xsrc and ysrc will be assumed for the mask source position. Currently only implemented on Windows.

  • ysrcMask (Integer) (defaults to: Wx::DEFAULT_COORD)

    Source y position on the mask. If both xsrcMask and ysrcMask are Wx::DEFAULT_COORD, xsrc and ysrc will be assumed for the mask source position. Currently only implemented on Windows.

Returns:

  • (Boolean)

See Also:



1365
# File 'lib/wx/doc/gen/dc.rb', line 1365

def stretch_blit(xdest, ydest, dstWidth, dstHeight, source, xsrc, ysrc, srcWidth, srcHeight, logicalFunc=Wx::RasterOperationMode::COPY, useMask=false, xsrcMask=Wx::DEFAULT_COORD, ysrcMask=Wx::DEFAULT_COORD) end

#with_background_mode(mode) {|dc| ... } ⇒ void Also known as: with_bg_mode

This method returns an undefined value.

Provides similar functionality like wxDCTextBgModeChanger setting the given mode as the active background mode for the DC for the duration of the block execution restoring the previous mode afterwards.

Parameters:

  • mode (Integer)

    new mode to use during block execution

Yield Parameters:

  • dc (Wx::DC)

    the DC (self)



53
# File 'lib/wx/doc/dc.rb', line 53

def with_background_mode(mode) end

#with_brush(brush) {|dc| ... } ⇒ void

This method returns an undefined value.

Provides similar functionality like wxDCBrushChanger setting the given brush as the active brush for the DC for the duration of the block execution restoring the previous brush afterwards.

Parameters:

  • brush (Wx::Brush)

    new brush to use during block execution

Yield Parameters:

  • dc (Wx::DC)

    the DC (self)



16
# File 'lib/wx/doc/dc.rb', line 16

def with_brush(brush) end

#with_font(font) {|dc| ... } ⇒ void

This method returns an undefined value.

Provides similar functionality like wxDCFontChanger setting the given font as the active font for the DC for the duration of the block execution restoring the previous font afterwards.

Parameters:

  • font (Wx::Font)

    new font to use during block execution

Yield Parameters:

  • dc (Wx::DC)

    the DC (self)



30
# File 'lib/wx/doc/dc.rb', line 30

def with_font(font) end

#with_pen(pen) {|dc| ... } ⇒ void

This method returns an undefined value.

Provides similar functionality like wxDCPenChanger setting the given pen as the active pen for the DC for the duration of the block execution restoring the previous pen afterwards.

Parameters:

  • pen (Wx::Pen)

    new pen to use during block execution

Yield Parameters:

  • dc (Wx::DC)

    the DC (self)



23
# File 'lib/wx/doc/dc.rb', line 23

def with_pen(pen) end

#with_text_background(clr) {|dc| ... } ⇒ void Also known as: with_text_bg

This method returns an undefined value.

Provides similar functionality like wxDCTextBgColourChanger setting the given colour as the active text background colour for the DC for the duration of the block execution restoring the previous colour afterwards.

Parameters:

  • clr (Wx::Colour)

    new colour to use during block execution

Yield Parameters:

  • dc (Wx::DC)

    the DC (self)



45
# File 'lib/wx/doc/dc.rb', line 45

def with_text_background(clr) end

#with_text_foreground(clr) {|dc| ... } ⇒ void Also known as: with_text_fg

This method returns an undefined value.

Provides similar functionality like wxDCTextColourChanger setting the given colour as the active text foreground colour for the DC for the duration of the block execution restoring the previous colour afterwards.

Parameters:

  • clr (Wx::Colour)

    new colour to use during block execution

Yield Parameters:

  • dc (Wx::DC)

    the DC (self)



37
# File 'lib/wx/doc/dc.rb', line 37

def with_text_foreground(clr) end