Class: Wx::DC

Inherits:
Object 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. 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, ClientDC, WindowDC, ScreenDC, MemoryDC or PRT::PrinterDC. Notice that device contexts which are associated with windows (i.e. ClientDC, WindowDC and PaintDC) use 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 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.

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 #set_map_mode). 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 #can_use_transform_matrix to check if this support is available and then call #set_transform_matrix if it is. If the transformation matrix is not supported, #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 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:



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

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:



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

def calc_bounding_box(x, y) end

#can_draw_bitmapBoolean Also known as: can_draw_bitmap?

Does the DC support drawing bitmaps?

Returns:

  • (Boolean)


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

def can_draw_bitmap; end

#can_get_text_extentBoolean Also known as: can_get_text_extent?

Does the DC support calculating the size required to draw text?

Returns:

  • (Boolean)


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

def can_get_text_extent; end

#can_use_transform_matrixBoolean Also known as: can_use_transform_matrix?

Check if the use of transformation matrix is supported by the current system.

This function returns true for MSW and GTK+ 3 platforms and since 3.1.1 also for GCDC in all ports.

Returns:

  • (Boolean)


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

def can_use_transform_matrix; 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.



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

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:

  • dc (Wx::DC)

    A valid (i.e. its #is_ok must return true) source device context.



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

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:



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

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.



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

def destroy_clipping_region; end

#device_to_logical(x, y) ⇒ Wx::Point #device_to_logical(pt) ⇒ Wx::Point

Overloads:

  • #device_to_logical(x, y) ⇒ Wx::Point

    Converts device (x, y) coordinates to logical coordinates taking into account all applied transformations like the current mapping mode, scale factors, device origin, axes orientation, affine transformation.

    Parameters:

    • x (Integer)
    • y (Integer)

    Returns:

  • #device_to_logical(pt) ⇒ Wx::Point

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

    Parameters:

    Returns:



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

def device_to_logical(*args) end

#device_to_logical_rel(x, y) ⇒ Wx::Size #device_to_logical_rel(dim) ⇒ Wx::Size

Overloads:

  • #device_to_logical_rel(x, y) ⇒ Wx::Size

    Converts device x, y coordinates to relative logical coordinates taking into account all applied transformations like the current mapping mode, scale factors, affine transformation.

    Use this for converting distances like e.g. width and height.

    Parameters:

    • x (Integer)
    • y (Integer)

    Returns:

  • #device_to_logical_rel(dim) ⇒ Wx::Size

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

    Parameters:

    • dim (Array(Integer, Integer), Wx::Size)

    Returns:



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

def device_to_logical_rel(*args) end

#device_to_logical_x(x) ⇒ Integer

Convert device X coordinate to logical coordinate, using the current mapping mode, user scale factor, device origin and axis orientation.

Note:

Affine transformation applied to the coordinate system with #set_transform_matrix is not taken into account.

Parameters:

  • x (Integer)

Returns:

  • (Integer)


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

def device_to_logical_x(x) end

#device_to_logical_x_rel(x) ⇒ Integer

Convert device X coordinate to relative logical coordinate, using the current mapping mode and user scale factor but ignoring the axis orientation.

Use this for converting a horizontal distance like for example a width.

Note:

Affine transformation applied to the coordinate system with #set_transform_matrix is not taken into account.

Parameters:

  • x (Integer)

Returns:

  • (Integer)


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

def device_to_logical_x_rel(x) end

#device_to_logical_y(y) ⇒ Integer

Converts device Y coordinate to logical coordinate, using the current mapping mode, user scale factor, device origin and axis orientation.

Note:

Affine transformation applied to the coordinate system with #set_transform_matrix is not taken into account.

Parameters:

  • y (Integer)

Returns:

  • (Integer)


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

def device_to_logical_y(y) end

#device_to_logical_y_rel(y) ⇒ Integer

Convert device Y coordinate to relative logical coordinate, using the current mapping mode and user scale factor but ignoring the axis orientation.

Use this for converting a vertical distance like for example a height.

Note:

Affine transformation applied to the coordinate system with #set_transform_matrix is not taken into account.

Parameters:

  • y (Integer)

Returns:

  • (Integer)


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

def device_to_logical_y_rel(y) 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:



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

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)


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

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:



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

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)


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

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:



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

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)


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

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:



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

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)


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

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:



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

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)


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

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:



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

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)


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

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)


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

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.

    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:



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

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)


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

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:



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

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)


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

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 #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)


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

