]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gtk/dc.h
adjust so that mono bitmaps don't get an alpha channel
[wxWidgets.git] / include / wx / gtk / dc.h
CommitLineData
c801d85f 1/////////////////////////////////////////////////////////////////////////////
0b04c4e0 2// Name: wx/gtk/dc.h
c801d85f
KB
3// Purpose:
4// Author: Robert Roebling
dbf858b5
RR
5// Id: $Id$
6// Copyright: (c) 1998 Robert Roebling
65571936 7// Licence: wxWindows licence
c801d85f
KB
8/////////////////////////////////////////////////////////////////////////////
9
c801d85f
KB
10#ifndef __GTKDCH__
11#define __GTKDCH__
12
c801d85f
KB
13//-----------------------------------------------------------------------------
14// constants
15//-----------------------------------------------------------------------------
16
d2b1753d 17#ifndef MM_TEXT
a23fd0e1 18#define MM_TEXT 0
8bbe427f 19#define MM_ISOTROPIC 1
a23fd0e1
VZ
20#define MM_ANISOTROPIC 2
21#define MM_LOMETRIC 3
22#define MM_HIMETRIC 4
23#define MM_TWIPS 5
24#define MM_POINTS 6
25#define MM_METRIC 7
d2b1753d 26#endif
c801d85f 27
772b3767
PC
28//-----------------------------------------------------------------------------
29// coordinates transformations
30//-----------------------------------------------------------------------------
31
32inline wxCoord wxDCBase::DeviceToLogicalX(wxCoord x) const
33{
34 return wxRound((x - m_deviceOriginX) / m_scaleX) * m_signX + m_logicalOriginX;
35}
36inline wxCoord wxDCBase::DeviceToLogicalY(wxCoord y) const
37{
38 return wxRound((y - m_deviceOriginY) / m_scaleY) * m_signY + m_logicalOriginY;
39}
40inline wxCoord wxDCBase::DeviceToLogicalXRel(wxCoord x) const
41{
42 return wxRound(x / m_scaleX);
43}
44inline wxCoord wxDCBase::DeviceToLogicalYRel(wxCoord y) const
45{
46 return wxRound(y / m_scaleY);
47}
48inline wxCoord wxDCBase::LogicalToDeviceX(wxCoord x) const
49{
50 return wxRound((x - m_logicalOriginX) * m_scaleX) * m_signX + m_deviceOriginX;
51}
52inline wxCoord wxDCBase::LogicalToDeviceY(wxCoord y) const
53{
54 return wxRound((y - m_logicalOriginY) * m_scaleY) * m_signY + m_deviceOriginY;
55}
56inline wxCoord wxDCBase::LogicalToDeviceXRel(wxCoord x) const
57{
58 return wxRound(x * m_scaleX);
59}
60inline wxCoord wxDCBase::LogicalToDeviceYRel(wxCoord y) const
61{
62 return wxRound(y * m_scaleY);
63}
64
c801d85f
KB
65//-----------------------------------------------------------------------------
66// wxDC
67//-----------------------------------------------------------------------------
68
20123d49 69class WXDLLIMPEXP_CORE wxDC : public wxDCBase
c801d85f 70{
463c1fa1 71public:
a23fd0e1 72 wxDC();
d3c7fc99 73 virtual ~wxDC() { }
c801d85f 74
0b04c4e0 75#if wxUSE_PALETTE
a23fd0e1 76 void SetColourMap( const wxPalette& palette ) { SetPalette(palette); };
0b04c4e0 77#endif // wxUSE_PALETTE
8bbe427f 78
a23fd0e1
VZ
79 // Resolution in pixels per logical inch
80 virtual wxSize GetPPI() const;
c801d85f 81
b1263dcf 82 virtual bool StartDoc( const wxString& WXUNUSED(message) ) { return true; }
a23fd0e1
VZ
83 virtual void EndDoc() { }
84 virtual void StartPage() { }
85 virtual void EndPage() { }
8bbe427f 86
a23fd0e1
VZ
87 virtual void SetMapMode( int mode );
88 virtual void SetUserScale( double x, double y );
89 virtual void SetLogicalScale( double x, double y );
72cdf4c9
VZ
90 virtual void SetLogicalOrigin( wxCoord x, wxCoord y );
91 virtual void SetDeviceOrigin( wxCoord x, wxCoord y );
8bbe427f 92
a23fd0e1 93 virtual void SetAxisOrientation( bool xLeftRight, bool yBottomUp );
c801d85f 94
f9562c6b
PC
95 virtual void ComputeScaleAndOrigin();
96
2e992e06
VZ
97 virtual GdkWindow* GetGDKWindow() const { return NULL; }
98
772b3767 99protected:
a23fd0e1
VZ
100 // implementation
101 // --------------
8bbe427f 102
72cdf4c9 103 wxCoord XDEV2LOG(wxCoord x) const
a23fd0e1 104 {
772b3767 105 return DeviceToLogicalX(x);
a23fd0e1 106 }
72cdf4c9 107 wxCoord XDEV2LOGREL(wxCoord x) const
a23fd0e1 108 {
772b3767 109 return DeviceToLogicalXRel(x);
a23fd0e1 110 }
72cdf4c9 111 wxCoord YDEV2LOG(wxCoord y) const
a23fd0e1 112 {
772b3767 113 return DeviceToLogicalY(y);
a23fd0e1 114 }
72cdf4c9 115 wxCoord YDEV2LOGREL(wxCoord y) const
a23fd0e1 116 {
772b3767 117 return DeviceToLogicalYRel(y);
a23fd0e1 118 }
72cdf4c9 119 wxCoord XLOG2DEV(wxCoord x) const
a23fd0e1 120 {
772b3767 121 return LogicalToDeviceX(x);
a23fd0e1 122 }
72cdf4c9 123 wxCoord XLOG2DEVREL(wxCoord x) const
a23fd0e1 124 {
772b3767 125 return LogicalToDeviceXRel(x);
a23fd0e1 126 }
72cdf4c9 127 wxCoord YLOG2DEV(wxCoord y) const
a23fd0e1 128 {
772b3767 129 return LogicalToDeviceY(y);
a23fd0e1 130 }
72cdf4c9 131 wxCoord YLOG2DEVREL(wxCoord y) const
a23fd0e1 132 {
772b3767 133 return LogicalToDeviceYRel(y);
a23fd0e1
VZ
134 }
135
a23fd0e1 136 // base class pure virtuals implemented here
72cdf4c9 137 virtual void DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
a23fd0e1 138 virtual void DoGetSizeMM(int* width, int* height) const;
8bbe427f 139
a23fd0e1
VZ
140public:
141 // GTK-specific member variables
8bbe427f 142
a23fd0e1
VZ
143 // not sure what for, but what is a mm on a screen you don't know the size
144 // of?
145 double m_mm_to_pix_x,
146 m_mm_to_pix_y;
8bbe427f 147
a23fd0e1
VZ
148 bool m_needComputeScaleX,
149 m_needComputeScaleY; // not yet used
8bbe427f 150
c3e44503 151
20e05ffb
RR
152private:
153 DECLARE_ABSTRACT_CLASS(wxDC)
c801d85f
KB
154};
155
c3e44503
VZ
156// this must be defined when wxDC::Blit() honours the DC origian and needed to
157// allow wxUniv code in univ/winuniv.cpp to work with versions of wxGTK
158// 2.3.[23]
159#ifndef wxHAS_WORKING_GTK_DC_BLIT
160 #define wxHAS_WORKING_GTK_DC_BLIT
161#endif
162
c801d85f 163#endif // __GTKDCH__