Version: 3.3.0
wxReadOnlyDC Class Reference

#include <wx/dc.h>

+ Inheritance diagram for wxReadOnlyDC:

Detailed Description

Base class for device context not providing any drawing functions.

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

Since
3.3.0

Public Member Functions

bool IsOk () const
 Returns true if the DC is ok to use. More...
 
double GetContentScaleFactor () const
 Returns the factor used for converting logical pixels to physical ones. More...
 
int GetDepth () const
 Returns the depth (number of bits/pixel) of this DC. More...
 
wxPoint GetDeviceOrigin () const
 Returns the current device origin. More...
 
wxMappingMode GetMapMode () const
 Gets the current mapping mode for the device context. More...
 
wxSize GetPPI () const
 Returns the resolution of the device in pixels per inch. More...
 
wxSize FromDIP (const wxSize &sz) const
 Convert DPI-independent pixel values to the value in pixels appropriate for the DC. More...
 
wxPoint FromDIP (const wxPoint &pt) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
int FromDIP (int d) const
 Convert DPI-independent value in pixels to the value in pixels appropriate for the DC. More...
 
wxSize ToDIP (const wxSize &sz) const
 Convert pixel values of the current DC to DPI-independent pixel values. More...
 
wxPoint ToDIP (const wxPoint &pt) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
int ToDIP (int d) const
 Convert pixel values of the current DC to DPI-independent pixel values. More...
 
void GetSize (wxCoord *width, wxCoord *height) const
 Gets the horizontal and vertical extent of this device context in device units. More...
 
wxSize GetSize () const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
void GetSizeMM (wxCoord *width, wxCoord *height) const
 Returns the horizontal and vertical resolution in millimetres. More...
 
wxSize GetSizeMM () const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
void GetUserScale (double *x, double *y) const
 Gets the current user scale factor. More...
 
const wxFontGetFont () const
 Gets the current font. More...
 
wxLayoutDirection GetLayoutDirection () const
 Gets the current layout direction of the device context. More...
 
void SetFont (const wxFont &font)
 Sets the current font for the DC. More...
 
void SetLayoutDirection (wxLayoutDirection dir)
 Sets the current layout direction for the device context. More...
 
query capabilities
bool CanDrawBitmap () const
 Does the DC support drawing bitmaps? More...
 
bool CanGetTextExtent () const
 Does the DC support calculating the size required to draw text? More...
 
Coordinate conversion functions
wxCoord DeviceToLogicalX (wxCoord x) const
 Convert device X coordinate to logical coordinate, using the current mapping mode, user scale factor, device origin and axis orientation. More...
 
wxCoord DeviceToLogicalXRel (wxCoord x) const
 Convert device X coordinate to relative logical coordinate, using the current mapping mode and user scale factor but ignoring the axis orientation. More...
 
wxCoord DeviceToLogicalY (wxCoord y) const
 Converts device Y coordinate to logical coordinate, using the current mapping mode, user scale factor, device origin and axis orientation. More...
 
wxCoord DeviceToLogicalYRel (wxCoord y) const
 Convert device Y coordinate to relative logical coordinate, using the current mapping mode and user scale factor but ignoring the axis orientation. More...
 
wxCoord LogicalToDeviceX (wxCoord x) const
 Converts logical X coordinate to device coordinate, using the current mapping mode, user scale factor, device origin and axis orientation. More...
 
wxCoord LogicalToDeviceXRel (wxCoord x) const
 Converts logical X coordinate to relative device coordinate, using the current mapping mode and user scale factor but ignoring the axis orientation. More...
 
wxCoord LogicalToDeviceY (wxCoord y) const
 Converts logical Y coordinate to device coordinate, using the current mapping mode, user scale factor, device origin and axis orientation. More...
 
wxCoord LogicalToDeviceYRel (wxCoord y) const
 Converts logical Y coordinate to relative device coordinate, using the current mapping mode and user scale factor but ignoring the axis orientation. More...
 
wxPoint DeviceToLogical (wxCoord x, wxCoord y) const
 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. More...
 
wxPoint DeviceToLogical (const wxPoint &pt) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
wxSize DeviceToLogicalRel (int x, int y) const
 Converts device x, y coordinates to relative logical coordinates taking into account all applied transformations like the current mapping mode, scale factors, affine transformation. More...
 
wxSize DeviceToLogicalRel (const wxSize &dim) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
wxPoint LogicalToDevice (wxCoord x, wxCoord y) const
 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. More...
 