def draw_text(*args) end

#end_docvoid

This method returns an undefined value.

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



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

def end_doc; end

#end_pagevoid

This method returns an undefined value.

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



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

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)


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

def flood_fill(*args) end

#from_dip(sz) ⇒ Wx::Size #from_dip(pt) ⇒ Wx::Point #from_dip(d) ⇒ Integer

Overloads:

  • #from_dip(sz) ⇒ Wx::Size

    Convert DPI-independent pixel values to the value in pixels appropriate for the DC.

    See Window#from_dip(sz) for more info about converting device independent pixel values.

    Parameters:

    • sz (Array(Integer, Integer), Wx::Size)

    Returns:

  • #from_dip(pt) ⇒ Wx::Point

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

    Parameters:

    Returns:

  • #from_dip(d) ⇒ Integer

    Convert DPI-independent value in pixels to the value in pixels appropriate for the DC.

    This is the same as FromDIP(const Size& sz) overload, but assumes that the resolution is the same in horizontal and vertical directions.

    Parameters:

    • d (Integer)

    Returns:

    • (Integer)


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

def from_dip(*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:



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

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:



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

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:



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

def get_background_mode; end

#get_brushWx::Brush Also known as: brush

Gets the current brush.

Returns:

See Also:



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

def get_brush; end

#get_char_heightInteger Also known as: char_height

Gets the character height of the currently set font.

Returns:

  • (Integer)


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

def get_char_height; end

#get_char_widthInteger Also known as: char_width

Gets the average character width of the currently set font.

Returns:

  • (Integer)


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

def get_char_width; 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)


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

def get_clipping_box(*args) end

#get_content_scale_factorFloat Also known as: content_scale_factor

Returns the factor used for converting logical pixels to physical ones.

Returns the same value as Window#get_dpi_scale_factor for the device contexts associated with a window and the same value as Bitmap#get_scale_factor for the associated bitmap for MemoryDC.

Note:

Beware that since wxWidgets 3.1.6, this function does not return the same value as Window#get_content_scale_factor for the device contexts associated with the window. Unlike Window method, it always returns the effective scale factor instead of always returning 1 on platforms where logical pixels are the same as physical ones, such as MSW.

Returns:

  • (Float)


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

def get_content_scale_factor; end

#get_depthInteger Also known as: depth

Returns the depth (number of bits/pixel) of this DC.

Returns:

  • (Integer)

See Also:



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

def get_depth; end

#get_device_originWx::Point Also known as: device_origin

Returns the current device origin.

Returns:

See Also:



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

def get_device_origin; end

#get_dimensionsArray(Integer,Integer) Also known as: dimensions

Gets the horizontal and vertical extent of this device context in device units.

It can be used to scale graphics to fit the page. For example, if maxX and maxY represent the maximum horizontal and vertical ‘pixel’ values used in your application, the following code will scale the graphic to fit on the printer page:

sz = dc.get_dimensions
  scaleX = (maxX.to_f / sz.width)
  scaleY = (maxY.to_f / sz.height);
  dc.set_user_scale([scaleX, scaleY].min,[scaleX, scaleY].min)

Returns:

  • (Array(Integer,Integer))


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

def get_dimensions; end

#get_dimensions_mmArray(Integer,Integer) Also known as: dimensions_mm

Returns the horizontal and vertical resolution in millimetres.

Returns:

  • (Array(Integer,Integer))


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

def get_dimensions_mm; end

#get_fontWx::Font, Wx::FontInfo Also known as: font

Gets the current font.

Notice that even although each device context object has some default font after creation, this method would return a NULL_FONT initially and only after calling #set_font a valid font is returned.

Returns:



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

def get_font; end

#get_font_metricsWx::FontMetrics Also known as: font_metrics

Returns the various font characteristics.

This method allows retrieving some of the font characteristics not returned by #get_text_extent, notably internal leading and average character width. Currently this method returns correct results only under WXMSW, in the other ports the internal leading will always be 0 and the average character width will be computed as the width of the character ‘x’.

