Hi all,

I having a problem with making SetWorldTransform bitmap rotation to work. Below example doesn't seem to work. The bitmap is not displayed at all.

   invoke BeginPaint,hWin,ADDR ps

  invoke GetDC,hWin
  mov    hDC,eax

  invoke CreateCompatibleDC,hDC
  mov    memDC,eax
  invoke LoadImage,hInstance,604,IMAGE_BITMAP,0,0,LR_LOADTRANSPARENT or LR_LOADMAP3DCOLORS
  mov    hBmp,eax
  invoke SelectObject,memDC,hBmp

  mov    xform.eM11, cos(angle) ; i tried to use both degrees and radians with no success.
  mov    xform.eM12, sin(angle)
  mov    xform.eM21, -sin(angle)
  mov    xform.eM22, cos(angle)
  mov    xform.ex, 0
  mov    xform.ey, 0

  invoke SetGraphicsMode, hDC, GM_ADVANCED
  invoke SetWorldTransform, hDC, ADDR xform

  invoke BitBlt,hDC,10,10,14,16,memDC,0,0,SRCCOPY

  invoke DeleteObject,hBmp
  invoke DeleteDC,memDC
  invoke ReleaseDC,hWin,hDC

  invoke EndPaint,hWin,ADDR ps


In some C example eDx and eDy was calculated using those formulas:

eDx = x0 ? cos(q)*x0 + sin(q)*y0  (where x0/xy are the coordinates of the center of rotation)
eDy = y0 ? cos(q)*y0 - sin(q)*x0;

Doesn't those parameters specify the moving of image relative to it's origin, so setting null should make the rotation in it's current position? Though I tried with the above formulas and it didn't work either.
Posted on 2005-08-10 00:31:15 by arafel
You have to call SetGraphicsMode and set it to GM_ADVANCED before you can use SetWorldTransform. The map mode should be set to MM_LOENGLISH with SetMapMode as well.
Posted on 2005-08-10 01:23:23 by donkey
Ok. found a solution? :D. SetViewportOrgEx should be called before the transformation.

donkey, seems like MM_* only affects the drawing display size. I guess i'll leave that alone for now.


arggghh.. just stumbled on other problem - the output is not-antialiased.  :(
Posted on 2005-08-10 01:54:07 by arafel