]> git.saurik.com Git - wxWidgets.git/blob - src/mgl/dcmemory.cpp
intel pict fixes
[wxWidgets.git] / src / mgl / dcmemory.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: dcmemory.cpp
3 // Purpose:
4 // Author: Robert Roebling, Vaclav Slavik
5 // RCS-ID: $Id$
6 // Copyright: (c) 1998 Robert Roebling,
7 // 2001 SciTech Software, Inc. (www.scitechsoft.com)
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 // For compilers that support precompilation, includes "wx.h".
12 #include "wx/wxprec.h"
13
14 #ifdef __BORLANDC__
15 #pragma hdrstop
16 #endif
17
18 #include "wx/dcmemory.h"
19
20
21 //-----------------------------------------------------------------------------
22 // wxMemoryDC
23 //-----------------------------------------------------------------------------
24
25 IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC,wxWindowDC)
26
27 wxMemoryDC::wxMemoryDC() : wxDC()
28 {
29 m_isMemDC = TRUE;
30 }
31
32 wxMemoryDC::wxMemoryDC(wxDC *WXUNUSED(dc)) : wxDC()
33 {
34 m_isMemDC = TRUE;
35 }
36
37 wxMemoryDC::~wxMemoryDC()
38 {
39 }
40
41 void wxMemoryDC::SelectObject(const wxBitmap& bitmap)
42 {
43 if ( bitmap.Ok() )
44 {
45 m_selected = bitmap;
46 SetMGLDC(m_selected.CreateTmpDC(), TRUE);
47 }
48 }
49
50 void wxMemoryDC::SetPen(const wxPen &pen)
51 {
52 wxCHECK_RET( Ok(), wxT("invalid dc") );
53
54 if ( GetDepth() == 1 && *wxTRANSPARENT_PEN != pen )
55 {
56 if ( *wxWHITE_PEN == pen )
57 wxDC::SetPen(*wxBLACK_PEN);
58 else
59 wxDC::SetPen(*wxWHITE_PEN);
60 }
61 else
62 {
63 wxDC::SetPen(pen);
64 }
65 }
66
67 void wxMemoryDC::SetBrush(const wxBrush &brush)
68 {
69 wxCHECK_RET( Ok(), wxT("invalid dc") );
70
71 if ( GetDepth() == 1 && *wxTRANSPARENT_BRUSH != brush )
72 {
73 if ( *wxWHITE_BRUSH == brush )
74 wxDC::SetBrush(*wxBLACK_BRUSH);
75 else
76 wxDC::SetBrush(*wxWHITE_BRUSH);
77 }
78 else
79 {
80 wxDC::SetBrush(brush);
81 }
82 }
83
84 void wxMemoryDC::SetTextForeground(const wxColour &col)
85 {
86 wxCHECK_RET( Ok(), wxT("invalid dc") );
87
88 if ( GetDepth() == 1 )
89 {
90 if ( col == *wxWHITE )
91 wxDC::SetTextForeground(*wxBLACK);
92 else
93 wxDC::SetTextForeground(*wxWHITE);
94 }
95 else
96 {
97 wxDC::SetTextForeground(col);
98 }
99 }
100
101 void wxMemoryDC::SetTextBackground(const wxColour &col)
102 {
103 wxCHECK_RET( Ok(), wxT("invalid dc") );
104
105 if ( GetDepth() == 1 )
106 {
107 if ( col == *wxWHITE )
108 wxDC::SetTextBackground(*wxBLACK);
109 else
110 wxDC::SetTextBackground(*wxWHITE);
111 }
112 else
113 {
114 wxDC::SetTextBackground(col);
115 }
116 }