For more interesting rotations, here's a demo program to show the method. You can use the techniques shown here to build a really high-quality needle guage, clock, dial, etc. The "wow, cool!" possibilities are unlimited and PureBasic makes it all so easy.
You need this image to run the test: 
http://www.lloydsplace.com/wheeldisc.png
** Right-click the link and select "Save Target As" **
Code: Select all
;========================================================
;  Program:     GDIPlus Rotation Demo
;  Author:      netmaestro
;  Date:        November 12, 2006
;  Update:      February 8, 2020
;               Updated to use prototypes as
;               CallFunction no longer supports floats
;========================================================
#background = 0 ; image# for background
CompilerIf Defined(GdiplusStartupInput, #PB_Structure) = 0
  Structure GdiplusStartupInput
    GdiPlusVersion.l
    *DebugEventCallback.Debug_Event
    SuppressBackgroundThread.l
    SuppressExternalCodecs.l
  EndStructure
CompilerEndIf 
Prototype GdiplusStartup( *token, *input, mode )
Prototype GdipCreateBitmapFromFile(filename.p-bstr, *image)
Prototype GdipCreateFromHDC( hdc, *gfx)
Prototype GdipRotateWorldTransform( *gfx, angle.f, mode)
Prototype GdipResetWorldTransform( *gfx)
Prototype GdipTranslateWorldTransform( *gfx, wmidf.f, hmidf.f, mode)
Prototype GdipDrawImageRectI( *gfx, *image, x, y, Width, Height )
Prototype GdipDeleteGraphics( *gfx )
Prototype GdipDisposeImage( *image )
Prototype GdiplusShutdown( *token )
OpenLibrary(0, "gdiplus.dll")
 
Global GdiplusStartup.GdiplusStartup                           = GetFunction( 0, "GdiplusStartup" )         
Global GdipCreateBitmapFromFile.GdipCreateBitmapFromFile       = GetFunction( 0, "GdipCreateBitmapFromFile")
Global GdipCreateFromHDC.GdipCreateFromHDC                     = GetFunction( 0, "GdipCreateFromHDC" )     
Global GdipDrawImageRectI.GdipDrawImageRectI                   = GetFunction( 0, "GdipDrawImageRectI" )     
Global GdipRotateWorldTransform.GdipRotateWorldTransform       = GetFunction( 0, "GdipRotateWorldTransform" )     
Global GdipTranslateWorldTransform.GdipTranslateWorldTransform = GetFunction( 0, "GdipTranslateWorldTransform" )     
Global GdipResetWorldTransform.GdipResetWorldTransform         = GetFunction( 0, "GdipResetWorldTransform" )
Global GdipDeleteGraphics.GdipDeleteGraphics                   = GetFunction( 0, "GdipDeleteGraphics" )     
Global GdipDisposeImage.GdipDisposeImage                       = GetFunction( 0, "GdipDisposeImage" )       
Global GdiplusShutdown.GdiplusShutdown                         = GetFunction( 0, "GdiplusShutdown" ) 
Procedure InitGDIPlus()
  input.GdiplusStartupInput
  input\GdiPlusVersion = 1
  GdiplusStartup( @*token, @input, #Null)
  ProcedureReturn *token
EndProcedure
Procedure ShutDownGDIPlus(*token)
  GdiplusShutdown(*token)
  CloseLibrary(0)
EndProcedure
Procedure RotateImage(*image, bkgimage, angle.f)
  width=ImageWidth(bkgimage)
  height=ImageHeight(bkgimage)
  wmidf.f = width/2
  hmidf.f = height/2
  wmid.l = height/2
  hmid.l = height/2 
  hdc=StartDrawing(ImageOutput(bkgimage))
    Box(0,0,width,height,GetSysColor_(#COLOR_BTNFACE))
    GdipCreateFromHDC( hdc, @*surface)
    GdipRotateWorldTransform( *surface, angle, 1)
    GdipTranslateWorldTransform( *surface, wmidf, hmidf, 1)
    GdipDrawImageRectI( *surface, *image, wmid, hmid, -width, -height)
    GdipResetWorldTransform( *surface)                                     
  StopDrawing()
  GdipDeleteGraphics( *surface) 
EndProcedure
*token = InitGDIPlus()
GdipCreateBitmapFromFile("wheeldisc.png", @*wheeldisc)
CreateImage(0,256,256,24)
OpenWindow(0,0,0,300,320,"Rotation Demo",#PB_Window_ScreenCentered|#PB_Window_SystemMenu)
ImageGadget(0,15,15,0,0,0)
TrackBarGadget(1,20,285,260,20,0,300)
SetGadgetState(1,150)
Repeat
  EventID = WaitWindowEvent(1)
  angle.f+inc.f:If angle >=360:angle=0:EndIf
  RotateImage(*wheeldisc, #background, angle)
  SetGadgetState(0,ImageID(#background))
  inc.f = (GetGadgetState(1)-150)/100
  If inc>=-0.02 And inc<=0.02:inc=0:EndIf
Until EventID = #PB_Event_CloseWindow
ShutDownGDIPlus(*token)