]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk/dc.h
1 /////////////////////////////////////////////////////////////////////////////
4 // Author: Robert Roebling
6 // Copyright: (c) 1998 Robert Roebling
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
13 //-----------------------------------------------------------------------------
15 //-----------------------------------------------------------------------------
19 #define MM_ISOTROPIC 1
20 #define MM_ANISOTROPIC 2
28 //-----------------------------------------------------------------------------
29 // coordinates transformations
30 //-----------------------------------------------------------------------------
32 inline wxCoord
wxDCBase::DeviceToLogicalX(wxCoord x
) const
34 return wxRound((x
- m_deviceOriginX
) / m_scaleX
) * m_signX
+ m_logicalOriginX
;
36 inline wxCoord
wxDCBase::DeviceToLogicalY(wxCoord y
) const
38 return wxRound((y
- m_deviceOriginY
) / m_scaleY
) * m_signY
+ m_logicalOriginY
;
40 inline wxCoord
wxDCBase::DeviceToLogicalXRel(wxCoord x
) const
42 return wxRound(x
/ m_scaleX
);
44 inline wxCoord
wxDCBase::DeviceToLogicalYRel(wxCoord y
) const
46 return wxRound(y
/ m_scaleY
);
48 inline wxCoord
wxDCBase::LogicalToDeviceX(wxCoord x
) const
50 return wxRound((x
- m_logicalOriginX
) * m_scaleX
) * m_signX
+ m_deviceOriginX
;
52 inline wxCoord
wxDCBase::LogicalToDeviceY(wxCoord y
) const
54 return wxRound((y
- m_logicalOriginY
) * m_scaleY
) * m_signY
+ m_deviceOriginY
;
56 inline wxCoord
wxDCBase::LogicalToDeviceXRel(wxCoord x
) const
58 return wxRound(x
* m_scaleX
);
60 inline wxCoord
wxDCBase::LogicalToDeviceYRel(wxCoord y
) const
62 return wxRound(y
* m_scaleY
);
65 //-----------------------------------------------------------------------------
67 //-----------------------------------------------------------------------------
69 class WXDLLIMPEXP_CORE wxDC
: public wxDCBase
76 void SetColourMap( const wxPalette
& palette
) { SetPalette(palette
); };
77 #endif // wxUSE_PALETTE
79 // Resolution in pixels per logical inch
80 virtual wxSize
GetPPI() const;
82 virtual bool StartDoc( const wxString
& WXUNUSED(message
) ) { return true; }
83 virtual void EndDoc() { }
84 virtual void StartPage() { }
85 virtual void EndPage() { }
87 virtual void SetMapMode( int mode
);
88 virtual void SetUserScale( double x
, double y
);
89 virtual void SetLogicalScale( double x
, double y
);
90 virtual void SetLogicalOrigin( wxCoord x
, wxCoord y
);
91 virtual void SetDeviceOrigin( wxCoord x
, wxCoord y
);
93 virtual void SetAxisOrientation( bool xLeftRight
, bool yBottomUp
);
95 virtual void ComputeScaleAndOrigin();
97 virtual GdkWindow
* GetGDKWindow() const { return NULL
; }
98 virtual wxBitmap
GetSelectedBitmap() const { return wxNullBitmap
; }
104 wxCoord
XDEV2LOG(wxCoord x
) const
106 return DeviceToLogicalX(x
);
108 wxCoord
XDEV2LOGREL(wxCoord x
) const
110 return DeviceToLogicalXRel(x
);
112 wxCoord
YDEV2LOG(wxCoord y
) const
114 return DeviceToLogicalY(y
);
116 wxCoord
YDEV2LOGREL(wxCoord y
) const
118 return DeviceToLogicalYRel(y
);
120 wxCoord
XLOG2DEV(wxCoord x
) const
122 return LogicalToDeviceX(x
);
124 wxCoord
XLOG2DEVREL(wxCoord x
) const
126 return LogicalToDeviceXRel(x
);
128 wxCoord
YLOG2DEV(wxCoord y
) const
130 return LogicalToDeviceY(y
);
132 wxCoord
YLOG2DEVREL(wxCoord y
) const
134 return LogicalToDeviceYRel(y
);
137 // base class pure virtuals implemented here
138 virtual void DoSetClippingRegion(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
);
139 virtual void DoGetSizeMM(int* width
, int* height
) const;
142 // GTK-specific member variables
144 // not sure what for, but what is a mm on a screen you don't know the size
146 double m_mm_to_pix_x
,
149 bool m_needComputeScaleX
,
150 m_needComputeScaleY
; // not yet used
154 DECLARE_ABSTRACT_CLASS(wxDC
)
157 // this must be defined when wxDC::Blit() honours the DC origian and needed to
158 // allow wxUniv code in univ/winuniv.cpp to work with versions of wxGTK
160 #ifndef wxHAS_WORKING_GTK_DC_BLIT
161 #define wxHAS_WORKING_GTK_DC_BLIT