I'm testing out an algorithm I found on a few C++ sites for doing a destination-source mapped bitmap rotate, and it all works, except I can't translate the rotation from 0,0 to the centerpoint. The first time I messed with it, I got it to work, but I can't figure out how I did it. I figure Zaei or someone else mathy can help me (I still haven't taken any advanced math or geometry).

Don't worry about the calls and everything, they all work fine.
RotateRect calculates the necessary Width and Height to contain the rotated image.
Resize resizes the buffer to hold it.
GetPixelAARolloff is basically GetPixel, but BiLinear.

VB Code:
  1. sAngle = Angle * (c_dblPi / 180)
  2.     duCol = Sin(-sAngle) * (1)
  3.     dvCol = Cos(-sAngle) * (1)
  4.     m_dblX2 = SourceImage.Width
  5.     m_dblY2 = SourceImage.Height
  6.     SoftFX.RotateRect m_dblX2, m_dblY2, m_dblXO, m_dblYO, CDbl(sAngle)
  7.     DestImage.Resize m_dblX2, m_dblY2
  8.     X = m_dblX2 / 2
  9.     Y = m_dblY2 / 2
  10.     DestImage.Clear F2RGB(64, 96, 128, 0)
  11.     duRow = dvCol
  12.     dvRow = -duCol
  13.     startu = (SourceImage.Width / 2)
  14.     startv = (SourceImage.Height / 2)
  15.     rowu = startu - ((X * duCol) + (Y * duRow))
  16.     rowv = startv - ((X * dvCol) + (Y * dvRow))
  17.     For dY = 0 To DestImage.Height - 1
  18.         sX = rowu
  19.         sY = rowv
  20.         For dX = 0 To DestImage.Width - 1
  21.             DestImage.SetPixel dX, dY, SourceImage.GetPixelAARolloff(sX, sY)
  22.             sX = sX + duRow
  23.             sY = sY + dvRow
  24.         Next dX
  25.         rowu = rowu + duCol
  26.         rowv = rowv + dvCol
  27.     Next dY