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:
@@ -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 ) ;
|
||||
|
@@ -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)
|
||||
|
Reference in New Issue
Block a user