]>
git.saurik.com Git - wxWidgets.git/blob - src/mgl/dcmemory.cpp
1 /////////////////////////////////////////////////////////////////////////////
4 // Author: Robert Roebling, Vaclav Slavik
6 // Copyright: (c) 1998 Robert Roebling,
7 // 2001 SciTech Software, Inc. (www.scitechsoft.com)
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
12 #pragma implementation "dcmemory.h"
15 // For compilers that support precompilation, includes "wx.h".
16 #include "wx/wxprec.h"
22 #include "wx/dcmemory.h"
25 //-----------------------------------------------------------------------------
27 //-----------------------------------------------------------------------------
29 IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC
,wxWindowDC
)
31 wxMemoryDC::wxMemoryDC() : wxDC()
36 wxMemoryDC::wxMemoryDC(wxDC
*WXUNUSED(dc
)) : wxDC()
41 wxMemoryDC::~wxMemoryDC()
45 void wxMemoryDC::SelectObject(const wxBitmap
& bitmap
)
50 SetMGLDC(m_selected
.CreateTmpDC(), TRUE
);
54 void wxMemoryDC::SetPen(const wxPen
&pen
)
56 wxCHECK_RET( Ok(), wxT("invalid dc") );
58 if ( GetDepth() == 1 && *wxTRANSPARENT_PEN
!= pen
)
60 if ( *wxWHITE_PEN
== pen
)
61 wxDC::SetPen(*wxBLACK_PEN
);
63 wxDC::SetPen(*wxWHITE_PEN
);
71 void wxMemoryDC::SetBrush(const wxBrush
&brush
)
73 wxCHECK_RET( Ok(), wxT("invalid dc") );
75 if ( GetDepth() == 1 && *wxTRANSPARENT_BRUSH
!= brush
)
77 if ( *wxWHITE_BRUSH
== brush
)
78 wxDC::SetBrush(*wxBLACK_BRUSH
);
80 wxDC::SetBrush(*wxWHITE_BRUSH
);
84 wxDC::SetBrush(brush
);
88 void wxMemoryDC::SetTextForeground(const wxColour
&col
)
90 wxCHECK_RET( Ok(), wxT("invalid dc") );
92 if ( GetDepth() == 1 )
94 if ( col
== *wxWHITE
)
95 wxDC::SetTextForeground(*wxBLACK
);
97 wxDC::SetTextForeground(*wxWHITE
);
101 wxDC::SetTextForeground(col
);
105 void wxMemoryDC::SetTextBackground(const wxColour
&col
)
107 wxCHECK_RET( Ok(), wxT("invalid dc") );
109 if ( GetDepth() == 1 )
111 if ( col
== *wxWHITE
)
112 wxDC::SetTextBackground(*wxBLACK
);
114 wxDC::SetTextBackground(*wxWHITE
);
118 wxDC::SetTextBackground(col
);