Returns:



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

def get_font_metrics; 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 NULL is returned.

Returns:



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

def get_graphics_context; end

#get_layout_directionWx::LayoutDirection Also known as: layout_direction

Gets the current layout direction of the device context.

On platforms where RTL layout is supported, the return value will either be LayoutDirection::Layout_LeftToRight or LayoutDirection::Layout_RightToLeft. If RTL layout is not supported, the return value will be LayoutDirection::Layout_Default.



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

def get_layout_direction; end

#get_logical_functionWx::RasterOperationMode Also known as: logical_function

Gets the current logical function.



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

def get_logical_function; end

#get_logical_originWx::Point Also known as: logical_origin

Return the coordinates of the logical point (0, 0).

Returns:

See Also:



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

def get_logical_origin; end

#get_logical_scaleArray(Float,Float) Also known as: logical_scale

Return the scale set by the last call to #set_logical_scale.

Returns:

  • (Array(Float,Float))


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

def get_logical_scale; end

#get_map_modeWx::MappingMode Also known as: map_mode

Gets the current mapping mode for the device context.

Returns:

See Also:



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

def get_map_mode; end

#get_multi_line_text_extent(string, font = nil) ⇒ Array(Integer,Integer,Integer) Also known as: multi_line_text_extent

Gets the dimensions of the string using the currently selected font.

string is the text string to measure, heightLine, if non NULL, is where to store the height of a single line. The text extent is set in the given w and h pointers. If the optional parameter font is specified and valid, then it is used for the text extent calculation, otherwise the currently selected font is used. If string is empty, its horizontal extent is 0 but, for convenience when using this function for allocating enough space for a possibly multi-line string, its vertical extent is the same as the height of an empty line of text. Please note that this behaviour differs from that of #get_text_extent.

Note:

This function works with both single-line and multi-line strings.

Parameters:

Returns:

  • (Array(Integer,Integer,Integer))

See Also:



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

def get_multi_line_text_extent(string, font=nil) end

#get_multi_line_text_size(string) ⇒ Wx::Size Also known as: multi_line_text_size

Gets the dimensions of the string using the currently selected font.

string is the text string to measure. The text extent as a Size object.

Note:

This function works with both single-line and multi-line strings.

Parameters:

  • string (String)

Returns:

See Also:



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

def get_multi_line_text_size(string) end

#get_penWx::Pen Also known as: pen

Gets the current pen.

Returns:

See Also:



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

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)


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

def get_pixel(x, y, colour) end

#get_ppiWx::Size Also known as: ppi

Returns the resolution of the device in pixels per inch.

Returns:



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

def get_ppi; end

#get_sizeWx::Size Also known as: size

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

Returns:



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

def get_size; end

#get_size_mmWx::Size Also known as: size_mm

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

Returns:



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

def get_size_mm; end

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

Gets the current text background colour.

Returns:

See Also:



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

def get_text_background; end

#get_text_extent(string, font = nil) ⇒ Array(Integer,Integer,Integer,Integer) Also known as: text_extent

Gets the dimensions of the string using the currently selected font.

string is the text string to measure, descent is the dimension from the baseline of the font to the bottom of the descender, and externalLeading is any extra vertical space added to the font by the font designer (usually is zero). The text extent is returned in w and h pointers or as a Size object depending on which version of this function is used. If the optional parameter font is specified and valid, then it is used for the text extent calculation. Otherwise the currently selected font is. If string is empty, its extent is 0 in both directions, as expected.

Note:

This function only works with single-line strings.

Parameters:

Returns:

  • (Array(Integer,Integer,Integer,Integer))

See Also:



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

def get_text_extent(string, font=nil) end

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

Gets the current text foreground colour.

Returns:

See Also:



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

def get_text_foreground; end

#get_text_size(string) ⇒ Wx::Size Also known as: text_size

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

Parameters:

  • string (String)

Returns:



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

def get_text_size(string) end

#get_transform_matrixWx::AffineMatrix2D Also known as: transform_matrix

Return the transformation matrix used by this device context.

By default the transformation matrix is the identity matrix.

