]>
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 /////////////////////////////////////////////////////////////////////////////
18 //-----------------------------------------------------------------------------
20 //-----------------------------------------------------------------------------
24 //-----------------------------------------------------------------------------
26 //-----------------------------------------------------------------------------
29 #define MM_ISOTROPIC 1
30 #define MM_ANISOTROPIC 2
37 //-----------------------------------------------------------------------------
39 //-----------------------------------------------------------------------------
41 class wxDC
: public wxDCBase
43 DECLARE_ABSTRACT_CLASS(wxDC
)
49 void SetColourMap( const wxPalette
& palette
) { SetPalette(palette
); };
51 // the first two must be overridden and called
52 virtual void DestroyClippingRegion();
54 // Resolution in pixels per logical inch
55 virtual wxSize
GetPPI() const;
57 virtual bool StartDoc( const wxString
& WXUNUSED(message
) ) { return TRUE
; }
58 virtual void EndDoc() { }
59 virtual void StartPage() { }
60 virtual void EndPage() { }
62 virtual void SetMapMode( int mode
);
63 virtual void SetUserScale( double x
, double y
);
64 virtual void SetLogicalScale( double x
, double y
);
65 virtual void SetLogicalOrigin( long x
, long y
);
66 virtual void SetDeviceOrigin( long x
, long y
);
68 virtual void SetAxisOrientation( bool xLeftRight
, bool yBottomUp
);
73 virtual void ComputeScaleAndOrigin();
75 long XDEV2LOG(long x
) const
77 long new_x
= x
- m_deviceOriginX
;
79 return (long)((double)(new_x
) / m_scaleX
+ 0.5) * m_signX
+ m_logicalOriginX
;
81 return (long)((double)(new_x
) / m_scaleX
- 0.5) * m_signX
+ m_logicalOriginX
;
83 long XDEV2LOGREL(long x
) const
86 return (long)((double)(x
) / m_scaleX
+ 0.5);
88 return (long)((double)(x
) / m_scaleX
- 0.5);
90 long YDEV2LOG(long y
) const
92 long new_y
= y
- m_deviceOriginY
;
94 return (long)((double)(new_y
) / m_scaleY
+ 0.5) * m_signY
+ m_logicalOriginY
;
96 return (long)((double)(new_y
) / m_scaleY
- 0.5) * m_signY
+ m_logicalOriginY
;
98 long YDEV2LOGREL(long y
) const
101 return (long)((double)(y
) / m_scaleY
+ 0.5);
103 return (long)((double)(y
) / m_scaleY
- 0.5);
105 long XLOG2DEV(long x
) const
107 long new_x
= x
- m_logicalOriginX
;
109 return (long)((double)(new_x
) * m_scaleX
+ 0.5) * m_signX
+ m_deviceOriginX
;
111 return (long)((double)(new_x
) * m_scaleX
- 0.5) * m_signX
+ m_deviceOriginX
;
113 long XLOG2DEVREL(long x
) const
116 return (long)((double)(x
) * m_scaleX
+ 0.5);
118 return (long)((double)(x
) * m_scaleX
- 0.5);
120 long YLOG2DEV(long y
) const
122 long new_y
= y
- m_logicalOriginY
;
124 return (long)((double)(new_y
) * m_scaleY
+ 0.5) * m_signY
+ m_deviceOriginY
;
126 return (long)((double)(new_y
) * m_scaleY
- 0.5) * m_signY
+ m_deviceOriginY
;
128 long YLOG2DEVREL(long y
) const
131 return (long)((double)(y
) * m_scaleY
+ 0.5);
133 return (long)((double)(y
) * m_scaleY
- 0.5);
137 // base class pure virtuals implemented here
138 virtual void DoSetClippingRegion(long x
, long y
, long width
, long height
);
139 virtual void DoGetSize(int *width
, int *height
) const;
140 virtual void DoGetSizeMM(int* width
, int* height
) const;
143 // GTK-specific member variables
145 // not sure what for, but what is a mm on a screen you don't know the size
147 double m_mm_to_pix_x
,
150 bool m_needComputeScaleX
,
151 m_needComputeScaleY
; // not yet used
153 float m_scaleFactor
; // wxPSDC wants to have this. Will disappear.