PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Gapi 3.01 Rotation Bug

I'm currently using the old Gapi3.01 and have come across a bug .. I believe. Can anybody repro this and if so does anybody know if it's fixed in 3.5? Thanks and here is the code:

Code:

pBackBuffer->Blt( &destLocation;, surface, NULL, m_BlitFlags | ((surface->HasColorKey() )?GDBLT_KEYSRC:0), &m;_BlitFX );


The only important thing to look at here is the desLocation which is a RECT( 0, 0, 25, 25 ) and the surface which is sized at ( 0, 0, 15, 20 ). I'm using the blt to stretch the image out to fill 25x25 pixels. This works great until I rotate the image:

Code:

m_BlitFX.nRotationAngle = (LONG)(m_fCurrentRotation * 100);
m_BlitFlags = GDBLT_ROTATIONANGLE;


This now draws the image at it's correct size rotated( 15x20 ). Did I just miss something in the documentation or is this a bug?

thanks again..Kelesis
Um. What exactly is it that is not working correctly? You did not describe what happens, only that something happens.
Hi,
Correct me if I'm wrong,
you have a 15*20 surface and you want to stretch it to 25*25 AND rotate it.

I think your problem is that when you stretch it you blit it to the back buffer, but that doesn't affect your source surface. When you then try to rotate it it is normal that it isn't stretched anymore.

I would stretch it to a temporary surface using
surfTempo.Blt(..........) (like you did with the back buffer)
and the rotate this temporary surface to the backbuffer.

Hope this helps.
Vincent.
Ok, I finally understood what kelesis talked about. This is not a bug, it's how the rotation works. If you want to scale while rotating you can use the ROTATIONSCALE option to Blt.
kelesis · 03 Dec 2004, 17:37 UTC — Ok this is very strange then...
Let me see if I understand this correctly. If I use the GDBLTFX structure, the destRect that the blt requires only really uses the left and top variables( x and y ) to blit the image onto the surface? For example I have a 256x256 image that I want it stretched onto a 640x480 image. I blit it to the 640 image with a rotation of 90 degree's it'll only show up at 256x256? But if I don't rotate it it'll show up at 640x480. That is correct functionality and this doesn't seem like a bug?

thanks,
Kelesis
No bug. Again, please read through the documentation. There are two paths in Blt - one with rotation (and optional scale) and one with stretch. The "destination rectangle" has two different functions depending on what path you use.

Stretch - destrect specifies where to "stretch" the source.
Rotate - destrect specifies the "clipper" rectangle on the destination surface. The center of rotation is by default in the center of this rectangle.
kelesis · 04 Dec 2004, 00:04 UTC — Documentation
Thanks.