Returns:



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

def get_transform_matrix; end

#get_user_scaleArray(Float,Float) Also known as: user_scale

Gets the current user scale factor.

Returns:

  • (Array(Float,Float))

See Also:



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

def get_user_scale; 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:



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

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:



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

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

#is_okBoolean Also known as: ok?

Returns true if the DC is ok to use.

Returns:

  • (Boolean)


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

def is_ok; end

#logical_to_device(x, y) ⇒ Wx::Point #logical_to_device(pt) ⇒ Wx::Point

Overloads:

  • #logical_to_device(x, y) ⇒ Wx::Point

    Converts logical (x, y) coordinates to device coordinates taking into account all applied transformations like the current mapping mode, scale factors, device origin, axes orientation, affine transformation.

    Parameters:

    • x (Integer)
    • y (Integer)

    Returns:

  • #logical_to_device(pt) ⇒ Wx::Point

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

    Parameters:

    Returns:



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

def logical_to_device(*args) end

#logical_to_device_rel(x, y) ⇒ Wx::Size #logical_to_device_rel(dim) ⇒ Wx::Size

Overloads:

  • #logical_to_device_rel(x, y) ⇒ Wx::Size

    Converts logical x, y coordinates to relative device coordinates taking into account all applied transformations like the current mapping mode, scale factors, affine transformation.

    Use this for converting distances like e.g. width and height.

    Parameters:

    • x (Integer)
    • y (Integer)

    Returns:

  • #logical_to_device_rel(dim) ⇒ Wx::Size

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

    Parameters:

    • dim (Array(Integer, Integer), Wx::Size)

    Returns:



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

def logical_to_device_rel(*args) end

#logical_to_device_x(x) ⇒ Integer

Converts logical X coordinate to device coordinate, using the current mapping mode, user scale factor, device origin and axis orientation.

Note:

Affine transformation applied to the coordinate system with #set_transform_matrix is not taken into account.

Parameters:

  • x (Integer)

Returns:

  • (Integer)


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

def logical_to_device_x(x) end

#logical_to_device_x_rel(x) ⇒ Integer

Converts logical X coordinate to relative device coordinate, using the current mapping mode and user scale factor but ignoring the axis orientation.

Use this for converting a horizontal distance like for example a width.

Note:

Affine transformation applied to the coordinate system with #set_transform_matrix is not taken into account.

Parameters:

  • x (Integer)

Returns:

  • (Integer)


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

def logical_to_device_x_rel(x) end

#logical_to_device_y(y) ⇒ Integer

Converts logical Y coordinate to device coordinate, using the current mapping mode, user scale factor, device origin and axis orientation.

Note:

Affine transformation applied to the coordinate system with #set_transform_matrix is not taken into account.

Parameters:

  • y (Integer)

Returns:

  • (Integer)


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

def logical_to_device_y(y) end

#logical_to_device_y_rel(y) ⇒ Integer

Converts logical Y coordinate to relative device coordinate, using the current mapping mode and user scale factor but ignoring the axis orientation.

Use this for converting a vertical distance like for example a height.

Note:

Affine transformation applied to the coordinate system with #set_transform_matrix is not taken into account.

Parameters:

  • y (Integer)

Returns:

  • (Integer)


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

def logical_to_device_y_rel(y) end

#max_xInteger

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

Returns:

  • (Integer)


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

def max_x; end

#max_yInteger

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

Returns:

  • (Integer)


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

def max_y; end

#min_xInteger

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

Returns:

  • (Integer)


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

def min_x; end

#min_yInteger

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

Returns:

  • (Integer)


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

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:



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

def reset_bounding_box; end

#reset_transform_matrixvoid

This method returns an undefined value.

Revert the transformation matrix to identity matrix.



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

def reset_transform_matrix; end

#set_axis_orientation(xLeftRight, yBottomUp) ⇒ void

This method returns an undefined value.

Sets the x and y axis orientation (i.e. the direction from lowest to highest values on the axis).

The default orientation is x axis from left to right and y axis from top down.

Parameters:

  • xLeftRight (Boolean)

    True to set the x axis orientation to the natural left to right orientation, false to invert it.

  • yBottomUp (Boolean)

    True to set the y axis orientation to the natural bottom up orientation, false to invert it.



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

