Little demo for image rotation (strangely enough, this GdiPlus function has never been used in this forum ::)):
GuiParas equ "Image rotation demo", w400, h440
include \masm32\MasmBasic\Res\MbGui.asm
GuiImageCallback Rotate ; user-defined function
SetGlobals halfWidth, halfHeight, REAL4:rotateAngle, movX, movY
Event Paint
imul eax, GuiWidth, 100 ; width*100/128
sar eax, 8
add eax, 20
mov halfWidth, eax
imul eax, GuiHeight, 100 ; height*100/128
sar eax, 8
mov halfHeight, eax
GuiImage 99, 0, 0, halfWidth, halfHeight ; res ID, x, y, w, h
GuiCls ; trigger next paint event
EndOfEvents
Rotate:
fild halfWidth ; an integer
fadd FP4(35.0) ; add a fixed x offset
fstp movX ; Gdi+ needs a float
fild halfHeight
fadd FP4(32.0)
fstp movY
gdi+ GdipTranslateWorldTransform, giGraphics, movX, movY, MatrixOrderPrepend ; move to the middle
gdi+ GdipRotateWorldTransform, giGraphics, rotateAngle, MatrixOrderPrepend ; rotate
fld rotateAngle ; add one degree for next paint event
fadd FP4(1.0)
fstp rotateAngle
ret
GuiEnd