wxPoint LogicalToDevice (const wxPoint &pt) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
wxSize LogicalToDeviceRel (int x, int y) const
 Converts logical x, y coordinates to relative device coordinates taking into account all applied transformations like the current mapping mode, scale factors, affine transformation. More...
 
wxSize LogicalToDeviceRel (const wxSize &dim) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
void SetAxisOrientation (bool xLeftRight, bool yBottomUp)
 Sets the x and y axis orientation (i.e. the direction from lowest to highest values on the axis). More...
 
void SetDeviceOrigin (wxCoord x, wxCoord y)
 Sets the device origin (i.e. the origin in pixels after scaling has been applied). More...
 
void SetMapMode (wxMappingMode mode)
 The mapping mode of the device context defines the unit of measurement used to convert logical units to device units. More...
 
void SetUserScale (double xScale, double yScale)
 Sets the user scaling factor, useful for applications which require 'zooming'. More...
 
void SetLogicalScale (double x, double y)
 Set the scale to use for translating wxDC coordinates to the physical pixels. More...
 
void GetLogicalScale (double *x, double *y) const
 Return the scale set by the last call to SetLogicalScale(). More...
 
void SetLogicalOrigin (wxCoord x, wxCoord y)
 Change the offset used for translating wxDC coordinates. More...
 
void GetLogicalOrigin (wxCoord *x, wxCoord *y) const
 Return the coordinates of the logical point (0, 0). More...
 
wxPoint GetLogicalOrigin () const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
Transformation matrix

See the notes about the availability of these functions in the class documentation.

bool CanUseTransformMatrix () const
 Check if the use of transformation matrix is supported by the current system. More...
 
bool SetTransformMatrix (const wxAffineMatrix2D &matrix)
 Set the transformation matrix. More...
 
wxAffineMatrix2D GetTransformMatrix () const
 Return the transformation matrix used by this device context. More...
 
void ResetTransformMatrix ()
 Revert the transformation matrix to identity matrix. More...
 
Text/character extent functions
wxCoord GetCharHeight () const
 Gets the character height of the currently set font. More...
 
wxCoord GetCharWidth () const
 Gets the average character width of the currently set font. More...
 
wxFontMetrics GetFontMetrics () const
 Returns the various font characteristics. More...
 
void GetMultiLineTextExtent (const wxString &string, wxCoord *w, wxCoord *h, wxCoord *heightLine=nullptr, const wxFont *font=nullptr) const
 Gets the dimensions of the string using the currently selected font. More...
 
wxSize GetMultiLineTextExtent (const wxString &string) const
 Gets the dimensions of the string using the currently selected font. More...
 
bool GetPartialTextExtents (const wxString &text, wxArrayInt &widths) const
 Fills the widths array with the widths from the beginning of text to the corresponding character of text. More...
 
void GetTextExtent (const wxString &string, wxCoord *w, wxCoord *h, wxCoord *descent=nullptr, wxCoord *externalLeading=nullptr, const wxFont *font=nullptr) const
 Gets the dimensions of the string using the currently selected font. More...
 
wxSize GetTextExtent (const wxString &string) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
- Public Member Functions inherited from wxObject
 wxObject ()
 Default ctor; initializes to nullptr the internal reference data. More...
 
 wxObject (const wxObject &other)
 Copy ctor. More...
 
virtual ~wxObject ()
 Destructor. More...
 
virtual wxClassInfoGetClassInfo () const
 This virtual function is redefined for every class that requires run-time type information, when using the wxDECLARE_CLASS macro (or similar). More...
 
wxObjectRefDataGetRefData () const
 Returns the wxObject::m_refData pointer, i.e. the data referenced by this object. More...
 
bool IsKindOf (const wxClassInfo *info) const
 Determines whether this class is a subclass of (or the same class as) the given class. More...
 
bool IsSameAs (const wxObject &obj) const
 Returns true if this object has the same data pointer as obj. More...
 
void Ref (const wxObject &clone)
 Makes this object refer to the data in clone. More...
 
void SetRefData (wxObjectRefData *data)
 Sets the wxObject::m_refData pointer. More...
 
void UnRef ()
 Decrements the reference count in the associated data, and if it is zero, deletes the data. More...
 
void UnShare ()
 This is the same of AllocExclusive() but this method is public. More...
 
void operator delete (void *buf)
 The delete operator is defined for debugging versions of the library only, when the identifier __WXDEBUG__ is defined. More...
 
void * operator new (size_t size, const wxString &filename=nullptr, int lineNum=0)
 The new operator is defined for debugging versions of the library only, when the identifier __WXDEBUG__ is defined. More...
 

