Implement new coordinates conversion functions in wxDC
Current DeviceToLogical{X|Y}(), LogicalToDevice{X|Y}(), DeviceToLogicalRel{X|Y}(), LogicalToDeviceRel{X|Y}() functions don't take into account transformations applied with SetTransformMatrix() so conversion results are invalid if coordinate system is e.g. rotated. We need to implement new conversion functions that take into account all applied transformations and also convert x,y coordinates in one call because in general case x,y coordinates are coupled and cannot be converted independently on each other. Closes #18923.
This commit is contained in:
parent
2c3c841719
commit
7153eaf6ec
@ -1014,6 +1014,14 @@ public:
|
||||
{ return m_pimpl->DeviceToLogicalXRel(x); }
|
||||
wxCoord DeviceToLogicalYRel(wxCoord y) const
|
||||
{ return m_pimpl->DeviceToLogicalYRel(y); }
|
||||
wxPoint DeviceToLogical(const wxPoint& pt) const
|
||||
{ return m_pimpl->DeviceToLogical(pt.x, pt.y); }
|
||||
wxPoint DeviceToLogical(wxCoord x, wxCoord y) const
|
||||
{ return m_pimpl->DeviceToLogical(x, y); }
|
||||
wxSize DeviceToLogicalRel(const wxSize& dim) const
|
||||
{ return m_pimpl->DeviceToLogicalRel(dim.x, dim.y); }
|
||||
wxSize DeviceToLogicalRel(int x, int y) const
|
||||
{ return m_pimpl->DeviceToLogicalRel(x, y); }
|
||||
wxCoord LogicalToDeviceX(wxCoord x) const
|
||||
{ return m_pimpl->LogicalToDeviceX(x); }
|
||||
wxCoord LogicalToDeviceY(wxCoord y) const
|
||||
@ -1022,6 +1030,14 @@ public:
|
||||
{ return m_pimpl->LogicalToDeviceXRel(x); }
|
||||
wxCoord LogicalToDeviceYRel(wxCoord y) const
|
||||
{ return m_pimpl->LogicalToDeviceYRel(y); }
|
||||
wxPoint LogicalToDevice(const wxPoint& pt) const
|
||||
{ return m_pimpl->LogicalToDevice(pt.x, pt.y); }
|
||||
wxPoint LogicalToDevice(wxCoord x, wxCoord y) const
|
||||
{ return m_pimpl->LogicalToDevice(x, y); }
|
||||
wxSize LogicalToDeviceRel(const wxSize& dim) const
|
||||
{ return m_pimpl->LogicalToDeviceRel(dim.x, dim.y); }
|
||||
wxSize LogicalToDeviceRel(int x, int y) const
|
||||
{ return m_pimpl->LogicalToDeviceRel(x, y); }
|
||||
|
||||
void SetMapMode(wxMappingMode mode)
|
||||
{ m_pimpl->SetMapMode(mode); }
|
||||
|
@ -283,6 +283,74 @@ public:
|
||||
*/
|
||||
wxCoord LogicalToDeviceYRel(wxCoord y) const;
|
||||
|
||||
/**
|
||||
Converts device (@a x, @a y) coordinates to logical coordinates
|
||||
taking into account all apllied transformations like the current
|
||||
mapping mode, scale factors, device origin, axes orientation,
|
||||
affine transformation.
|
||||
|
||||
@since 3.1.5
|
||||
*/
|
||||
wxPoint DeviceToLogical(wxCoord x, wxCoord y) const;
|
||||
|
||||
/**
|
||||
@overload
|
||||
|
||||
@since 3.1.5
|
||||
*/
|
||||
wxPoint DeviceToLogical(const wxPoint& pt) const;
|
||||
|
||||
/**
|
||||
Converts device @a x, @a y coordinates to relative logical coordinates
|
||||
taking into account all apllied 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
|
||||
*/
|
||||
wxSize DeviceToLogicalRel(int x, int y) const;
|
||||
|
||||
/**
|
||||
@overload
|
||||
|
||||
@since 3.1.5
|
||||
*/
|
||||
wxSize DeviceToLogicalRel(const wxSize& dim) const;
|
||||
|
||||
/**
|
||||
Converts logical (@a x, @a y) coordinates to device coordinates
|
||||
taking into account all apllied transformations like the current
|
||||
mapping mode, scale factors, device origin, axes orientation,
|
||||
affine transformation.
|
||||
|
||||
@since 3.1.5
|
||||
*/
|
||||
wxPoint LogicalToDevice(wxCoord x, wxCoord y) const;
|
||||
|
||||
/**
|
||||
@overload
|
||||
|
||||
@since 3.1.5
|
||||
*/
|
||||
wxPoint LogicalToDevice(const wxPoint& pt) const;
|
||||
|
||||
/**
|
||||
Converts logical @a x, @a y coordinates to relative device coordinates
|
||||
taking into account all apllied 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
|
||||
*/
|
||||
wxSize LogicalToDeviceRel(int x, int y) const;
|
||||
|
||||
/**
|
||||
@overload
|
||||
|
||||
@since 3.1.5
|
||||
*/
|
||||
wxSize LogicalToDeviceRel(const wxSize& dim) const;
|
||||
|
||||
//@}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user