]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/motif/dc.h
a7926f69f26b4885a6507bf61e1b482dcd9cdad4
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
46 DECLARE_DYNAMIC_CLASS(wxDC
)
52 // implement base class pure virtuals
53 // ----------------------------------
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 DoDrawIcon(const wxIcon
& icon
, wxCoord x
, wxCoord y
);
66 virtual void DoDrawBitmap(const wxBitmap
&bmp
, wxCoord x
, wxCoord y
,
67 bool useMask
= false);
69 virtual void DoSetClippingRegion(wxCoord x
, wxCoord y
,
70 wxCoord width
, wxCoord height
);
71 virtual void DoGetSize(int *width
, int *height
) const;
72 virtual void DoGetSizeMM(int* width
, int* height
) const;
75 virtual void ComputeScaleAndOrigin();
77 wxCoord
XDEV2LOG(wxCoord x
) const
79 wxCoord new_x
= x
- m_deviceOriginX
;
81 return (wxCoord
)((double)(new_x
) / m_scaleX
+ 0.5) * m_signX
+ m_logicalOriginX
;
83 return (wxCoord
)((double)(new_x
) / m_scaleX
- 0.5) * m_signX
+ m_logicalOriginX
;
85 wxCoord
XDEV2LOGREL(wxCoord x
) const
88 return (wxCoord
)((double)(x
) / m_scaleX
+ 0.5);
90 return (wxCoord
)((double)(x
) / m_scaleX
- 0.5);
92 wxCoord
YDEV2LOG(wxCoord y
) const
94 wxCoord new_y
= y
- m_deviceOriginY
;
96 return (wxCoord
)((double)(new_y
) / m_scaleY
+ 0.5) * m_signY
+ m_logicalOriginY
;
98 return (wxCoord
)((double)(new_y
) / m_scaleY
- 0.5) * m_signY
+ m_logicalOriginY
;
100 wxCoord
YDEV2LOGREL(wxCoord y
) const
103 return (wxCoord
)((double)(y
) / m_scaleY
+ 0.5);
105 return (wxCoord
)((double)(y
) / m_scaleY
- 0.5);
107 wxCoord
XLOG2DEV(wxCoord x
) const
109 wxCoord new_x
= x
- m_logicalOriginX
;
111 return (wxCoord
)((double)(new_x
) * m_scaleX
+ 0.5) * m_signX
+ m_deviceOriginX
;
113 return (wxCoord
)((double)(new_x
) * m_scaleX
- 0.5) * m_signX
+ m_deviceOriginX
;
115 // Without device translation, for backing pixmap purposes
116 wxCoord
XLOG2DEV_2(wxCoord x
) const
118 wxCoord new_x
= x
- m_logicalOriginX
;
120 return (wxCoord
)((double)(new_x
) * m_scaleX
+ 0.5) * m_signX
;
122 return (wxCoord
)((double)(new_x
) * m_scaleX
- 0.5) * m_signX
;
124 wxCoord
XLOG2DEVREL(wxCoord x
) const
127 return (wxCoord
)((double)(x
) * m_scaleX
+ 0.5);
129 return (wxCoord
)((double)(x
) * m_scaleX
- 0.5);
131 wxCoord
YLOG2DEV(wxCoord y
) const
133 wxCoord new_y
= y
- m_logicalOriginY
;
135 return (wxCoord
)((double)(new_y
) * m_scaleY
+ 0.5) * m_signY
+ m_deviceOriginY
;
137 return (wxCoord
)((double)(new_y
) * m_scaleY
- 0.5) * m_signY
+ m_deviceOriginY
;
139 // Without device translation, for backing pixmap purposes
140 wxCoord
YLOG2DEV_2(wxCoord y
) const
142 wxCoord new_y
= y
- m_logicalOriginY
;
144 return (wxCoord
)((double)(new_y
) * m_scaleY
+ 0.5) * m_signY
;
146 return (wxCoord
)((double)(new_y
) * m_scaleY
- 0.5) * m_signY
;
148 wxCoord
YLOG2DEVREL(wxCoord y
) const
151 return (wxCoord
)((double)(y
) * m_scaleY
+ 0.5);
153 return (wxCoord
)((double)(y
) * m_scaleY
- 0.5);
157 // not sure what for, but what is a mm on a screen you don't know the size of?
158 double m_mm_to_pix_x
,m_mm_to_pix_y
;
161 bool m_needComputeScaleX
, m_needComputeScaleY
;