]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk1/dc.h
1 /////////////////////////////////////////////////////////////////////////////
4 // Author: Robert Roebling
6 // Copyright: (c) 1998 Robert Roebling
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
13 //-----------------------------------------------------------------------------
15 //-----------------------------------------------------------------------------
17 class WXDLLIMPEXP_CORE wxDC
;
19 //-----------------------------------------------------------------------------
21 //-----------------------------------------------------------------------------
25 #define MM_ISOTROPIC 1
26 #define MM_ANISOTROPIC 2
34 //-----------------------------------------------------------------------------
36 //-----------------------------------------------------------------------------
38 class WXDLLIMPEXP_CORE wxDC
: public wxDCBase
44 void SetColourMap( const wxPalette
& palette
) { SetPalette(palette
); };
46 // Resolution in pixels per logical inch
47 virtual wxSize
GetPPI() const;
49 virtual bool StartDoc( const wxString
& WXUNUSED(message
) ) { return true; }
50 virtual void EndDoc() { }
51 virtual void StartPage() { }
52 virtual void EndPage() { }
54 virtual void SetMapMode( int mode
);
55 virtual void SetUserScale( double x
, double y
);
56 virtual void SetLogicalScale( double x
, double y
);
57 virtual void SetLogicalOrigin( wxCoord x
, wxCoord y
);
58 virtual void SetDeviceOrigin( wxCoord x
, wxCoord y
);
60 virtual void SetAxisOrientation( bool xLeftRight
, bool yBottomUp
);
65 virtual void ComputeScaleAndOrigin();
67 wxCoord
XDEV2LOG(wxCoord x
) const
69 wxCoord new_x
= x
- m_deviceOriginX
;
71 return (wxCoord
)((double)(new_x
) / m_scaleX
+ 0.5) * m_signX
+ m_logicalOriginX
;
73 return (wxCoord
)((double)(new_x
) / m_scaleX
- 0.5) * m_signX
+ m_logicalOriginX
;
75 wxCoord
XDEV2LOGREL(wxCoord x
) const
78 return (wxCoord
)((double)(x
) / m_scaleX
+ 0.5);
80 return (wxCoord
)((double)(x
) / m_scaleX
- 0.5);
82 wxCoord
YDEV2LOG(wxCoord y
) const
84 wxCoord new_y
= y
- m_deviceOriginY
;
86 return (wxCoord
)((double)(new_y
) / m_scaleY
+ 0.5) * m_signY
+ m_logicalOriginY
;
88 return (wxCoord
)((double)(new_y
) / m_scaleY
- 0.5) * m_signY
+ m_logicalOriginY
;
90 wxCoord
YDEV2LOGREL(wxCoord y
) const
93 return (wxCoord
)((double)(y
) / m_scaleY
+ 0.5);
95 return (wxCoord
)((double)(y
) / m_scaleY
- 0.5);
97 wxCoord
XLOG2DEV(wxCoord x
) const
99 wxCoord new_x
= x
- m_logicalOriginX
;
101 return (wxCoord
)((double)(new_x
) * m_scaleX
+ 0.5) * m_signX
+ m_deviceOriginX
;
103 return (wxCoord
)((double)(new_x
) * m_scaleX
- 0.5) * m_signX
+ m_deviceOriginX
;
105 wxCoord
XLOG2DEVREL(wxCoord x
) const
108 return (wxCoord
)((double)(x
) * m_scaleX
+ 0.5);
110 return (wxCoord
)((double)(x
) * m_scaleX
- 0.5);
112 wxCoord
YLOG2DEV(wxCoord y
) const
114 wxCoord new_y
= y
- m_logicalOriginY
;
116 return (wxCoord
)((double)(new_y
) * m_scaleY
+ 0.5) * m_signY
+ m_deviceOriginY
;
118 return (wxCoord
)((double)(new_y
) * m_scaleY
- 0.5) * m_signY
+ m_deviceOriginY
;
120 wxCoord
YLOG2DEVREL(wxCoord y
) const
123 return (wxCoord
)((double)(y
) * m_scaleY
+ 0.5);
125 return (wxCoord
)((double)(y
) * m_scaleY
- 0.5);
129 // base class pure virtuals implemented here
130 virtual void DoSetClippingRegion(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
);
131 virtual void DoGetSizeMM(int* width
, int* height
) const;
134 // GTK-specific member variables
136 // not sure what for, but what is a mm on a screen you don't know the size
138 double m_mm_to_pix_x
,
141 bool m_needComputeScaleX
,
142 m_needComputeScaleY
; // not yet used
146 DECLARE_ABSTRACT_CLASS(wxDC
)
149 // this must be defined when wxDC::Blit() honours the DC origian and needed to
150 // allow wxUniv code in univ/winuniv.cpp to work with versions of wxGTK
152 #ifndef wxHAS_WORKING_GTK_DC_BLIT
153 #define wxHAS_WORKING_GTK_DC_BLIT