]>
git.saurik.com Git - wxWidgets.git/blob - src/os2/dc.cpp
1 /////////////////////////////////////////////////////////////////////////////
8 // Copyright: (c) AUTHOR
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "dc.h"
18 #if !USE_SHARED_LIBRARY
19 IMPLEMENT_ABSTRACT_CLASS(wxDC
, wxObject
)
22 //-----------------------------------------------------------------------------
24 //-----------------------------------------------------------------------------
26 #define mm2inches 0.0393700787402
27 #define inches2mm 25.4
28 #define mm2twips 56.6929133859
29 #define twips2mm 0.0176388888889
30 #define mm2pt 2.83464566929
31 #define pt2mm 0.352777777778
33 //-----------------------------------------------------------------------------
35 //-----------------------------------------------------------------------------
37 long wxDCBase::DeviceToLogicalX(long x
) const
39 long new_x
= x
- m_deviceOriginX
;
41 return (long)((double)(new_x
) / m_scaleX
+ 0.5) * m_signX
+ m_logicalOriginX
;
43 return (long)((double)(new_x
) / m_scaleX
- 0.5) * m_signX
+ m_logicalOriginX
;
46 long wxDCBase::DeviceToLogicalY(long y
) const
48 long new_y
= y
- m_deviceOriginY
;
50 return (long)((double)(new_y
) / m_scaleY
+ 0.5) * m_signY
+ m_logicalOriginY
;
52 return (long)((double)(new_y
) / m_scaleY
- 0.5) * m_signY
+ m_logicalOriginY
;
55 long wxDCBase::DeviceToLogicalXRel(long x
) const
58 return (long)((double)(x
) / m_scaleX
+ 0.5);
60 return (long)((double)(x
) / m_scaleX
- 0.5);
63 long wxDCBase::DeviceToLogicalYRel(long y
) const
66 return (long)((double)(y
) / m_scaleY
+ 0.5);
68 return (long)((double)(y
) / m_scaleY
- 0.5);
71 long wxDCBase::LogicalToDeviceX(long x
) const
73 long new_x
= x
- m_logicalOriginX
;
75 return (long)((double)(new_x
) * m_scaleX
+ 0.5) * m_signX
+ m_deviceOriginX
;
77 return (long)((double)(new_x
) * m_scaleX
- 0.5) * m_signX
+ m_deviceOriginX
;
80 long wxDCBase::LogicalToDeviceY(long y
) const
82 long new_y
= y
- m_logicalOriginY
;
84 return (long)((double)(new_y
) * m_scaleY
+ 0.5) * m_signY
+ m_deviceOriginY
;
86 return (long)((double)(new_y
) * m_scaleY
- 0.5) * m_signY
+ m_deviceOriginY
;
89 long wxDCBase::LogicalToDeviceXRel(long x
) const
92 return (long)((double)(x
) * m_scaleX
+ 0.5);
94 return (long)((double)(x
) * m_scaleX
- 0.5);
97 long wxDCBase::LogicalToDeviceYRel(long y
) const
100 return (long)((double)(y
) * m_scaleY
+ 0.5);
102 return (long)((double)(y
) * m_scaleY
- 0.5);
105 //-----------------------------------------------------------------------------
107 //-----------------------------------------------------------------------------
128 void wxDC::DestroyClippingRegion(void)
133 void wxDC::DoGetSize( int* width
, int* height
) const
138 void wxDC::DoGetSizeMM( int* width
, int* height
) const
143 void wxDC::SetMapMode( int mode
)
148 void wxDC::SetUserScale( double x
, double y
)
153 SetMapMode(m_mappingMode
);
156 void wxDC::SetLogicalScale( double x
, double y
)
161 void wxDC::SetLogicalOrigin( long x
, long y
)
166 void wxDC::SetDeviceOrigin( long x
, long y
)
171 void wxDC::SetInternalDeviceOrigin( long x
, long y
)
176 void wxDC::GetInternalDeviceOrigin( long *x
, long *y
)
181 void wxDC::SetAxisOrientation( bool xLeftRight
, bool yBottomUp
)
187 int wxDC::GetDepth() const
193 wxSize
wxDC::GetPPI() const
198 return (wxSize(x
,y
));
200 void wxDC::GetTextExtent( const wxString
& string
204 ,long* externalLeading
211 long wxDC::GetCharWidth() const
217 long wxDC::GetCharHeight() const
228 void wxDC::SetFont(const wxFont
& font
)
233 void wxDC::SetPen(const wxPen
& pen
)
237 void wxDC::SetBrush(const wxBrush
& brush
)
242 void wxDC::SetBackground(const wxBrush
& brush
)
247 void wxDC::SetLogicalFunction(int function
)
252 void wxDC::SetBackgroundMode(int mode
)
257 void wxDC::SetPalette(const wxPalette
& palette
)
262 void wxDC::DoFloodFill( long x
271 bool wxDC::DoGetPixel(long x
, long y
, wxColour
*col
) const
277 void wxDC::DoDrawPoint(long x
, long y
)
282 void wxDC::DoDrawLine(long x1
, long y1
, long x2
, long y2
)
287 void wxDC::DoDrawArc( long x1
, long y1
295 void wxDC::DoDrawEllipticArc( long x
306 void wxDC::DoDrawRectangle(long x
, long y
, long width
, long height
)
311 void wxDC::DoDrawRoundedRectangle( long x
, long y
312 ,long width
, long height
319 void wxDC::DoDrawEllipse(long x
, long y
, long width
, long height
)
324 void wxDC::DoCrossHair(long x
, long y
)
329 void wxDC::DoDrawIcon(const wxIcon
& icon
, long x
, long y
)
334 void wxDC::DoDrawBitmap( const wxBitmap
&bmp
342 void wxDC::DoDrawText(const wxString
& text
, long x
, long y
)
347 bool wxDC::DoBlit( long xdest
362 void wxDC::DoDrawLines( int n
, wxPoint points
[]
363 ,long xoffset
, long yoffset
369 void wxDC::DoDrawPolygon(int n
, wxPoint points
[]
370 ,long xoffset
, long yoffset
377 void wxDC::DoSetClippingRegionAsRegion(const wxRegion
& region
)
382 void wxDC::DoSetClippingRegion( long x
, long y
383 ,long width
, long height
390 void wxDC::DoDrawSpline(wxList
*points
)