Additional Inherited Members

- Protected Member Functions inherited from wxObject
void AllocExclusive ()
 Ensure that this object's data is not shared with any other object. More...
 
virtual wxObjectRefDataCreateRefData () const
 Creates a new instance of the wxObjectRefData-derived class specific to this object and returns it. More...
 
virtual wxObjectRefDataCloneRefData (const wxObjectRefData *data) const
 Creates a new instance of the wxObjectRefData-derived class specific to this object and initializes it copying data. More...
 
- Protected Attributes inherited from wxObject
wxObjectRefDatam_refData
 Pointer to an object which is the object's reference-counted data. More...
 

Member Function Documentation

◆ CanDrawBitmap()

bool wxReadOnlyDC::CanDrawBitmap ( ) const

Does the DC support drawing bitmaps?

◆ CanGetTextExtent()

bool wxReadOnlyDC::CanGetTextExtent ( ) const

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

◆ CanUseTransformMatrix()

bool wxReadOnlyDC::CanUseTransformMatrix ( ) const

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 wxGCDC in all ports.

Since
2.9.2

◆ DeviceToLogical() [1/2]

wxPoint wxReadOnlyDC::DeviceToLogical ( const wxPoint pt) const

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

Since
3.1.5

◆ DeviceToLogical() [2/2]

wxPoint wxReadOnlyDC::DeviceToLogical ( wxCoord  x,
wxCoord  y 
) const

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.

Since
3.1.5

◆ DeviceToLogicalRel() [1/2]

wxSize wxReadOnlyDC::DeviceToLogicalRel ( const wxSize dim) const

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

Since
3.1.5

◆ DeviceToLogicalRel() [2/2]

wxSize wxReadOnlyDC::DeviceToLogicalRel ( int  x,
int  y 
) const

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.

Since
3.1.5

◆ DeviceToLogicalX()

wxCoord wxReadOnlyDC::DeviceToLogicalX ( wxCoord  x) const

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 SetTransformMatrix() is not taken into account.

◆ DeviceToLogicalXRel()

wxCoord wxReadOnlyDC::DeviceToLogicalXRel ( wxCoord  x) const

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 SetTransformMatrix() is not taken into account.

◆ DeviceToLogicalY()

wxCoord wxReadOnlyDC::DeviceToLogicalY ( wxCoord  y) const

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 SetTransformMatrix() is not taken into account.

◆ DeviceToLogicalYRel()

wxCoord wxReadOnlyDC::DeviceToLogicalYRel ( wxCoord  y) const

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 SetTransformMatrix() is not taken into account.

◆ FromDIP() [1/3]

wxPoint wxReadOnlyDC::FromDIP ( const wxPoint pt) const

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

◆ FromDIP() [2/3]

wxSize wxReadOnlyDC::FromDIP ( const wxSize sz) const

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

See wxWindow::FromDIP(const wxSize& sz) for more info about converting device independent pixel values.

Since
3.1.7

◆ FromDIP() [3/3]

int wxReadOnlyDC::FromDIP ( int  d) const

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

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

Since
3.1.7

◆ GetCharHeight()

wxCoord wxReadOnlyDC::GetCharHeight ( ) const

Gets the character height of the currently set font.

◆ GetCharWidth()

wxCoord wxReadOnlyDC::GetCharWidth ( ) const

Gets the average character width of the currently set font.

◆ GetContentScaleFactor()

double wxReadOnlyDC::GetContentScaleFactor ( ) const

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

Returns the same value as wxWindow::GetDPIScaleFactor() for the device contexts associated with a window and the same value as wxBitmap::GetScaleFactor() for the associated bitmap for wxMemoryDC.

Note
Beware that since wxWidgets 3.1.6, this function does not return the same value as wxWindow::GetContentScaleFactor() for the device contexts associated with the window. Unlike wxWindow 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.
Since
2.9.5

◆ GetDepth()

int wxReadOnlyDC::GetDepth ( ) const

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

See also
wxDisplayDepth()

◆ GetDeviceOrigin()

wxPoint wxReadOnlyDC::GetDeviceOrigin ( ) const

Returns the current device origin.

See also
SetDeviceOrigin()

◆ GetFont()

const wxFont& wxReadOnlyDC::GetFont ( ) const

Gets the current font.

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

◆ GetFontMetrics()

wxFontMetrics wxReadOnlyDC::GetFontMetrics ( ) const

Returns the various font characteristics.

This method allows retrieving some of the font characteristics not returned by GetTextExtent(), 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'.

