-PicHandle wxBitmapRefData::GetPictHandle()
-{
- if ( m_pictHandle == NULL )
- {
-#ifndef __LP64__
- GraphicsExportComponent exporter = 0;
- OSStatus err = OpenADefaultComponent(GraphicsExporterComponentType, kQTFileTypePicture, &exporter);
- if (noErr == err)
- {
- m_pictHandle = (PicHandle) NewHandle(0);
- if ( m_pictHandle )
- {
- // QT does not correctly export the mask
- // TODO if we get around to it create a synthetic PICT with the CopyBits and Mask commands
- CGImageRef imageRef = CreateCGImage();
- err = GraphicsExportSetInputCGImage( exporter, imageRef );
- err = GraphicsExportSetOutputHandle(exporter, (Handle)m_pictHandle);
- err = GraphicsExportDoExport(exporter, NULL);
- CGImageRelease( imageRef );
-
- size_t handleSize = GetHandleSize( (Handle) m_pictHandle );
- // the 512 bytes header is only needed for pict files, but not in memory
- if ( handleSize >= 512 )
- {
- memmove( *m_pictHandle , (char*)(*m_pictHandle)+512, handleSize - 512 );
- SetHandleSize( (Handle) m_pictHandle, handleSize - 512 );
- }
- }
- CloseComponent( exporter );
- }
-#endif
- }
-
- return m_pictHandle ;
-}