Hi all,
I am trying to see if I can mirror a bitmap about the Y axis before I blt the bitmap, and I gave a shot at writing the code but I am getting an exeption thrown on line 15. I figured if I just swapped each pixel with the pixel equally as far on the other side of the center of the bitmap it would do the trick.
Say we have a 5 pixel bitmap:
p1 p2 p3 p4 p5
and after my method it should look like:
p5 p4 p3 p2 p1
Am I thinking about this wrong? Also are there any faster ways to do this?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 | uint32 Temp;
uint8* Row = (uint8 *) Bitmap->Pixels;
for(int Y = 0;
Y < Bitmap->Height;
++Y)
{
uint32* Pixel = (uint32 *) Row;
for(int X = 0;
X < (Bitmap->Width / 2);
++X)
{
Temp = *(Pixel + X);
*(Pixel + X) = *(Pixel + Bitmap->Width - X);
*(Pixel + Bitmap->Width - X) = Temp;
}
Row += Pitch;
}
|