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. Please note that all wxWidgets functions taking parameters of this type added before wxWidgets 3.3.0 used to take DC instead and that they can still be called with DC objects, as DC inherits from ReadOnlyDC.
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?
144 |
# File 'lib/wx/doc/gen/dc.rb', line 144 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?
149 |
# File 'lib/wx/doc/gen/dc.rb', line 149 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.
360 |
# File 'lib/wx/doc/gen/dc.rb', line 360 def can_use_transform_matrix; end |
#device_to_logical(x, y) ⇒ Wx::Point #device_to_logical(pt) ⇒ Wx::Point
257 |
# File 'lib/wx/doc/gen/dc.rb', line 257 def device_to_logical(*args) end |
#device_to_logical_rel(x, y) ⇒ Wx::Size #device_to_logical_rel(dim) ⇒ Wx::Size
270 |
# File 'lib/wx/doc/gen/dc.rb', line 270 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.
161 |
# File 'lib/wx/doc/gen/dc.rb', line 161 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.
174 |
# File 'lib/wx/doc/gen/dc.rb', line 174 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.
185 |
# File 'lib/wx/doc/gen/dc.rb', line 185 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.
198 |
# File 'lib/wx/doc/gen/dc.rb', line 198 def device_to_logical_y_rel(y) end |
#from_dip(sz) ⇒ Wx::Size #from_dip(pt) ⇒ Wx::Point #from_dip(d) ⇒ Integer
532 |
# File 'lib/wx/doc/gen/dc.rb', line 532 def from_dip(*args) end |
#get_char_height ⇒ Integer Also known as: char_height
Gets the character height of the currently set font.
384 |
# File 'lib/wx/doc/gen/dc.rb', line 384 def get_char_height; end |
#get_char_width ⇒ Integer Also known as: char_width
Gets the average character width of the currently set font.
389 |
# File 'lib/wx/doc/gen/dc.rb', line 389 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.
484 |
# File 'lib/wx/doc/gen/dc.rb', line 484 def get_content_scale_factor; end |
#get_depth ⇒ Integer Also known as: depth
Returns the depth (number of bits/pixel) of this DC.
492 |
# File 'lib/wx/doc/gen/dc.rb', line 492 def get_depth; end |
#get_device_origin ⇒ Wx::Point Also known as: device_origin
Returns the current device origin.
500 |
# File 'lib/wx/doc/gen/dc.rb', line 500 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));
565 |
# File 'lib/wx/doc/gen/dc.rb', line 565 def get_dimensions; end |
#get_dimensions_mm ⇒ Array(Integer,Integer) Also known as: dimensions_mm
Returns the horizontal and vertical resolution in millimetres.
575 |
# File 'lib/wx/doc/gen/dc.rb', line 575 def get_dimensions_mm; end |
#get_font ⇒ Wx::Font, Wx::FontInfo Also known as: font
595 |
# File 'lib/wx/doc/gen/dc.rb', line 595 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’.
397 |
# File 'lib/wx/doc/gen/dc.rb', line 397 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.
603 |
# File 'lib/wx/doc/gen/dc.rb', line 603 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.
353 |
# File 'lib/wx/doc/gen/dc.rb', line 353 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.
338 |
# File 'lib/wx/doc/gen/dc.rb', line 338 def get_logical_scale; end |
#get_map_mode ⇒ Wx::MappingMode Also known as: map_mode
Gets the current mapping mode for the device context.
508 |
# File 'lib/wx/doc/gen/dc.rb', line 508 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.
419 |
# File 'lib/wx/doc/gen/dc.rb', line 419 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.
438 |
# File 'lib/wx/doc/gen/dc.rb', line 438 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.
513 |
# File 'lib/wx/doc/gen/dc.rb', line 513 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.
570 |
# File 'lib/wx/doc/gen/dc.rb', line 570 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.
580 |
# File 'lib/wx/doc/gen/dc.rb', line 580 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.
460 |
# File 'lib/wx/doc/gen/dc.rb', line 460 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.
466 |
# File 'lib/wx/doc/gen/dc.rb', line 466 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.
375 |
# File 'lib/wx/doc/gen/dc.rb', line 375 def get_transform_matrix; end |
#get_user_scale ⇒ Array(Float,Float) Also known as: user_scale
Gets the current user scale factor.
588 |
# File 'lib/wx/doc/gen/dc.rb', line 588 def get_user_scale; end |
#is_ok ⇒ Boolean Also known as: ok?
Returns true if the DC is ok to use.
471 |
# File 'lib/wx/doc/gen/dc.rb', line 471 def is_ok; end |
#logical_to_device(x, y) ⇒ Wx::Point #logical_to_device(pt) ⇒ Wx::Point
281 |
# File 'lib/wx/doc/gen/dc.rb', line 281 def logical_to_device(*args) end |
#logical_to_device_rel(x, y) ⇒ Wx::Size #logical_to_device_rel(dim) ⇒ Wx::Size
294 |
# File 'lib/wx/doc/gen/dc.rb', line 294 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.
209 |
# File 'lib/wx/doc/gen/dc.rb', line 209 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.
222 |
# File 'lib/wx/doc/gen/dc.rb', line 222 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.
233 |
# File 'lib/wx/doc/gen/dc.rb', line 233 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.
246 |
# File 'lib/wx/doc/gen/dc.rb', line 246 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.
380 |
# File 'lib/wx/doc/gen/dc.rb', line 380 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.
302 |
# File 'lib/wx/doc/gen/dc.rb', line 302 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.
310 |
# File 'lib/wx/doc/gen/dc.rb', line 310 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).
612 |
# File 'lib/wx/doc/gen/dc.rb', line 612 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.
621 |
# File 'lib/wx/doc/gen/dc.rb', line 621 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.
349 |
# File 'lib/wx/doc/gen/dc.rb', line 349 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.
334 |
# File 'lib/wx/doc/gen/dc.rb', line 334 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.
319 |
# File 'lib/wx/doc/gen/dc.rb', line 319 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.
368 |
# File 'lib/wx/doc/gen/dc.rb', line 368 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’.
326 |
# File 'lib/wx/doc/gen/dc.rb', line 326 def set_user_scale(xScale, yScale) end |