void VPictureData_EMF::FromMacHandle(void* inMacHandle) { _ReleaseDataProvider(); _DisposeMetaFile(); if(inMacHandle) { VSize datasize=GetMacAllocator()->GetSize(inMacHandle); if(datasize) { fPicHandle=GetMacAllocator()->Allocate(GetMacAllocator()->GetSize(inMacHandle)); if(fPicHandle) { GetMacAllocator()->Lock(fPicHandle); GetMacAllocator()->Lock(inMacHandle); CopyBlock(*(char**)inMacHandle,*(char**)fPicHandle,datasize); GetMacAllocator()->Unlock(fPicHandle); GetMacAllocator()->Unlock(inMacHandle); } } else fPicHandle=NULL; } else { fPicHandle=NULL; } }
VPictureData_EMF::~VPictureData_EMF() { if(fPicHandle) { GetMacAllocator()->Free(fPicHandle); } _DisposeMetaFile(); }
VPictureData_MacPicture::~VPictureData_MacPicture() { if (fPicHandle && GetMacAllocator()) { if (GetMacAllocator()->CheckBlock(fPicHandle)) GetMacAllocator()->Free(fPicHandle); } _DisposeMetaFile(); }
void VPictureData_MacPicture::_DoReset()const { _DisposeMetaFile(); if (fPicHandle && GetMacAllocator()) { GetMacAllocator()->Free(fPicHandle); fPicHandle = 0; } }
void VPictureData_MacPicture::DoDataSourceChanged() { if (fPicHandle && GetMacAllocator()) { GetMacAllocator()->Free(fPicHandle); fPicHandle = 0; } _DisposeMetaFile(); }
void VPictureData_GDIPlus_Vector::_FromEnhMetaFile(HENHMETAFILE inMetaFile) { SetDataProvider(0,false); _DisposeMetaFile(); _SetDecoderByExtension("emf"); fMetafile=new Gdiplus::Metafile(inMetaFile,true); _InitSize(); }
void VPictureData_EMF::FromEnhMetaFile(HENHMETAFILE inMetaFile) { _ReleaseDataProvider(); _DisposeMetaFile(); fMetaFile=inMetaFile; ENHMETAHEADER header; if(GetEnhMetaFileHeader(fMetaFile,sizeof(ENHMETAHEADER),&header)) { fBounds.SetCoords(0,0,header.rclBounds.right-header.rclBounds.left,header.rclBounds.bottom-header.rclBounds.top); } }
void VPictureData_GDIPlus_Vector::_DoLoad()const { _DisposeMetaFile(); if(fDataProvider) { const VPictureCodec* decoder=fDataProvider->RetainDecoder(); if(decoder) { fMetafile=decoder->_CreateGDIPlus_Metafile(*fDataProvider); _InitSize(); } } }
void VPictureData_EMF::_DoLoad()const { _DisposeMetaFile(); if(fDataProvider) { fMetaFile=::SetEnhMetaFileBits((UINT)fDataProvider->GetDataSize(),(uBYTE*)fDataProvider->BeginDirectAccess()); fDataProvider->EndDirectAccess(); if(fMetaFile) { ENHMETAHEADER header; if(GetEnhMetaFileHeader(fMetaFile,sizeof(ENHMETAHEADER),&header)) { fBounds.SetCoords(0,0,header.rclBounds.right-header.rclBounds.left,header.rclBounds.bottom-header.rclBounds.top); } } } }
void VPictureData_EMF::FromMetaFilePict(METAFILEPICT* inMetaPict) { HENHMETAFILE henh; _ReleaseDataProvider(); _DisposeMetaFile(); void* lpWinMFBits; UINT uiSizeBuf; uiSizeBuf = GetMetaFileBitsEx(inMetaPict->hMF, 0, NULL); lpWinMFBits = GlobalAllocPtr(GHND, uiSizeBuf); GetMetaFileBitsEx(inMetaPict->hMF, uiSizeBuf, (LPVOID)lpWinMFBits); henh = SetWinMetaFileBits(uiSizeBuf, (LPBYTE)lpWinMFBits, NULL, inMetaPict); GlobalFreePtr(lpWinMFBits); FromEnhMetaFile(henh); }
void VPictureData_EMF::_DoReset()const { _DisposeMetaFile(); }
void VPictureData_GDIPlus_Vector::_DoReset()const { _DisposeMetaFile(); }