]>
git.saurik.com Git - wxWidgets.git/blob - src/mac/dcmemory.cpp
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxMemoryDC class
8 // Copyright: (c) AUTHOR
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "dcmemory.h"
16 #include "wx/dcmemory.h"
18 //-----------------------------------------------------------------------------
20 //-----------------------------------------------------------------------------
22 IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC
,wxPaintDC
)
24 wxMemoryDC::wxMemoryDC(void)
29 wxMemoryDC::wxMemoryDC( wxDC
*WXUNUSED(dc
) )
34 wxMemoryDC::~wxMemoryDC(void)
36 if ( m_selected
.Ok() )
38 wxBitmapRefData
* bmap
= (wxBitmapRefData
*) (m_selected
.GetRefData()) ;
39 UnlockPixels( GetGWorldPixMap( (CGrafPtr
) bmap
->m_hBitmap
) ) ;
43 void wxMemoryDC::SelectObject( const wxBitmap
& bitmap
)
45 if ( m_selected
.Ok() )
47 wxBitmapRefData
* bmap
= (wxBitmapRefData
*) (m_selected
.GetRefData()) ;
48 UnlockPixels( GetGWorldPixMap( (CGrafPtr
) bmap
->m_hBitmap
) ) ;
53 wxBitmapRefData
* bmap
= (wxBitmapRefData
*) (m_selected
.GetRefData()) ;
54 if ( bmap
->m_hBitmap
)
56 m_macPort
= (GrafPtr
) bmap
->m_hBitmap
;
57 LockPixels( GetGWorldPixMap( (CGrafPtr
) m_macPort
) ) ;
58 wxMask
* mask
= bitmap
.GetMask() ;
61 m_macMask
= mask
->GetMaskBitmap() ;
65 // SetBackground(wxBrush(*wxWHITE, wxSOLID));
78 void wxMemoryDC::GetSize( int *width
, int *height
) const
82 if (width
) (*width
) = m_selected
.GetWidth();
83 if (height
) (*height
) = m_selected
.GetHeight();
87 if (width
) (*width
) = 0;
88 if (height
) (*height
) = 0;