]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/motif/dc.h
1 /////////////////////////////////////////////////////////////////////////////
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
19 #include "wx/gdicmn.h"
21 //-----------------------------------------------------------------------------
23 //-----------------------------------------------------------------------------
27 #define MM_ISOTROPIC 1
28 #define MM_ANISOTROPIC 2
36 //-----------------------------------------------------------------------------
38 //-----------------------------------------------------------------------------
40 class WXDLLEXPORT wxDC
: public wxDCBase
42 DECLARE_DYNAMIC_CLASS(wxDC
)
48 // implement base class pure virtuals
49 // ----------------------------------
51 virtual wxSize
GetPPI() const;
53 virtual void SetMapMode(int mode
);
54 virtual void SetUserScale(double x
, double y
);
55 virtual void SetLogicalScale(double x
, double y
);
56 virtual void SetLogicalOrigin(wxCoord x
, wxCoord y
);
57 virtual void SetDeviceOrigin(wxCoord x
, wxCoord y
);
58 virtual void SetAxisOrientation(bool xLeftRight
, bool yBottomUp
);
61 virtual void DoDrawIcon(const wxIcon
& icon
, wxCoord x
, wxCoord y
);
62 virtual void DoDrawBitmap(const wxBitmap
&bmp
, wxCoord x
, wxCoord y
,
63 bool useMask
= false);
65 virtual void DoSetClippingRegion(wxCoord x
, wxCoord y
,
66 wxCoord width
, wxCoord height
);
67 virtual void DoGetSize(int *width
, int *height
) const;
68 virtual void DoGetSizeMM(int* width
, int* height
) const;
71 virtual void ComputeScaleAndOrigin();
73 wxCoord
XDEV2LOG(wxCoord x
) const
75 wxCoord new_x
= x
- m_deviceOriginX
;
77 return (wxCoord
)((double)(new_x
) / m_scaleX
+ 0.5) * m_signX
+ m_logicalOriginX
;
79 return (wxCoord
)((double)(new_x
) / m_scaleX
- 0.5) * m_signX
+ m_logicalOriginX
;
81 wxCoord
XDEV2LOGREL(wxCoord x
) const
84 return (wxCoord
)((double)(x
) / m_scaleX
+ 0.5);
86 return (wxCoord
)((double)(x
) / m_scaleX
- 0.5);
88 wxCoord
YDEV2LOG(wxCoord y
) const
90 wxCoord new_y
= y
- m_deviceOriginY
;
92 return (wxCoord
)((double)(new_y
) / m_scaleY
+ 0.5) * m_signY
+ m_logicalOriginY
;
94 return (wxCoord
)((double)(new_y
) / m_scaleY
- 0.5) * m_signY
+ m_logicalOriginY
;
96 wxCoord
YDEV2LOGREL(wxCoord y
) const
99 return (wxCoord
)((double)(y
) / m_scaleY
+ 0.5);
101 return (wxCoord
)((double)(y
) / m_scaleY
- 0.5);
103 wxCoord
XLOG2DEV(wxCoord x
) const
105 wxCoord new_x
= x
- m_logicalOriginX
;
107 return (wxCoord
)((double)(new_x
) * m_scaleX
+ 0.5) * m_signX
+ m_deviceOriginX
;
109 return (wxCoord
)((double)(new_x
) * m_scaleX
- 0.5) * m_signX
+ m_deviceOriginX
;
111 // Without device translation, for backing pixmap purposes
112 wxCoord
XLOG2DEV_2(wxCoord x
) const
114 wxCoord new_x
= x
- m_logicalOriginX
;
116 return (wxCoord
)((double)(new_x
) * m_scaleX
+ 0.5) * m_signX
;
118 return (wxCoord
)((double)(new_x
) * m_scaleX
- 0.5) * m_signX
;
120 wxCoord
XLOG2DEVREL(wxCoord x
) const
123 return (wxCoord
)((double)(x
) * m_scaleX
+ 0.5);
125 return (wxCoord
)((double)(x
) * m_scaleX
- 0.5);
127 wxCoord
YLOG2DEV(wxCoord y
) const
129 wxCoord new_y
= y
- m_logicalOriginY
;
131 return (wxCoord
)((double)(new_y
) * m_scaleY
+ 0.5) * m_signY
+ m_deviceOriginY
;
133 return (wxCoord
)((double)(new_y
) * m_scaleY
- 0.5) * m_signY
+ m_deviceOriginY
;
135 // Without device translation, for backing pixmap purposes
136 wxCoord
YLOG2DEV_2(wxCoord y
) const
138 wxCoord new_y
= y
- m_logicalOriginY
;
140 return (wxCoord
)((double)(new_y
) * m_scaleY
+ 0.5) * m_signY
;
142 return (wxCoord
)((double)(new_y
) * m_scaleY
- 0.5) * m_signY
;
144 wxCoord
YLOG2DEVREL(wxCoord y
) const
147 return (wxCoord
)((double)(y
) * m_scaleY
+ 0.5);
149 return (wxCoord
)((double)(y
) * m_scaleY
- 0.5);
153 // not sure what for, but what is a mm on a screen you don't know the size of?
154 double m_mm_to_pix_x
,m_mm_to_pix_y
;
157 bool m_needComputeScaleX
, m_needComputeScaleY
;