Add wxDC::SetTransformMatrix() and related methods and implement them in wxMSW.

Add support for world transformations to wxDC too. Currently this is
implemented in wxMSW only but could be easily provided in the ports that use
wxGraphicsContext for wxDC implementation later.

Closes #13092.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67588 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2011-04-23 16:03:10 +00:00
parent 54580df4e2
commit e71508e160
19 changed files with 429 additions and 0 deletions

View File

@@ -615,6 +615,14 @@
# endif
#endif /* !defined(wxUSE_DATEPICKCTRL) */
#ifndef wxUSE_DC_TRANSFORM_MATRIX
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_DC_TRANSFORM_MATRIX must be defined, please read comment near the top of this file."
# else
# define wxUSE_DC_TRANSFORM_MATRIX 1
# endif
#endif /* wxUSE_DC_TRANSFORM_MATRIX */
#ifndef wxUSE_DIRPICKERCTRL
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_DIRPICKERCTRL must be defined, please read comment near the top of this file."

View File

@@ -30,6 +30,7 @@
#include "wx/math.h"
#include "wx/image.h"
#include "wx/region.h"
#include "wx/affinematrix2d.h"
#define wxUSE_NEW_DC 1
@@ -490,6 +491,20 @@ public:
if ( y ) *y = m_deviceOriginY;
}
#if wxUSE_DC_TRANSFORM_MATRIX
// Transform matrix support is not available in most ports right now
// (currently only wxMSW provides it) so do nothing in these methods by
// default.
virtual bool CanUseTransformMatrix() const
{ return false; }
virtual bool SetTransformMatrix(const wxAffineMatrix2D& WXUNUSED(matrix))
{ return false; }
virtual wxAffineMatrix2D GetTransformMatrix() const
{ return wxAffineMatrix2D(); }
virtual void ResetTransformMatrix()
{ }
#endif // wxUSE_DC_TRANSFORM_MATRIX
virtual void SetDeviceLocalOrigin( wxCoord x, wxCoord y );
virtual void ComputeScaleAndOrigin();
@@ -1001,6 +1016,20 @@ public:
void SetAxisOrientation(bool xLeftRight, bool yBottomUp)
{ m_pimpl->SetAxisOrientation(xLeftRight, yBottomUp); }
#if wxUSE_DC_TRANSFORM_MATRIX
bool CanUseTransformMatrix() const
{ return m_pimpl->CanUseTransformMatrix(); }
bool SetTransformMatrix(const wxAffineMatrix2D &matrix)
{ return m_pimpl->SetTransformMatrix(matrix); }
wxAffineMatrix2D GetTransformMatrix() const
{ return m_pimpl->GetTransformMatrix(); }
void ResetTransformMatrix()
{ m_pimpl->ResetTransformMatrix(); }
#endif // wxUSE_DC_TRANSFORM_MATRIX
// mostly internal
void SetDeviceLocalOrigin( wxCoord x, wxCoord y )
{ m_pimpl->SetDeviceLocalOrigin( x, y ); }

View File

@@ -1363,6 +1363,16 @@
// to create files in SVG (Scalable Vector Graphics) format.
#define wxUSE_SVG 1
// Should wxDC provide SetTransformMatrix() and related methods?
//
// Default is 1 but can be set to 0 if this functionality is not used. Notice
// that currently only wxMSW supports this so setting this to 0 doesn't change
// much for non-MSW platforms (although it will still save a few bytes
// probably).
//
// Recommended setting: 1.
#define wxUSE_DC_TRANSFORM_MATRIX 1
// ----------------------------------------------------------------------------
// image format support
// ----------------------------------------------------------------------------

View File

@@ -336,6 +336,14 @@
#endif /* !wxUSE_DYNAMIC_LOADER */
#if !wxUSE_DYNLIB_CLASS
# if wxUSE_DC_TRANSFORM_MATRIX
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_DC_TRANSFORM_MATRIX requires wxUSE_DYNLIB_CLASS"
# else
# undef wxUSE_DC_TRANSFORM_MATRIX
# define wxUSE_DC_TRANSFORM_MATRIX 0
# endif
# endif
# if wxUSE_UXTHEME
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_UXTHEME requires wxUSE_DYNLIB_CLASS"

View File

@@ -87,6 +87,13 @@ public:
virtual void SetDeviceOrigin(wxCoord x, wxCoord y);
virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp);
#if wxUSE_DC_TRANSFORM_MATRIX
virtual bool CanUseTransformMatrix() const;
virtual bool SetTransformMatrix(const wxAffineMatrix2D& matrix);
virtual wxAffineMatrix2D GetTransformMatrix() const;
virtual void ResetTransformMatrix();
#endif // wxUSE_DC_TRANSFORM_MATRIX
virtual void SetLogicalFunction(wxRasterOperationMode function);
// implementation from now on

