]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/x11/dc.h
1 /////////////////////////////////////////////////////////////////////////////
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
15 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16 #pragma interface "dc.h"
23 #include "wx/gdicmn.h"
25 //-----------------------------------------------------------------------------
27 //-----------------------------------------------------------------------------
31 #define MM_ISOTROPIC 1
32 #define MM_ANISOTROPIC 2
40 //-----------------------------------------------------------------------------
42 //-----------------------------------------------------------------------------
44 class WXDLLEXPORT wxDC
: public wxDCBase
50 // implement base class pure virtuals
51 // ----------------------------------
53 virtual void DestroyClippingRegion();
55 virtual wxSize
GetPPI() const;
57 virtual void SetMapMode(int mode
);
58 virtual void SetUserScale(double x
, double y
);
59 virtual void SetLogicalScale(double x
, double y
);
60 virtual void SetLogicalOrigin(wxCoord x
, wxCoord y
);
61 virtual void SetDeviceOrigin(wxCoord x
, wxCoord y
);
62 virtual void SetAxisOrientation(bool xLeftRight
, bool yBottomUp
);
65 virtual void DoSetClippingRegion(wxCoord x
, wxCoord y
,
66 wxCoord width
, wxCoord height
);
67 virtual void DoGetSizeMM(int* width
, int* height
) const;
70 void ComputeScaleAndOrigin();
72 wxCoord
XDEV2LOG(wxCoord x
) const
74 wxCoord new_x
= x
- m_deviceOriginX
;
76 return (wxCoord
)((double)(new_x
) / m_scaleX
+ 0.5) * m_signX
+ m_logicalOriginX
;
78 return (wxCoord
)((double)(new_x
) / m_scaleX
- 0.5) * m_signX
+ m_logicalOriginX
;
80 wxCoord
XDEV2LOGREL(wxCoord x
) const
83 return (wxCoord
)((double)(x
) / m_scaleX
+ 0.5);
85 return (wxCoord
)((double)(x
) / m_scaleX
- 0.5);
87 wxCoord
YDEV2LOG(wxCoord y
) const
89 wxCoord new_y
= y
- m_deviceOriginY
;
91 return (wxCoord
)((double)(new_y
) / m_scaleY
+ 0.5) * m_signY
+ m_logicalOriginY
;
93 return (wxCoord
)((double)(new_y
) / m_scaleY
- 0.5) * m_signY
+ m_logicalOriginY
;
95 wxCoord
YDEV2LOGREL(wxCoord y
) const
98 return (wxCoord
)((double)(y
) / m_scaleY
+ 0.5);
100 return (wxCoord
)((double)(y
) / m_scaleY
- 0.5);
102 wxCoord
XLOG2DEV(wxCoord x
) const
104 wxCoord new_x
= x
- m_logicalOriginX
;
106 return (wxCoord
)((double)(new_x
) * m_scaleX
+ 0.5) * m_signX
+ m_deviceOriginX
;
108 return (wxCoord
)((double)(new_x
) * m_scaleX
- 0.5) * m_signX
+ m_deviceOriginX
;
110 wxCoord
XLOG2DEVREL(wxCoord x
) const
113 return (wxCoord
)((double)(x
) * m_scaleX
+ 0.5);
115 return (wxCoord
)((double)(x
) * m_scaleX
- 0.5);
117 wxCoord
YLOG2DEV(wxCoord y
) const
119 wxCoord new_y
= y
- m_logicalOriginY
;
121 return (wxCoord
)((double)(new_y
) * m_scaleY
+ 0.5) * m_signY
+ m_deviceOriginY
;
123 return (wxCoord
)((double)(new_y
) * m_scaleY
- 0.5) * m_signY
+ m_deviceOriginY
;
125 wxCoord
YLOG2DEVREL(wxCoord y
) const
128 return (wxCoord
)((double)(y
) * m_scaleY
+ 0.5);
130 return (wxCoord
)((double)(y
) * m_scaleY
- 0.5);
134 // not sure what for, but what is a mm on a screen you don't know the size of?
135 double m_mm_to_pix_x
,m_mm_to_pix_y
;
138 bool m_needComputeScaleX
, m_needComputeScaleY
;
142 DECLARE_ABSTRACT_CLASS(wxDC
)