adding PICT support in Quartz - whose native metafile format is PDF

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@49033 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2007-10-04 07:30:43 +00:00
parent 2c59ab92e0
commit 00ae2ece4a
2 changed files with 22 additions and 1 deletions

View File

@@ -1857,7 +1857,7 @@ bool wxPICTResourceHandler::LoadFile(wxBitmap *bitmap, const wxString& name, lon
{
wxMetafile mf ;
mf.SetHMETAFILE( (WXHMETAFILE) thePict ) ;
mf.SetPICT( thePict ) ;
bitmap->Create( mf.GetWidth() , mf.GetHeight() ) ;
wxMemoryDC dc ;
dc.SelectObject( *bitmap ) ;

View File

@@ -272,6 +272,27 @@ void wxMetafile::SetHMETAFILE(WXHMETAFILE mf)
#endif
}
void wxMetafile::SetPICT(void* pictHandle)
{
UnRef();
#if wxMAC_USE_CORE_GRAPHICS
Handle picHandle = (Handle) pictHandle;
HLock(picHandle);
CFDataRef data = CFDataCreateWithBytesNoCopy( kCFAllocatorDefault, (const UInt8*) *picHandle, GetHandleSize(picHandle), kCFAllocatorNull);
wxCFRef<CGDataProviderRef> provider(UMACGDataProviderCreateWithCFData(data));
QDPictRef pictRef = QDPictCreateWithProvider(provider);
CGRect rect = QDPictGetBounds(pictRef);
m_refData = new wxMetafileRefData( rect.size.width, rect.size.height );
QDPictDrawToCGContext( ((wxMetafileRefData*) m_refData)->GetContext(), rect, pictRef );
CFRelease( data );
QDPictRelease( pictRef );
((wxMetafileRefData*) m_refData)->Close();
#else
m_refData = new wxMetafileRefData((PicHandle)mf);
#endif
}
bool wxMetaFile::Play(wxDC *dc)
{
if (!m_refData)