Class: Wx::ReadOnlyDC

Inherits:
Object
  • Object
show all
Defined in:
lib/wx/doc/gen/dc.rb

Overview

Note:

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

Base class for device context not providing any drawing functions.

Objects of this class can’t be created directly, please see DC for the description of how to create objects of the derived classes.

Direct Known Subclasses

DC, InfoDC

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

#can_draw_bitmapBoolean Also known as: can_draw_bitmap?

Does the DC support drawing bitmaps?

Returns:

  • (Boolean)


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

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)


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

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)


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

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



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

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:



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

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)


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

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)


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

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)


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

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)


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

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


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

def from_dip(*args) end

#get_char_heightInteger Also known as: char_height

Gets the character height of the currently set font.

Returns:

  • (Integer)


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

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)


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

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


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

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:



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

def get_depth; end

#get_device_originWx::Point Also known as: device_origin

Returns the current device origin.

Returns:

See Also:



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

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:

wxCoord w, h;
  dc.GetSize(&w, &h);
  double scaleX = (double)(maxX / w);
  double scaleY = (double)(maxY / h);
  dc.SetUserScale(min(scaleX, scaleY),min(scaleX, scaleY));

Returns:

  • (Array(Integer,Integer))


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

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


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

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:



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

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:



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

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



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

def get_layout_direction; end

#get_logical_originWx::Point Also known as: logical_origin

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

Returns:



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

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


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

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:



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

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 nil, 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:



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

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:



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

def get_multi_line_text_size(string) end

#get_ppiWx::Size Also known as: ppi

Returns the resolution of the device in pixels per inch.

Returns:



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

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:



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

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:



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

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



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

def get_text_extent(string, font=nil) 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:



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

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:



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

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:



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

def get_user_scale; end

#is_okBoolean Also known as: ok?

Returns true if the DC is ok to use.

Returns:

  • (Boolean)


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

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:



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

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:



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

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)


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

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)


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

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)


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

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)


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

def logical_to_device_y_rel(y) end

#reset_transform_matrixvoid

This method returns an undefined value.

Revert the transformation matrix to identity matrix.



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

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.



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

def set_axis_orientation(xLeftRight, yBottomUp) 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)


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

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:



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

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



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

def set_layout_direction(dir) end

#set_logical_origin(x, y) ⇒ void

This method returns an undefined value.

Change the offset used for translating DC coordinates.

Parameters:

  • x (Integer)
  • y (Integer)

See Also:



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

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


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

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:



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

def set_map_mode(mode) 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 DC and physical coordinates. Otherwise the function returns false and doesn’t change the coordinate mapping.

Parameters:

Returns:

  • (Boolean)


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

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)


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

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


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

def to_dip(*args) end