autodefine "off" $include "windowssdk.inc" $use "gdiplus.lib" 'type MatrixOrder ' INT MatrixOrderPrepend=0 ' INT MatrixOrderAppend=1 'ENDTYPE ' MatrixOrder mo DECLARE IMPORT,GdiplusStartup(POINTER pToken byref,POINTER GdiplusStartupInput,INT GdiplusStartupOutput),INT DECLARE IMPORT,GdipLoadImageFromFile(WSTRING filename,POINTER pImage byref),INT DECLARE IMPORT,GdiplusShutdown(UINT token) DECLARE IMPORT,GdipCreateFromHDC(UINT hDC,POINTER pGraphics byref),INT DECLARE IMPORT,GdipDeleteGraphics(INT Graphics),INT DECLARE IMPORT,GdipDrawImageRectI(POINTER pGraphics,POINTER pImage,INT x,INT y,INT w,INT h),INT DECLARE IMPORT,GdipDisposeImage(INT image) DECLARE IMPORT,GdipGetImageWidth(POINTER pImage,UINT width byref),INT DECLARE IMPORT,GdipGetImageHeight(POINTER pImage,UINT height byref),INT DECLARE IMPORT,GdipImageRotateFlip(POINTER pImage,INT RotateFlipType),INT declare import,GdipTranslateWorldTransform(POINTER pImage,FLOAT dx,FLOAT dy,INT order),INT declare import,GdipRotateWorldTransform(POINTER graphics,FLOAT angle,POINTER order),INT DECLARE IMPORT,GdipDrawImage(POINTER pImage,INT X,INT Y),INT TYPE GdiplusStartupInput INT GdiplusVersion INT DebugEventCallback INT SuppressBackgroundThread INT SuppressExternalCodecs ENDTYPE GdiplusStartupInput gsi WINDOW w INT result UINT iw,ih,hDC POINTER pImage,pToken,pGraphics OPENWINDOW w,0,0,360,480,@MINBOX|@NOAUTODRAW,0,"IWB can display GIFs",&main SETWINDOWCOLOR w,RGB(240,240,240) gsi.GdiplusVersion=1 gsi.DebugEventCallback=NULL gsi.SuppressBackgroundThread=FALSE gsi.SuppressExternalCodecs=FALSE GdiplusStartup(pToken,gsi,NULL) result=GdipLoadImageFromFile(L"train bdp.gif",pImage) GdipImageRotateFlip(pImage,1) 'Can be 0, 1, 2 or 3 GdipGetImageWidth(pImage,iw) GdipGetImageHeight(pImage,ih) GdipDrawImage(pImage,0,100) ' //make a translation to make it visible at the right of the first image GdipTranslateWorldTransform(pImage,240,240,1) ' //rotate GdipRotateWorldTransform(pImage,15,1) ' //draw rotated image GdipDrawImage(pImage,0,0) hDC=GetHDC(w) result=GdipCreateFromHDC(hDC,pGraphics) SETCAPTION w,"Original Size:"+STR$(iw)+" x"+STR$(ih) WAITUNTIL IsWindowClosed(w) ReleaseHDC(w,hDC) GdipDisposeImage(pImage) GdipDeleteGraphics(pGraphics) GdiplusShutdown(pToken) END SUB main(),INT SELECT @MESSAGE CASE @IDCREATE CENTERWINDOW w CASE @IDPAINT GdipDrawImageRectI(pGraphics,pImage,50,50,iw,ih) CASE @IDCLOSEWINDOW CLOSEWINDOW w ENDSELECT RETURN 0 ENDSUB