Since
2.9.2

◆ GetLayoutDirection()

wxLayoutDirection wxReadOnlyDC::GetLayoutDirection ( ) const

Gets the current layout direction of the device context.

On platforms where RTL layout is supported, the return value will either be wxLayout_LeftToRight or wxLayout_RightToLeft. If RTL layout is not supported, the return value will be wxLayout_Default.

See also
SetLayoutDirection()

◆ GetLogicalOrigin() [1/2]

wxPoint wxReadOnlyDC::GetLogicalOrigin ( ) const

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

◆ GetLogicalOrigin() [2/2]

void wxReadOnlyDC::GetLogicalOrigin ( wxCoord x,
wxCoord y 
) const

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

See also
SetLogicalOrigin()

◆ GetLogicalScale()

void wxReadOnlyDC::GetLogicalScale ( double *  x,
double *  y 
) const

Return the scale set by the last call to SetLogicalScale().

◆ GetMapMode()

wxMappingMode wxReadOnlyDC::GetMapMode ( ) const

Gets the current mapping mode for the device context.

See also
SetMapMode()

◆ GetMultiLineTextExtent() [1/2]

wxSize wxReadOnlyDC::GetMultiLineTextExtent ( const wxString string) const

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

string is the text string to measure.

Returns
The text extent as a wxSize object.
Note
This function works with both single-line and multi-line strings.

wxPerl Note: Not supported by wxPerl.

See also
wxFont, SetFont(), GetPartialTextExtents(), GetTextExtent()

◆ GetMultiLineTextExtent() [2/2]

void wxReadOnlyDC::GetMultiLineTextExtent ( const wxString string,
wxCoord w,
wxCoord h,
wxCoord heightLine = nullptr,
const wxFont font = nullptr 
) const

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

string is the text string to measure, heightLine, if non nullptr, 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 GetTextExtent().

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

wxPerl Note: In wxPerl this method is implemented as GetMultiLineTextExtent(string, font = undef) returning a 3-element list (width, height, line_height)

See also
wxFont, SetFont(), GetPartialTextExtents(), GetTextExtent()

◆ GetPartialTextExtents()

bool wxReadOnlyDC::GetPartialTextExtents ( const wxString text,
wxArrayInt widths 
) const

Fills the widths array with the widths from the beginning of text to the corresponding character of text.

The generic version simply builds a running total of the widths of each character using GetTextExtent(), however if the various platforms have a native API function that is faster or more accurate than the generic implementation then it should be used instead.

wxPerl Note: In wxPerl this method only takes the text parameter and returns the widths as a list of integers.

See also
GetMultiLineTextExtent(), GetTextExtent()

◆ GetPPI()

wxSize wxReadOnlyDC::GetPPI ( ) const

Returns the resolution of the device in pixels per inch.

◆ GetSize() [1/2]

wxSize wxReadOnlyDC::GetSize ( ) const

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

◆ GetSize() [2/2]

void wxReadOnlyDC::GetSize ( wxCoord width,
wxCoord height 
) const

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));
int wxCoord
The type for screen and DC coordinates.
Definition: defs.h:1392

wxPerl Note: In wxPerl there are two methods instead of a single overloaded method:

  • GetSize(): returns a Wx::Size object.
  • GetSizeWH(): returns a 2-element list (width, height).

◆ GetSizeMM() [1/2]

wxSize wxReadOnlyDC::GetSizeMM ( ) const

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

◆ GetSizeMM() [2/2]

void wxReadOnlyDC::GetSizeMM ( wxCoord width,
wxCoord height 
) const

Returns the horizontal and vertical resolution in millimetres.

◆ GetTextExtent() [1/2]

wxSize wxReadOnlyDC::GetTextExtent ( const wxString string) const

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

wxPerl Note: Not supported by wxPerl.

◆ GetTextExtent() [2/2]

void wxReadOnlyDC::GetTextExtent ( const wxString string,
wxCoord w,
wxCoord h,
wxCoord descent = nullptr,
wxCoord externalLeading = nullptr,
const wxFont font = nullptr 
) const

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 wxSize 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.

wxPerl Note: In wxPerl this method is implemented as GetTextExtent(string, font = undef) returning a 4-element list (width, height, descent, externalLeading)

See also
wxFont, SetFont(), GetPartialTextExtents(), GetMultiLineTextExtent()

◆ GetTransformMatrix()

wxAffineMatrix2D wxReadOnlyDC::GetTransformMatrix ( ) const

Return the transformation matrix used by this device context.

