try to clear the device/logical unit fog; remove unused and unsupported (an assertion fails if they are used) wxMM_ constants; better docs for the supported wxMM_ constants; use MM_ANISOTROPIC in old win16 metafile code instead of wxMM_ANISOTROPIC since it's not supported by wx code
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59127 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -104,19 +104,14 @@ enum wxFloodFillStyle
|
|||||||
wxFLOOD_BORDER
|
wxFLOOD_BORDER
|
||||||
};
|
};
|
||||||
|
|
||||||
// Mapping modes (same values as used by Windows, don't change)
|
// Mapping modes
|
||||||
enum wxMappingMode
|
enum wxMappingMode
|
||||||
{
|
{
|
||||||
wxMM_TEXT = 1,
|
wxMM_TEXT = 1,
|
||||||
|
wxMM_METRIC,
|
||||||
wxMM_LOMETRIC,
|
wxMM_LOMETRIC,
|
||||||
wxMM_HIMETRIC,
|
|
||||||
wxMM_LOENGLISH,
|
|
||||||
wxMM_HIENGLISH,
|
|
||||||
wxMM_TWIPS,
|
wxMM_TWIPS,
|
||||||
wxMM_ISOTROPIC,
|
wxMM_POINTS
|
||||||
wxMM_ANISOTROPIC,
|
|
||||||
wxMM_POINTS,
|
|
||||||
wxMM_METRIC
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#if WXWIN_COMPATIBILITY_2_8
|
#if WXWIN_COMPATIBILITY_2_8
|
||||||
@@ -373,7 +368,7 @@ public:
|
|||||||
// logical functions
|
// logical functions
|
||||||
|
|
||||||
virtual void SetLogicalFunction(wxRasterOperationMode function) = 0;
|
virtual void SetLogicalFunction(wxRasterOperationMode function) = 0;
|
||||||
virtual wxRasterOperationMode GetLogicalFunction() const
|
virtual wxRasterOperationMode GetLogicalFunction() const
|
||||||
{ return m_logicalFunction; }
|
{ return m_logicalFunction; }
|
||||||
|
|
||||||
// text measurement
|
// text measurement
|
||||||
@@ -1134,7 +1129,7 @@ public:
|
|||||||
|
|
||||||
bool Blit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
|
bool Blit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
|
||||||
wxDC *source, wxCoord xsrc, wxCoord ysrc,
|
wxDC *source, wxCoord xsrc, wxCoord ysrc,
|
||||||
wxRasterOperationMode rop = wxCOPY, bool useMask = false,
|
wxRasterOperationMode rop = wxCOPY, bool useMask = false,
|
||||||
wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord)
|
wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord)
|
||||||
{
|
{
|
||||||
return m_pimpl->DoBlit(xdest, ydest, width, height,
|
return m_pimpl->DoBlit(xdest, ydest, width, height,
|
||||||
@@ -1142,7 +1137,7 @@ public:
|
|||||||
}
|
}
|
||||||
bool Blit(const wxPoint& destPt, const wxSize& sz,
|
bool Blit(const wxPoint& destPt, const wxSize& sz,
|
||||||
wxDC *source, const wxPoint& srcPt,
|
wxDC *source, const wxPoint& srcPt,
|
||||||
wxRasterOperationMode rop = wxCOPY, bool useMask = false,
|
wxRasterOperationMode rop = wxCOPY, bool useMask = false,
|
||||||
const wxPoint& srcPtMask = wxDefaultPosition)
|
const wxPoint& srcPtMask = wxDefaultPosition)
|
||||||
{
|
{
|
||||||
return m_pimpl->DoBlit(destPt.x, destPt.y, sz.x, sz.y,
|
return m_pimpl->DoBlit(destPt.x, destPt.y, sz.x, sz.y,
|
||||||
@@ -1162,7 +1157,7 @@ public:
|
|||||||
}
|
}
|
||||||
bool StretchBlit(const wxPoint& dstPt, const wxSize& dstSize,
|
bool StretchBlit(const wxPoint& dstPt, const wxSize& dstSize,
|
||||||
wxDC *source, const wxPoint& srcPt, const wxSize& srcSize,
|
wxDC *source, const wxPoint& srcPt, const wxSize& srcSize,
|
||||||
wxRasterOperationMode rop = wxCOPY, bool useMask = false,
|
wxRasterOperationMode rop = wxCOPY, bool useMask = false,
|
||||||
const wxPoint& srcMaskPt = wxDefaultPosition)
|
const wxPoint& srcMaskPt = wxDefaultPosition)
|
||||||
{
|
{
|
||||||
return m_pimpl->DoStretchBlit(dstPt.x, dstPt.y, dstSize.x, dstSize.y,
|
return m_pimpl->DoStretchBlit(dstPt.x, dstPt.y, dstSize.x, dstSize.y,
|
||||||
|
@@ -49,34 +49,38 @@ enum wxFloodFillStyle
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The mapping mode which can be used with wxDC::SetMapMode.
|
The mapping used to transform @e logical units to @e device units.
|
||||||
|
See wxDC::SetMapMode.
|
||||||
*/
|
*/
|
||||||
enum wxMappingMode
|
enum wxMappingMode
|
||||||
{
|
{
|
||||||
/** Each logical unit is 1 device pixel. */
|
/**
|
||||||
|
Each logical unit is 1 device pixel.
|
||||||
|
This is the default mapping mode for all wxDC-derived classes.
|
||||||
|
*/
|
||||||
wxMM_TEXT = 1,
|
wxMM_TEXT = 1,
|
||||||
|
|
||||||
|
/** Each logical unit is 1 millimeter. */
|
||||||
|
wxMM_METRIC,
|
||||||
|
|
||||||
|
/** Each logical unit is 1/10 of a millimeter. */
|
||||||
wxMM_LOMETRIC,
|
wxMM_LOMETRIC,
|
||||||
wxMM_HIMETRIC,
|
|
||||||
|
|
||||||
/** Each logical unit is 1/10 of a mm. */
|
/**
|
||||||
wxMM_LOENGLISH,
|
Each logical unit is 1/20 of a @e "printer point", or 1/1440 of an inch
|
||||||
|
(also known as "twip"). Equivalent to about 17.64 micrometers.
|
||||||
wxMM_HIENGLISH,
|
*/
|
||||||
|
|
||||||
/** Each logical unit is 1/20 of a point, or 1/1440 of an inch. */
|
|
||||||
wxMM_TWIPS,
|
wxMM_TWIPS,
|
||||||
|
|
||||||
wxMM_ISOTROPIC,
|
/**
|
||||||
wxMM_ANISOTROPIC,
|
Each logical unit is a @e "printer point" i.e. 1/72 of an inch.
|
||||||
|
Equivalent to about 353 micrometers.
|
||||||
/** Each logical unit is a point, or 1/72 of an inch. */
|
*/
|
||||||
wxMM_POINTS,
|
wxMM_POINTS
|
||||||
|
|
||||||
/** Each logical unit is 1 mm. */
|
|
||||||
wxMM_METRIC
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@class wxDC
|
@class wxDC
|
||||||
|
|
||||||
@@ -112,6 +116,23 @@ enum wxMappingMode
|
|||||||
or wxBrush that are built from wxColour use the colour's alpha values
|
or wxBrush that are built from wxColour use the colour's alpha values
|
||||||
when stroking or filling.
|
when stroking or filling.
|
||||||
|
|
||||||
|
|
||||||
|
@section dc_units Device and logical units
|
||||||
|
|
||||||
|
In the wxDC context there is a distinction between @e logical units and @e device units.
|
||||||
|
|
||||||
|
@b Device units are the units native to the particular device; e.g. for a screen,
|
||||||
|
a device unit is a @e pixel. For a printer, the device unit is defined by the
|
||||||
|
resolution of the printer (usually given in @c DPI: dot-per-inch).
|
||||||
|
|
||||||
|
All wxDC functions use instead @b logical units, unless where explicitely
|
||||||
|
stated. Logical units are arbitrary units mapped to device units using
|
||||||
|
the current mapping mode (see wxDC::SetMapMode).
|
||||||
|
|
||||||
|
This mechanism allows to reuse the same code which prints on e.g. a window
|
||||||
|
on the screen to print on e.g. a paper.
|
||||||
|
|
||||||
|
|
||||||
@library{wxcore}
|
@library{wxcore}
|
||||||
@category{dc,gdi}
|
@category{dc,gdi}
|
||||||
|
|
||||||
@@ -121,9 +142,6 @@ enum wxMappingMode
|
|||||||
@todo Precise definition of default/initial state.
|
@todo Precise definition of default/initial state.
|
||||||
@todo Pixelwise definition of operations (e.g. last point of a line not
|
@todo Pixelwise definition of operations (e.g. last point of a line not
|
||||||
drawn).
|
drawn).
|
||||||
@todo Coordinates: state clearly which type of coordinates are returned by
|
|
||||||
the various Get*Point() or similar functions - often they are client
|
|
||||||
coordinates but not always.
|
|
||||||
*/
|
*/
|
||||||
class wxDC : public wxObject
|
class wxDC : public wxObject
|
||||||
{
|
{
|
||||||
@@ -223,26 +241,26 @@ public:
|
|||||||
void DestroyClippingRegion();
|
void DestroyClippingRegion();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Convert device X coordinate to logical coordinate, using the current
|
Convert @e device X coordinate to logical coordinate, using the current
|
||||||
mapping mode, user scale factor, device origin and axis orientation.
|
mapping mode, user scale factor, device origin and axis orientation.
|
||||||
*/
|
*/
|
||||||
wxCoord DeviceToLogicalX(wxCoord x) const;
|
wxCoord DeviceToLogicalX(wxCoord x) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Convert device X coordinate to relative logical coordinate, using the
|
Convert @e device X coordinate to relative logical coordinate, using the
|
||||||
current mapping mode and user scale factor but ignoring the
|
current mapping mode and user scale factor but ignoring the
|
||||||
axis orientation. Use this for converting a width, for example.
|
axis orientation. Use this for converting a width, for example.
|
||||||
*/
|
*/
|
||||||
wxCoord DeviceToLogicalXRel(wxCoord x) const;
|
wxCoord DeviceToLogicalXRel(wxCoord x) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Converts device Y coordinate to logical coordinate, using the current
|
Converts @e device Y coordinate to logical coordinate, using the current
|
||||||
mapping mode, user scale factor, device origin and axis orientation.
|
mapping mode, user scale factor, device origin and axis orientation.
|
||||||
*/
|
*/
|
||||||
wxCoord DeviceToLogicalY(wxCoord y) const;
|
wxCoord DeviceToLogicalY(wxCoord y) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Convert device Y coordinate to relative logical coordinate, using the
|
Convert @e device Y coordinate to relative logical coordinate, using the
|
||||||
current mapping mode and user scale factor but ignoring the
|
current mapping mode and user scale factor but ignoring the
|
||||||
axis orientation. Use this for converting a height, for example.
|
axis orientation. Use this for converting a height, for example.
|
||||||
*/
|
*/
|
||||||
@@ -618,7 +636,7 @@ public:
|
|||||||
wxRasterOperationMode GetLogicalFunction() const;
|
wxRasterOperationMode GetLogicalFunction() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Gets the mapping mode for the device context.
|
Gets the current mapping mode for the device context.
|
||||||
|
|
||||||
@see SetMapMode()
|
@see SetMapMode()
|
||||||
*/
|
*/
|
||||||
@@ -700,8 +718,8 @@ public:
|
|||||||
|
|
||||||
//@{
|
//@{
|
||||||
/**
|
/**
|
||||||
This gets the horizontal and vertical resolution in device units. It
|
Gets the horizontal and vertical extent of this device context in @e device units.
|
||||||
can be used to scale graphics to fit the page.
|
It can be used to scale graphics to fit the page.
|
||||||
|
|
||||||
For example, if @e maxX and @e maxY represent the maximum horizontal
|
For example, if @e maxX and @e maxY represent the maximum horizontal
|
||||||
and vertical 'pixel' values used in your application, the following
|
and vertical 'pixel' values used in your application, the following
|
||||||
@@ -987,7 +1005,7 @@ public:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
The mapping mode of the device context defines the unit of measurement
|
The mapping mode of the device context defines the unit of measurement
|
||||||
used to convert logical units to device units.
|
used to convert @e logical units to @e device units.
|
||||||
|
|
||||||
Note that in X, text drawing isn't handled consistently with the mapping mode;
|
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
|
a font is always specified in point size. However, setting the user scale (see
|
||||||
|
@@ -64,7 +64,7 @@ IMPLEMENT_ABSTRACT_CLASS(wxMetafileDC, wxDC)
|
|||||||
wxMetafileRefData::wxMetafileRefData()
|
wxMetafileRefData::wxMetafileRefData()
|
||||||
{
|
{
|
||||||
m_metafile = 0;
|
m_metafile = 0;
|
||||||
m_windowsMappingMode = wxMM_ANISOTROPIC;
|
m_windowsMappingMode = MM_ANISOTROPIC;
|
||||||
m_width = m_height = 0;
|
m_width = m_height = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,7 +85,7 @@ wxMetafile::wxMetafile(const wxString& file)
|
|||||||
{
|
{
|
||||||
m_refData = new wxMetafileRefData;
|
m_refData = new wxMetafileRefData;
|
||||||
|
|
||||||
M_METAFILEDATA->m_windowsMappingMode = wxMM_ANISOTROPIC;
|
M_METAFILEDATA->m_windowsMappingMode = MM_ANISOTROPIC;
|
||||||
M_METAFILEDATA->m_metafile = 0;
|
M_METAFILEDATA->m_metafile = 0;
|
||||||
if (!file.empty())
|
if (!file.empty())
|
||||||
M_METAFILEDATA->m_metafile = (WXHANDLE) GetMetaFile(file);
|
M_METAFILEDATA->m_metafile = (WXHANDLE) GetMetaFile(file);
|
||||||
@@ -213,7 +213,7 @@ wxMetafileDCImpl::wxMetafileDCImpl(wxDC *owner, const wxString& file,
|
|||||||
::SetWindowExtEx((HDC) m_hDC,xext,yext, NULL);
|
::SetWindowExtEx((HDC) m_hDC,xext,yext, NULL);
|
||||||
|
|
||||||
// Actual Windows mapping mode, for future reference.
|
// Actual Windows mapping mode, for future reference.
|
||||||
m_windowsMappingMode = wxMM_ANISOTROPIC;
|
m_windowsMappingMode = MM_ANISOTROPIC;
|
||||||
|
|
||||||
SetMapMode(wxMM_TEXT); // NOTE: does not set HDC mapmode (this is correct)
|
SetMapMode(wxMM_TEXT); // NOTE: does not set HDC mapmode (this is correct)
|
||||||
}
|
}
|
||||||
|
@@ -40,7 +40,7 @@ IMPLEMENT_ABSTRACT_CLASS(wxMetafileDC, wxDC)
|
|||||||
wxMetafileRefData::wxMetafileRefData(void)
|
wxMetafileRefData::wxMetafileRefData(void)
|
||||||
{
|
{
|
||||||
m_metafile = 0;
|
m_metafile = 0;
|
||||||
m_windowsMappingMode = wxMM_ANISOTROPIC;
|
m_windowsMappingMode = MM_ANISOTROPIC;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxMetafileRefData::~wxMetafileRefData(void)
|
wxMetafileRefData::~wxMetafileRefData(void)
|
||||||
@@ -56,7 +56,7 @@ wxMetafile::wxMetafile(const wxString& file)
|
|||||||
{
|
{
|
||||||
m_refData = new wxMetafileRefData;
|
m_refData = new wxMetafileRefData;
|
||||||
|
|
||||||
M_METAFILEDATA->m_windowsMappingMode = wxMM_ANISOTROPIC;
|
M_METAFILEDATA->m_windowsMappingMode = MM_ANISOTROPIC;
|
||||||
M_METAFILEDATA->m_metafile = 0;
|
M_METAFILEDATA->m_metafile = 0;
|
||||||
if (!file.empty())
|
if (!file.empty())
|
||||||
M_METAFILEDATA->m_metafile = (WXHANDLE)0; // TODO: GetMetaFile(file);
|
M_METAFILEDATA->m_metafile = (WXHANDLE)0; // TODO: GetMetaFile(file);
|
||||||
@@ -185,7 +185,7 @@ wxMetafileDCImpl::wxMetafileDCImpl( wxDC *owner, const wxString& file,
|
|||||||
// ::SetWindowExtEx((HDC) m_hDC,xext,yext, NULL);
|
// ::SetWindowExtEx((HDC) m_hDC,xext,yext, NULL);
|
||||||
|
|
||||||
// Actual Windows mapping mode, for future reference.
|
// Actual Windows mapping mode, for future reference.
|
||||||
m_windowsMappingMode = wxMM_ANISOTROPIC;
|
m_windowsMappingMode = MM_ANISOTROPIC;
|
||||||
|
|
||||||
SetMapMode(wxMM_TEXT); // NOTE: does not set HDC mapmode (this is correct)
|
SetMapMode(wxMM_TEXT); // NOTE: does not set HDC mapmode (this is correct)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user