View File

@@ -1363,6 +1363,16 @@
// to create files in SVG (Scalable Vector Graphics) format.
#define wxUSE_SVG 1
// Should wxDC provide SetTransformMatrix() and related methods?
//
// Default is 1 but can be set to 0 if this functionality is not used. Notice
// that currently only wxMSW supports this so setting this to 0 doesn't change
// much for non-MSW platforms (although it will still save a few bytes
// probably).
//
// Recommended setting: 1.
#define wxUSE_DC_TRANSFORM_MATRIX 1
// ----------------------------------------------------------------------------
// image format support
// ----------------------------------------------------------------------------

View File

@@ -1363,6 +1363,16 @@
// to create files in SVG (Scalable Vector Graphics) format.
#define wxUSE_SVG 1
// Should wxDC provide SetTransformMatrix() and related methods?
//
// Default is 1 but can be set to 0 if this functionality is not used. Notice
// that currently only wxMSW supports this so setting this to 0 doesn't change
// much for non-MSW platforms (although it will still save a few bytes
// probably).
//
// Recommended setting: 1.
#define wxUSE_DC_TRANSFORM_MATRIX 1
// ----------------------------------------------------------------------------
// image format support
// ----------------------------------------------------------------------------

View File

@@ -1363,6 +1363,16 @@
// to create files in SVG (Scalable Vector Graphics) format.
#define wxUSE_SVG 1
// Should wxDC provide SetTransformMatrix() and related methods?
//
// Default is 1 but can be set to 0 if this functionality is not used. Notice
// that currently only wxMSW supports this so setting this to 0 doesn't change
// much for non-MSW platforms (although it will still save a few bytes
// probably).
//
// Recommended setting: 1.
#define wxUSE_DC_TRANSFORM_MATRIX 1
// ----------------------------------------------------------------------------
// image format support
// ----------------------------------------------------------------------------

View File

@@ -1364,6 +1364,16 @@
// to create files in SVG (Scalable Vector Graphics) format.
#define wxUSE_SVG 1
// Should wxDC provide SetTransformMatrix() and related methods?
//
// Default is 1 but can be set to 0 if this functionality is not used. Notice
// that currently only wxMSW supports this so setting this to 0 doesn't change
// much for non-MSW platforms (although it will still save a few bytes
// probably).
//
// Recommended setting: 1.
#define wxUSE_DC_TRANSFORM_MATRIX 1
// ----------------------------------------------------------------------------
// image format support
// ----------------------------------------------------------------------------

View File

@@ -1363,6 +1363,16 @@
// to create files in SVG (Scalable Vector Graphics) format.
#define wxUSE_SVG 1
// Should wxDC provide SetTransformMatrix() and related methods?
//
// Default is 1 but can be set to 0 if this functionality is not used. Notice
// that currently only wxMSW supports this so setting this to 0 doesn't change
// much for non-MSW platforms (although it will still save a few bytes
// probably).
//
// Recommended setting: 1.
#define wxUSE_DC_TRANSFORM_MATRIX 1
// ----------------------------------------------------------------------------
// image format support
// ----------------------------------------------------------------------------

View File

@@ -1359,6 +1359,16 @@
// to create files in SVG (Scalable Vector Graphics) format.
#define wxUSE_SVG 1
// Should wxDC provide SetTransformMatrix() and related methods?
//
// Default is 1 but can be set to 0 if this functionality is not used. Notice
// that currently only wxMSW supports this so setting this to 0 doesn't change
// much for non-MSW platforms (although it will still save a few bytes
// probably).
//
// Recommended setting: 1.
#define wxUSE_DC_TRANSFORM_MATRIX 1
// ----------------------------------------------------------------------------
// image format support
// ----------------------------------------------------------------------------

View File

@@ -1362,6 +1362,16 @@
// to create files in SVG (Scalable Vector Graphics) format.
#define wxUSE_SVG 1
// Should wxDC provide SetTransformMatrix() and related methods?
//
// Default is 1 but can be set to 0 if this functionality is not used. Notice
// that currently only wxMSW supports this so setting this to 0 doesn't change
// much for non-MSW platforms (although it will still save a few bytes
// probably).
//
// Recommended setting: 1.
#define wxUSE_DC_TRANSFORM_MATRIX 1
// ----------------------------------------------------------------------------
// image format support
// ----------------------------------------------------------------------------