Element PictureStream GlobalConst CoInitialize.use equ 1 DEFINE_GUID CLSID_IImgCtx, 0x3050f3d6, 0x98b5, 0x11cf, 0xbb, 0x82, 0x00, 0xaa, 0x00, 0xbd, 0xce, 0x0b DEFINE_GUID IID_IImgCtx, 0x3050f3d7, 0x98b5, 0x11cf, 0xbb, 0x82, 0x00, 0xaa, 0x00, 0xbd, 0xce, 0x0b interface IImgCtx,\ QueryInterface,AddRef,Release,\ Load,SelectChanges,SetCallback,Disconnect,\ GetUpdateRects,GetStateInfo,GetPalette,\ Draw,Tile,StretchBlt GlobalProc proc PictureStream.Load self,szFileName,pCallback locals pOleStr dd ? sInfo dd ? endl push esi mov esi,[self] mov eax,[pPictureStream.pImgCtx] or eax,eax jne .ok1 lea ecx,[pPictureStream.pImgCtx] invoke CoCreateInstance,CLSID_IImgCtx,0,7,IID_IImgCtx,ecx mov eax,[pPictureStream.pImgCtx] or eax,eax je .exit .ok1: stdcall StrToOleStr,[szFileName] mov [pOleStr],eax comcall [pPictureStream.pImgCtx],IImgCtx,Load,eax,0 comcall [pPictureStream.pImgCtx],IImgCtx,SetCallback,[pCallback],esi comcall [pPictureStream.pImgCtx],IImgCtx,SelectChanges,4,0,1 mov eax,[pOleStr] call __free .exit: pop esi ret endp LocalProc proc Self#.Callback pCtx,self locals nState dd ? rcImg RECT hdc dd ? hbmp dd ? endl push ebx esi mov esi,[self] if Self#.offset>0 lea ebx,[esi-Self#.offset] end if mov [rcImg.left],0 mov [rcImg.top],0 lea eax,[nState] lea ecx,[rcImg.right] comcall [pPictureStream.pImgCtx],IImgCtx,GetStateInfo,eax,ecx,0 invoke GetDC,0 mov [hdc],eax invoke CreateCompatibleBitmap,eax,[rcImg.right],[rcImg.bottom] mov [hbmp],eax invoke ReleaseDC,0,[hdc] invoke CreateCompatibleDC,0 mov [hdc],eax invoke SelectObject,[hdc],[hbmp] lea ecx,[rcImg] comcall [pPictureStream.pImgCtx],IImgCtx,Draw,[hdc],ecx comcall [pPictureStream.pImgCtx],IImgCtx,Release mov [pPictureStream.pImgCtx],0 invoke DeleteDC,[hdc] mov eax,[hbmp] Self#.onLoad eax,data_bitmap invoke DeleteObject,[hbmp] .exit: pop esi ebx ret endp Vars Self#.pImgCtx dd ? Create xor eax,eax mov [Self#.pImgCtx],eax Destroy mov eax,[Self#.pImgCtx] or eax,eax je @f comcall eax,IImgCtx,Release @@: PointWork doLoad \local res ReadStr res,data,data.type,Self#.FileName,Self#.prop.FileName lea ecx,[Self#.pImgCtx] stdcall PictureStream.Load,ecx,res,Self#.Callback EndPoint PointWork doSave \local fn,bmp ReadStr fn,data,data.type,Self#.FileName,Self#.prop.FileName push fn ReadBitmap bmp,data,data.type,Self#.Bitmap,0 stdcall SaveBitmap,bmp EndPoint EndElement