]>
git.saurik.com Git - wxWidgets.git/blob - src/mgl/dcmemory.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/mgl/dcmemory.cpp
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 /////////////////////////////////////////////////////////////////////////////
11 // For compilers that support precompilation, includes "wx.h".
12 #include "wx/wxprec.h"
18 #include "wx/dcmemory.h"
21 //-----------------------------------------------------------------------------
23 //-----------------------------------------------------------------------------
25 IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC
,wxWindowDC
)
27 void wxMemoryDC::Init()
32 wxMemoryDC::wxMemoryDC(wxDC
*WXUNUSED(dc
)) : wxDC()
37 wxMemoryDC::~wxMemoryDC()
41 void wxMemoryDC::DoSelect(const wxBitmap
& bitmap
)
46 SetMGLDC(m_selected
.CreateTmpDC(), TRUE
);
50 void wxMemoryDC::SetPen(const wxPen
&pen
)
52 wxCHECK_RET( Ok(), wxT("invalid dc") );
54 if ( GetDepth() == 1 && *wxTRANSPARENT_PEN
!= pen
)
56 if ( *wxWHITE_PEN
== pen
)
57 wxDC::SetPen(*wxBLACK_PEN
);
59 wxDC::SetPen(*wxWHITE_PEN
);
67 void wxMemoryDC::SetBrush(const wxBrush
&brush
)
69 wxCHECK_RET( Ok(), wxT("invalid dc") );
71 if ( GetDepth() == 1 && *wxTRANSPARENT_BRUSH
!= brush
)
73 if ( *wxWHITE_BRUSH
== brush
)
74 wxDC::SetBrush(*wxBLACK_BRUSH
);
76 wxDC::SetBrush(*wxWHITE_BRUSH
);
80 wxDC::SetBrush(brush
);
84 void wxMemoryDC::SetTextForeground(const wxColour
&col
)
86 wxCHECK_RET( Ok(), wxT("invalid dc") );
88 if ( GetDepth() == 1 )
90 if ( col
== *wxWHITE
)
91 wxDC::SetTextForeground(*wxBLACK
);
93 wxDC::SetTextForeground(*wxWHITE
);
97 wxDC::SetTextForeground(col
);
101 void wxMemoryDC::SetTextBackground(const wxColour
&col
)
103 wxCHECK_RET( Ok(), wxT("invalid dc") );
105 if ( GetDepth() == 1 )
107 if ( col
== *wxWHITE
)
108 wxDC::SetTextBackground(*wxBLACK
);
110 wxDC::SetTextBackground(*wxWHITE
);
114 wxDC::SetTextBackground(col
);