]>
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 /////////////////////////////////////////////////////////////////////////////
14 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
18 //-----------------------------------------------------------------------------
20 //-----------------------------------------------------------------------------
24 //-----------------------------------------------------------------------------
26 //-----------------------------------------------------------------------------
29 #define MM_ISOTROPIC 1
30 #define MM_ANISOTROPIC 2
37 //-----------------------------------------------------------------------------
39 //-----------------------------------------------------------------------------
41 class wxDC
: public wxDCBase
47 void SetColourMap( const wxPalette
& palette
) { SetPalette(palette
); };
49 // Resolution in pixels per logical inch
50 virtual wxSize
GetPPI() const;
52 virtual bool StartDoc( const wxString
& WXUNUSED(message
) ) { return TRUE
; }
53 virtual void EndDoc() { }
54 virtual void StartPage() { }
55 virtual void EndPage() { }
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
);
63 virtual void SetAxisOrientation( bool xLeftRight
, bool yBottomUp
);
68 virtual void ComputeScaleAndOrigin();
70 wxCoord
XDEV2LOG(wxCoord x
) const
72 wxCoord new_x
= x
- m_deviceOriginX
;
74 return (wxCoord
)((double)(new_x
) / m_scaleX
+ 0.5) * m_signX
+ m_logicalOriginX
;
76 return (wxCoord
)((double)(new_x
) / m_scaleX
- 0.5) * m_signX
+ m_logicalOriginX
;
78 wxCoord
XDEV2LOGREL(wxCoord x
) const
81 return (wxCoord
)((double)(x
) / m_scaleX
+ 0.5);
83 return (wxCoord
)((double)(x
) / m_scaleX
- 0.5);
85 wxCoord
YDEV2LOG(wxCoord y
) const
87 wxCoord new_y
= y
- m_deviceOriginY
;
89 return (wxCoord
)((double)(new_y
) / m_scaleY
+ 0.5) * m_signY
+ m_logicalOriginY
;
91 return (wxCoord
)((double)(new_y
) / m_scaleY
- 0.5) * m_signY
+ m_logicalOriginY
;
93 wxCoord
YDEV2LOGREL(wxCoord y
) const
96 return (wxCoord
)((double)(y
) / m_scaleY
+ 0.5);
98 return (wxCoord
)((double)(y
) / m_scaleY
- 0.5);
100 wxCoord
XLOG2DEV(wxCoord x
) const
102 wxCoord new_x
= x
- m_logicalOriginX
;
104 return (wxCoord
)((double)(new_x
) * m_scaleX
+ 0.5) * m_signX
+ m_deviceOriginX
;
106 return (wxCoord
)((double)(new_x
) * m_scaleX
- 0.5) * m_signX
+ m_deviceOriginX
;
108 wxCoord
XLOG2DEVREL(wxCoord x
) const
111 return (wxCoord
)((double)(x
) * m_scaleX
+ 0.5);
113 return (wxCoord
)((double)(x
) * m_scaleX
- 0.5);
115 wxCoord
YLOG2DEV(wxCoord y
) const
117 wxCoord new_y
= y
- m_logicalOriginY
;
119 return (wxCoord
)((double)(new_y
) * m_scaleY
+ 0.5) * m_signY
+ m_deviceOriginY
;
121 return (wxCoord
)((double)(new_y
) * m_scaleY
- 0.5) * m_signY
+ m_deviceOriginY
;
123 wxCoord
YLOG2DEVREL(wxCoord y
) const
126 return (wxCoord
)((double)(y
) * m_scaleY
+ 0.5);
128 return (wxCoord
)((double)(y
) * m_scaleY
- 0.5);
132 // base class pure virtuals implemented here
133 virtual void DoSetClippingRegion(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
);
134 virtual void DoGetSizeMM(int* width
, int* height
) const;
137 // GTK-specific member variables
139 // not sure what for, but what is a mm on a screen you don't know the size
141 double m_mm_to_pix_x
,
144 bool m_needComputeScaleX
,
145 m_needComputeScaleY
; // not yet used
149 DECLARE_ABSTRACT_CLASS(wxDC
)
152 // this must be defined when wxDC::Blit() honours the DC origian and needed to
153 // allow wxUniv code in univ/winuniv.cpp to work with versions of wxGTK
155 #ifndef wxHAS_WORKING_GTK_DC_BLIT
156 #define wxHAS_WORKING_GTK_DC_BLIT