]>
git.saurik.com Git - wxWidgets.git/blob - src/mgl/dcmemory.cpp
1 /////////////////////////////////////////////////////////////////////////////
4 // Author: Robert Roebling, Vaclav Slavik
6 // Copyright: (c) 1998 Robert Roebling, 2001 Vaclav Slavik
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
11 #pragma implementation "dcmemory.h"
14 // For compilers that support precompilation, includes "wx.h".
15 #include "wx/wxprec.h"
21 #include "wx/dcmemory.h"
24 //-----------------------------------------------------------------------------
26 //-----------------------------------------------------------------------------
28 IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC
,wxWindowDC
)
30 wxMemoryDC::wxMemoryDC() : wxDC()
35 wxMemoryDC::wxMemoryDC(wxDC
*WXUNUSED(dc
)) : wxDC()
40 wxMemoryDC::~wxMemoryDC()
44 void wxMemoryDC::SelectObject(const wxBitmap
& bitmap
)
50 SetMGLDC(m_selected
.CreateTmpDC(), TRUE
);
53 void wxMemoryDC::SetPen(const wxPen
&pen
)
55 wxCHECK_RET( Ok(), wxT("invalid dc") );
57 if ( GetDepth() == 1 && *wxTRANSPARENT_PEN
!= pen
)
59 if ( *wxWHITE_PEN
== pen
)
60 wxDC::SetPen(*wxBLACK_PEN
);
62 wxDC::SetPen(*wxWHITE_PEN
);
70 void wxMemoryDC::SetBrush(const wxBrush
&brush
)
72 wxCHECK_RET( Ok(), wxT("invalid dc") );
74 if ( GetDepth() == 1 && *wxTRANSPARENT_BRUSH
!= brush
)
76 if ( *wxWHITE_BRUSH
== brush
)
77 wxDC::SetBrush(*wxBLACK_BRUSH
);
79 wxDC::SetBrush(*wxWHITE_BRUSH
);
83 wxDC::SetBrush(brush
);
87 void wxMemoryDC::SetTextForeground(const wxColour
&col
)
89 wxCHECK_RET( Ok(), wxT("invalid dc") );
91 if ( GetDepth() == 1 )
93 if ( col
== *wxWHITE
)
94 wxDC::SetTextForeground(*wxBLACK
);
96 wxDC::SetTextForeground(*wxWHITE
);
100 wxDC::SetTextForeground(col
);
104 void wxMemoryDC::SetTextBackground(const wxColour
&col
)
106 wxCHECK_RET( Ok(), wxT("invalid dc") );
108 if ( GetDepth() == 1 )
110 if ( col
== *wxWHITE
)
111 wxDC::SetTextBackground(*wxBLACK
);
113 wxDC::SetTextBackground(*wxWHITE
);
117 wxDC::SetTextBackground(col
);