- m_pngSize = nSize;
- m_pngData = malloc(m_pngSize);
-
- memcpy(m_pngData, pBuf, m_pngSize);
-
- wxMemoryInputStream vMstream((char*)m_pngData, m_pngSize);
- wxImage vImage;
- wxPNGHandler vHandler;
-
- if (!vHandler.LoadFile(&vImage, vMstream))
- {
- return FALSE;
- }
-
- m_bitmap = vImage.ConvertToBitmap();
+ PicHandle picHandle = (PicHandle) NewHandle( nSize ) ;
+ memcpy( *picHandle , pBuf , nSize ) ;
+ m_pictHandle = picHandle ;
+ // ownership is transferred to the bitmap
+ m_pictCreated = false ;
+ Rect frame = (**picHandle).picFrame ;
+
+ wxMetafile mf ;
+ mf.SetHMETAFILE( (WXHMETAFILE) m_pictHandle ) ;
+ wxMemoryDC mdc ;
+ m_bitmap.Create( frame.right - frame.left ,frame.bottom - frame.top ) ;
+ mdc.SelectObject(m_bitmap ) ;
+ mf.Play( &mdc ) ;
+ mdc.SelectObject( wxNullBitmap ) ;
+