Your problem is probably that you don't pass in the rotated bitmap to rotate again.
gmRectVertical = CreateTexture(IDB_BITMAP1);
gmRectHorizontal = gs->Rotate90(gmRectVertical);
gmRectCornerTL = CreateTexture(IDB_BITMAP2);
gmRectCornerTR = gs->Rotate90(gmRectCornerTL);
gmRectCornerBR = gs->Rotate90(gmRectCornerTR);
gmRectCornerBL = gs->Rotate90(gmRectCornerBR);
This is a code where i create textures. The gmRectVertical is loaded from resources and is displayed just fine. gmRectHorizontal is created with the function Rotate90 i implemented through the following function to be exact
Texture* GameScreen::Rotate90(Texture*t) {
return t->Rotate90(bmp_dc);
}
and works too. The gmRectCornerTL is created next and the gmRectCornerTR is created with Rotate90 but
is not rotated. As well as next gmRectCornerBR and gmRectCornerBL.
But!
I just tried to rotate IDB_BITMAP2 first:
gmRectVertical = CreateTexture(IDB_BITMAP2);
gmRectHorizontal = gs->Rotate90(gmRectVertical);
gmRectCornerTL = CreateTexture(IDB_BITMAP1);
gmRectCornerTR = gs->Rotate90(gmRectCornerTL);
gmRectCornerBR = gs->Rotate90(gmRectCornerTR);
gmRectCornerBL = gs->Rotate90(gmRectCornerBR);
And IDB_BITMAP2 did not rotate anyway but the IDB_BITMAP1 rotated 4 times just fine. Both bitmaps are bmp files 32*32 size and 16 bits per pixel. I am confused what can it be:confused:
Of course, Get/SetPixel are very slow and should be avoided. I dunno why the commented out code 'does not work', what did you want it to do, and what DOES it do ?
To rotate a bitmap in the not commented out code i create 2 dc's. One for reading from bitmap and another - for writting. In the commented code i wanted to rotate a bitmap in the same dc. All i needed is to swap bits symmetrically to the diagonal that starts in point 0; 0 and ends in point 32; 32.
what DOES it do ?
Here is a code how i tested it:
gmRectHorizontal = new Texture(*gmRectVertical);
gs->Rotate90(gmRectHorizontal);
so i wanted a Texture could rotate itself but gmRectHorizontal did not rotate and looks just like gmRectVertical