]>
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 /////////////////////////////////////////////////////////////////////////////
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 void DestroyClippingRegion();
57 virtual wxSize
GetPPI() const;
59 virtual void SetMapMode(int mode
);
60 virtual void SetUserScale(double x
, double y
);
61 virtual void SetLogicalScale(double x
, double y
);
62 virtual void SetLogicalOrigin(wxCoord x
, wxCoord y
);
63 virtual void SetDeviceOrigin(wxCoord x
, wxCoord y
);
64 virtual void SetAxisOrientation(bool xLeftRight
, bool yBottomUp
);
67 virtual void DoDrawIcon(const wxIcon
& icon
, wxCoord x
, wxCoord y
);
68 virtual void DoDrawBitmap(const wxBitmap
&bmp
, wxCoord x
, wxCoord y
,
69 bool useMask
= FALSE
);
71 virtual void DoSetClippingRegion(wxCoord x
, wxCoord y
,
72 wxCoord width
, wxCoord height
);
73 virtual void DoGetSize(int *width
, int *height
) const;
74 virtual void DoGetSizeMM(int* width
, int* height
) const;
77 void ComputeScaleAndOrigin();
79 wxCoord
XDEV2LOG(wxCoord x
) const
81 wxCoord new_x
= x
- m_deviceOriginX
;
83 return (wxCoord
)((double)(new_x
) / m_scaleX
+ 0.5) * m_signX
+ m_logicalOriginX
;
85 return (wxCoord
)((double)(new_x
) / m_scaleX
- 0.5) * m_signX
+ m_logicalOriginX
;
87 wxCoord
XDEV2LOGREL(wxCoord x
) const
90 return (wxCoord
)((double)(x
) / m_scaleX
+ 0.5);
92 return (wxCoord
)((double)(x
) / m_scaleX
- 0.5);
94 wxCoord
YDEV2LOG(wxCoord y
) const
96 wxCoord new_y
= y
- m_deviceOriginY
;
98 return (wxCoord
)((double)(new_y
) / m_scaleY
+ 0.5) * m_signY
+ m_logicalOriginY
;
100 return (wxCoord
)((double)(new_y
) / m_scaleY
- 0.5) * m_signY
+ m_logicalOriginY
;
102 wxCoord
YDEV2LOGREL(wxCoord y
) const
105 return (wxCoord
)((double)(y
) / m_scaleY
+ 0.5);
107 return (wxCoord
)((double)(y
) / m_scaleY
- 0.5);
109 wxCoord
XLOG2DEV(wxCoord x
) const
111 wxCoord new_x
= x
- m_logicalOriginX
;
113 return (wxCoord
)((double)(new_x
) * m_scaleX
+ 0.5) * m_signX
+ m_deviceOriginX
;
115 return (wxCoord
)((double)(new_x
) * m_scaleX
- 0.5) * m_signX
+ m_deviceOriginX
;
117 // Without device translation, for backing pixmap purposes
118 wxCoord
XLOG2DEV_2(wxCoord x
) const
120 wxCoord new_x
= x
- m_logicalOriginX
;
122 return (wxCoord
)((double)(new_x
) * m_scaleX
+ 0.5) * m_signX
;
124 return (wxCoord
)((double)(new_x
) * m_scaleX
- 0.5) * m_signX
;
126 wxCoord
XLOG2DEVREL(wxCoord x
) const
129 return (wxCoord
)((double)(x
) * m_scaleX
+ 0.5);
131 return (wxCoord
)((double)(x
) * m_scaleX
- 0.5);
133 wxCoord
YLOG2DEV(wxCoord y
) const
135 wxCoord new_y
= y
- m_logicalOriginY
;
137 return (wxCoord
)((double)(new_y
) * m_scaleY
+ 0.5) * m_signY
+ m_deviceOriginY
;
139 return (wxCoord
)((double)(new_y
) * m_scaleY
- 0.5) * m_signY
+ m_deviceOriginY
;
141 // Without device translation, for backing pixmap purposes
142 wxCoord
YLOG2DEV_2(wxCoord y
) const
144 wxCoord new_y
= y
- m_logicalOriginY
;
146 return (wxCoord
)((double)(new_y
) * m_scaleY
+ 0.5) * m_signY
;
148 return (wxCoord
)((double)(new_y
) * m_scaleY
- 0.5) * m_signY
;
150 wxCoord
YLOG2DEVREL(wxCoord y
) const
153 return (wxCoord
)((double)(y
) * m_scaleY
+ 0.5);
155 return (wxCoord
)((double)(y
) * m_scaleY
- 0.5);
159 // not sure what for, but what is a mm on a screen you don't know the size of?
160 double m_mm_to_pix_x
,m_mm_to_pix_y
;
163 bool m_needComputeScaleX
, m_needComputeScaleY
;