def set_axis_orientation(xLeftRight, yBottomUp) end

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

This method returns an undefined value.

Sets the current background brush for the DC.

Parameters:



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

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:



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

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.



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

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:



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

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:



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

def set_device_clipping_region(region) end

#set_device_origin(x, y) ⇒ void

This method returns an undefined value.

Sets the device origin (i.e. the origin in pixels after scaling has been applied).

This function may be useful in Windows printing operations for placing a graphic on a page.

Parameters:

  • x (Integer)
  • y (Integer)


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

def set_device_origin(x, y) end

#set_font(font) ⇒ void Also known as: font=

This method returns an undefined value.

Sets the current font for the DC.

The font parameter should be valid, although in WXMSW port (only) the argument NULL_FONT is also accepted and resets the device context font to the default value used by the system (which is not generally useful).

Parameters:

See Also:



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

def set_font(font) 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:



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

def set_graphics_context(ctx) end

#set_layout_direction(dir) ⇒ void Also known as: layout_direction=

This method returns an undefined value.

Sets the current layout direction for the device context.



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

def set_layout_direction(dir) 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:



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

def set_logical_function(function) end

#set_logical_origin(x, y) ⇒ void

This method returns an undefined value.

Change the offset used for translating Wx::DC coordinates.

Parameters:

  • x (Integer)
  • y (Integer)

See Also:



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

def set_logical_origin(x, y) end

#set_logical_scale(x, y) ⇒ void

This method returns an undefined value.

Set the scale to use for translating Wx::DC coordinates to the physical pixels.

The effect of calling this function is similar to that of calling #set_user_scale.

Parameters:

  • x (Float)
  • y (Float)


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

def set_logical_scale(x, y) end

#set_map_mode(mode) ⇒ void Also known as: map_mode=

This method returns an undefined value.

The mapping mode of the device context defines the unit of measurement used to convert logical units to device units.

Note that in X, text drawing isn’t handled consistently with the mapping mode; a font is always specified in point size. However, setting the user scale (see #set_user_scale) scales the text appropriately. In Windows, scalable TrueType fonts are always used; in X, results depend on availability of fonts, but usually a reasonable match is found. The coordinate origin is always at the top left of the screen/printer. Drawing to a Windows printer device context uses the current mapping mode, but mapping mode is currently ignored for PostScript output.

Parameters:



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

def set_map_mode(mode) 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:



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

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.



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

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:



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

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.



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

def set_text_foreground(colour) end

#set_transform_matrix(matrix) ⇒ Boolean Also known as: transform_matrix=

Set the transformation matrix.

If transformation matrix is supported on the current system, the specified matrix will be used to transform between Wx::DC and physical coordinates. Otherwise the function returns false and doesn’t change the coordinate mapping.

Parameters:

Returns:

  • (Boolean)


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

def set_transform_matrix(matrix) end

#set_user_scale(xScale, yScale) ⇒ void

This method returns an undefined value.

Sets the user scaling factor, useful for applications which require ‘zooming’.

Parameters:

  • xScale (Float)
  • yScale (Float)


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

def set_user_scale(xScale, yScale) 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)


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

def start_doc(message) end

#start_pagevoid

This method returns an undefined value.

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



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

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:



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

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

#to_dip(sz) ⇒ Wx::Size #to_dip(pt) ⇒ Wx::Point #to_dip(d) ⇒ Integer

Overloads:

  • #to_dip(sz) ⇒ Wx::Size

    Convert pixel values of the current DC to DPI-independent pixel values.

    See Window#to_dip(sz) for more info about converting device independent pixel values.

    Parameters:

    • sz (Array(Integer, Integer), Wx::Size)

    Returns:

  • #to_dip(pt) ⇒ Wx::Point

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

    Parameters:

    Returns:

  • #to_dip(d) ⇒ Integer

    Convert pixel values of the current DC to DPI-independent pixel values.

    This is the same as ToDIP(const Size& sz) overload, but assumes that the resolution is the same in horizontal and vertical directions.

    Parameters:

    • d (Integer)

    Returns:

    • (Integer)


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

def to_dip(*args) 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