Reputation: 23591
When you try to "mirror" an image, left-to-right style, you could just swap the pixels like this:
for i:= 0 to width / 2
for j:= 0 to height
swap pixel[i][j] with pixel[width-i][j]
But why do we need to do bitwise on each 8bit pixel(stored as char in C) ?
Upvotes: 0
Views: 160
Reputation: 2041
Assuming a pixel is not actually a pixel and represents more than one visible point in the screen, you need to reverse the bits because you want to read them left to right so that the image is completely reversed. Otherwise, you would have each smaller structure being shown "right to left" and the whole figure being shon "left to right", having a result that is not a full reversal.
Upvotes: 1