By default the transformation matrix is the identity matrix.

Since
2.9.2

◆ GetUserScale()

void wxReadOnlyDC::GetUserScale ( double *  x,
double *  y 
) const

Gets the current user scale factor.

wxPerl Note: In wxPerl this method takes no arguments and return a two element array (x, y).

See also
SetUserScale()

◆ IsOk()

bool wxReadOnlyDC::IsOk ( ) const

Returns true if the DC is ok to use.

◆ LogicalToDevice() [1/2]

wxPoint wxReadOnlyDC::LogicalToDevice ( const wxPoint pt) const

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

Since
3.1.5

◆ LogicalToDevice() [2/2]

wxPoint wxReadOnlyDC::LogicalToDevice ( wxCoord  x,
wxCoord  y 
) const

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.

Since
3.1.5

◆ LogicalToDeviceRel() [1/2]

wxSize wxReadOnlyDC::LogicalToDeviceRel ( const wxSize dim) const

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

Since
3.1.5

◆ LogicalToDeviceRel() [2/2]

wxSize wxReadOnlyDC::LogicalToDeviceRel ( int  x,
int  y 
) const

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.

Since
3.1.5

◆ LogicalToDeviceX()

wxCoord wxReadOnlyDC::LogicalToDeviceX ( wxCoord  x) const

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 SetTransformMatrix() is not taken into account.

◆ LogicalToDeviceXRel()

wxCoord wxReadOnlyDC::LogicalToDeviceXRel ( wxCoord  x) const

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 SetTransformMatrix() is not taken into account.

◆ LogicalToDeviceY()

wxCoord wxReadOnlyDC::LogicalToDeviceY ( wxCoord  y) const

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 SetTransformMatrix() is not taken into account.

◆ LogicalToDeviceYRel()

wxCoord wxReadOnlyDC::LogicalToDeviceYRel ( wxCoord  y) const

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 SetTransformMatrix() is not taken into account.

◆ ResetTransformMatrix()

void wxReadOnlyDC::ResetTransformMatrix ( )

Revert the transformation matrix to identity matrix.

Since
2.9.2

◆ SetAxisOrientation()

void wxReadOnlyDC::SetAxisOrientation ( bool  xLeftRight,
bool  yBottomUp 
)

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
xLeftRightTrue to set the x axis orientation to the natural left to right orientation, false to invert it.
yBottomUpTrue to set the y axis orientation to the natural bottom up orientation, false to invert it.

◆ SetDeviceOrigin()

void wxReadOnlyDC::SetDeviceOrigin ( wxCoord  x,
wxCoord  y 
)

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.

◆ SetFont()

void wxReadOnlyDC::SetFont ( const wxFont font)

Sets the current font for the DC.

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

See also
wxFont

◆ SetLayoutDirection()

void wxReadOnlyDC::SetLayoutDirection ( wxLayoutDirection  dir)

Sets the current layout direction for the device context.

Parameters
dirMay be either wxLayout_Default, wxLayout_LeftToRight or wxLayout_RightToLeft.
See also
GetLayoutDirection()

◆ SetLogicalOrigin()

void wxReadOnlyDC::SetLogicalOrigin ( wxCoord  x,
wxCoord  y 
)

Change the offset used for translating wxDC coordinates.

See also
SetLogicalOrigin(), SetDeviceOrigin()

◆ SetLogicalScale()

void wxReadOnlyDC::SetLogicalScale ( double  x,
double  y 
)

Set the scale to use for translating wxDC coordinates to the physical pixels.

The effect of calling this function is similar to that of calling SetUserScale().

◆ SetMapMode()

void wxReadOnlyDC::SetMapMode ( wxMappingMode  mode)

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 SetUserScale()) 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.

◆ SetTransformMatrix()

bool wxReadOnlyDC::SetTransformMatrix ( const wxAffineMatrix2D matrix)

Set the transformation matrix.

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

Since
2.9.2

◆ SetUserScale()

void wxReadOnlyDC::SetUserScale ( double  xScale,
double  yScale 
)

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

◆ ToDIP() [1/3]

wxPoint wxReadOnlyDC::ToDIP ( const wxPoint pt) const

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

◆ ToDIP() [2/3]

wxSize wxReadOnlyDC::ToDIP ( const wxSize sz) const

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

See wxWindow::ToDIP(const wxSize& sz) for more info about converting device independent pixel values.

Since
3.1.7

◆ ToDIP() [3/3]

int wxReadOnlyDC::ToDIP ( int  d) const

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

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

Since
3.1.7