NO

Author Topic: Recording metafiles ( Gdi+ )  (Read 3644 times)

dancho

  • Guest
Recording metafiles ( Gdi+ )
« on: September 28, 2008, 01:46:51 PM »
so Im coding some gdi+ examples from PSDK(R2) and Im having problem with recording metafile,
from SDK:
To record a metafile, you must construct a Graphics object based on a Metafile object. The recording of the metafile ends when that Graphics object is deleted or goes out of scope.
and this is what I have:

Code: [Select]
metafile=GpMetafile_ToFile(TEXT("SampleMetafile.emf"),hdc,eMetafileTypeEmfPlusDual,NULL);
{ // start rec

HENHMETAFILE hmf;
hmf=GpMetafile_GethEmFHMETAFILE(&metafile);

GP_GRAPHICS graphics;
graphics=GpGraphics_FromDEV(hdc,hmf);

COLOR green;
GpColor_4Set(&green,255,0,255,0);

GP_PEN greenpen;
greenpen=GpPen_Color(&green,2.0);

GpGraphics_DrawRectangleI(&graphics,&greenpen,10,10,100,50);

} // stop rec

but as far I can tell there isnt function that creates GRAPHICS object from METAFILE object,we have this:

Code: [Select]
GP_GRAPHICS GpGraphics_FromHDC(HDC hdc);
GP_GRAPHICS GpGraphics_FromDEV(HDC hdc, HANDLE hdevice);
GP_GRAPHICS GpGraphics_FromHWND(HWND hwnd, BOOL icm);
GP_GRAPHICS GpGraphics_FromIMG(GP_IMAGE * image);

and ( as you can see ) I did try with GpGraphics_FromDEV but nothing is recorded.

so what Im missing here ???

thx