Class: Wx::ReadOnlyDC
Overview
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.
Instance Method Summary collapse
-
#can_draw_bitmap ⇒ Boolean
(also: #can_draw_bitmap?)
Does the DC support drawing bitmaps?.
-
#can_get_text_extent ⇒ Boolean
(also: #can_get_text_extent?)
Does the DC support calculating the size required to draw text?.
-
#can_use_transform_matrix ⇒ Boolean
(also: #can_use_transform_matrix?)
Check if the use of transformation matrix is supported by the current system.
- #device_to_logical(*args) ⇒ Object
- #device_to_logical_rel(*args) ⇒ Object
-
#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.
-
#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.
-
#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.
-
#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.
- #from_dip(*args) ⇒ Object
-
#get_char_height ⇒ Integer
(also: #char_height)
Gets the character height of the currently set font.
-
#get_char_width ⇒ Integer
(also: #char_width)
Gets the average character width of the currently set font.
-
#get_content_scale_factor ⇒ Float
(also: #content_scale_factor)
Returns the factor used for converting logical pixels to physical ones.
-
#get_depth ⇒ Integer
(also: #depth)
Returns the depth (number of bits/pixel) of this DC.
-
#get_device_origin ⇒ Wx::Point
(also: #device_origin)
Returns the current device origin.
-
#get_dimensions ⇒ Array(Integer,Integer)
(also: #dimensions)
Gets the horizontal and vertical extent of this device context in device units.
-
#get_dimensions_mm ⇒ Array(Integer,Integer)
(also: #dimensions_mm)
Returns the horizontal and vertical resolution in millimetres.
-
#get_font ⇒ Wx::Font, Wx::FontInfo
(also: #font)
Gets the current font.
-
#get_font_metrics ⇒ Wx::FontMetrics
(also: #font_metrics)
Returns the various font characteristics.
-
#get_layout_direction ⇒ Wx::LayoutDirection
(also: #layout_direction)
Gets the current layout direction of the device context.
-
#get_logical_origin ⇒ Wx::Point
(also: #logical_origin)
This is an overloaded member function, provided for convenience.
-
#get_logical_scale ⇒ Array(Float,Float)
(also: #logical_scale)
Return the scale set by the last call to #set_logical_scale.
-
#get_map_mode ⇒ Wx::MappingMode
(also: #map_mode)
Gets the current mapping mode for the device context.
-
#get_multi_line_text_extent(string, font = nil) ⇒ Array(Integer,Integer,Integer)
(also: #multi_line_text_extent)
Gets the dimensions of the string using the currently selected font.
-
#get_multi_line_text_size(string) ⇒ Wx::Size
(also: #multi_line_text_size)
Gets the dimensions of the string using the currently selected font.
-
#get_ppi ⇒ Wx::Size
(also: #ppi)
Returns the resolution of the device in pixels per inch.
-
#get_size ⇒ Wx::Size
(also: #size)
This is an overloaded member function, provided for convenience.
-
#get_size_mm ⇒ Wx::Size
(also: #size_mm)
This is an overloaded member function, provided for convenience.
-
#get_text_extent(string, font = nil) ⇒ Array(Integer,Integer,Integer,Integer)
(also: #text_extent)
Gets the dimensions of the string using the currently selected font.
-
#get_text_size(string) ⇒ Wx::Size
(also: #text_size)
This is an overloaded member function, provided for convenience.
-
#get_transform_matrix ⇒ Wx::AffineMatrix2D
(also: #transform_matrix)
Return the transformation matrix used by this device context.
-
#get_user_scale ⇒ Array(Float,Float)
(also: #user_scale)
Gets the current user scale factor.
-
#is_ok ⇒ Boolean
(also: #ok?)
Returns true if the DC is ok to use.
- #logical_to_device(*args) ⇒ Object
- #logical_to_device_rel(*args) ⇒ Object
-
#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.
-
#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.
-
#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.
-
#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.
-
#reset_transform_matrix ⇒ void
Revert the transformation matrix to identity matrix.
-
#set_axis_orientation(xLeftRight, yBottomUp) ⇒ void
Sets the x and y axis orientation (i.e. the direction from lowest to highest values on the axis).
-
#set_device_origin(x, y) ⇒ void
Sets the device origin (i.e. the origin in pixels after scaling has been applied).
-
#set_font(font) ⇒ void
(also: #font=)
Sets the current font for the DC.
-
#set_layout_direction(dir) ⇒ void
(also: #layout_direction=)
Sets the current layout direction for the device context.
-
#set_logical_origin(x, y) ⇒ void
Change the offset used for translating DC coordinates.
-
#set_logical_scale(x, y) ⇒ void
Set the scale to use for translating DC coordinates to the physical pixels.
-
#set_map_mode(mode) ⇒ void
(also: #map_mode=)
The mapping mode of the device context defines the unit of measurement used to convert logical units to device units.
-
#set_transform_matrix(matrix) ⇒ Boolean
(also: #transform_matrix=)
Set the transformation matrix.
-
#set_user_scale(xScale, yScale) ⇒ void
Sets the user scaling factor, useful for applications which require ‘zooming’.
- #to_dip(*args) ⇒ Object
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_bitmap ⇒ Boolean Also known as: can_draw_bitmap?
Does the DC support drawing bitmaps?
143 |
# File 'lib/wx/doc/gen/dc.rb', line 143 def can_draw_bitmap; end |
#can_get_text_extent ⇒ Boolean Also known as: can_get_text_extent?
Does the DC support calculating the size required to draw text?
148 |
# File 'lib/wx/doc/gen/dc.rb', line 148 def can_get_text_extent; end |
#can_use_transform_matrix ⇒ Boolean 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.
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
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
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.
Affine transformation applied to the coordinate system with #set_transform_matrix is not taken into account.
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.
Affine transformation applied to the coordinate system with #set_transform_matrix is not taken into account.
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.
Affine transformation applied to the coordinate system with #set_transform_matrix is not taken into account.
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.
Affine transformation applied to the coordinate system with #set_transform_matrix is not taken into account.
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
531 |
# File 'lib/wx/doc/gen/dc.rb', line 531 def from_dip(*args) end |
#get_char_height ⇒ Integer Also known as: char_height
Gets the character height of the currently set font.
383 |
# File 'lib/wx/doc/gen/dc.rb', line 383 def get_char_height; end |
#get_char_width ⇒ Integer Also known as: char_width
Gets the average character width of the currently set font.
388 |
# File 'lib/wx/doc/gen/dc.rb', line 388 def get_char_width; end |
#get_content_scale_factor ⇒ Float 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.
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.
483 |
# File 'lib/wx/doc/gen/dc.rb', line 483 def get_content_scale_factor; end |
#get_depth ⇒ Integer Also known as: depth
Returns the depth (number of bits/pixel) of this DC.
491 |
# File 'lib/wx/doc/gen/dc.rb', line 491 def get_depth; end |
#get_device_origin ⇒ Wx::Point Also known as: device_origin
Returns the current device origin.
499 |
# File 'lib/wx/doc/gen/dc.rb', line 499 def get_device_origin; end |
#get_dimensions ⇒ Array(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));
564 |
# File 'lib/wx/doc/gen/dc.rb', line 564 def get_dimensions; end |
#get_dimensions_mm ⇒ Array(Integer,Integer) Also known as: dimensions_mm
Returns the horizontal and vertical resolution in millimetres.
574 |
# File 'lib/wx/doc/gen/dc.rb', line 574 def get_dimensions_mm; end |
#get_font ⇒ Wx::Font, Wx::FontInfo Also known as: font
594 |
# File 'lib/wx/doc/gen/dc.rb', line 594 def get_font; end |
#get_font_metrics ⇒ Wx::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’.
396 |
# File 'lib/wx/doc/gen/dc.rb', line 396 def get_font_metrics; end |
#get_layout_direction ⇒ Wx::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_origin ⇒ Wx::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.
352 |
# File 'lib/wx/doc/gen/dc.rb', line 352 def get_logical_origin; end |
#get_logical_scale ⇒ Array(Float,Float) Also known as: logical_scale
Return the scale set by the last call to #set_logical_scale.
337 |
# File 'lib/wx/doc/gen/dc.rb', line 337 def get_logical_scale; end |
#get_map_mode ⇒ Wx::MappingMode Also known as: map_mode
Gets the current mapping mode for the device context.
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.
This function works with both single-line and multi-line strings.
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.
This function works with both single-line and multi-line strings.
437 |
# File 'lib/wx/doc/gen/dc.rb', line 437 def get_multi_line_text_size(string) end |
#get_ppi ⇒ Wx::Size Also known as: ppi
Returns the resolution of the device in pixels per inch.
512 |
# File 'lib/wx/doc/gen/dc.rb', line 512 def get_ppi; end |
#get_size ⇒ Wx::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.
569 |
# File 'lib/wx/doc/gen/dc.rb', line 569 def get_size; end |
#get_size_mm ⇒ Wx::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.
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.
This function only works with single-line strings.
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.
465 |
# File 'lib/wx/doc/gen/dc.rb', line 465 def get_text_size(string) end |
#get_transform_matrix ⇒ Wx::AffineMatrix2D Also known as: transform_matrix
Return the transformation matrix used by this device context.
By default the transformation matrix is the identity matrix.
374 |
# File 'lib/wx/doc/gen/dc.rb', line 374 def get_transform_matrix; end |
#get_user_scale ⇒ Array(Float,Float) Also known as: user_scale
Gets the current user scale factor.
587 |
# File 'lib/wx/doc/gen/dc.rb', line 587 def get_user_scale; end |
#is_ok ⇒ Boolean Also known as: ok?
Returns true if the DC is ok to use.
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
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
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.
Affine transformation applied to the coordinate system with #set_transform_matrix is not taken into account.
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.
Affine transformation applied to the coordinate system with #set_transform_matrix is not taken into account.
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.
Affine transformation applied to the coordinate system with #set_transform_matrix is not taken into account.
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.
Affine transformation applied to the coordinate system with #set_transform_matrix is not taken into account.
245 |
# File 'lib/wx/doc/gen/dc.rb', line 245 def logical_to_device_y_rel(y) end |
#reset_transform_matrix ⇒ void
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.
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.
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).
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.
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.
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.
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.
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’.
325 |
# File 'lib/wx/doc/gen/dc.rb', line 325 def set_user_scale(xScale, yScale) end |