Created
May 14, 2013 17:53
-
-
Save adventureloop/5578011 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Texture::flipImageData(unsigned char *data,int width,int height) | |
{ | |
int x,y; | |
int size = (width * height)-1; //Indices start at 0 | |
width = (width < 0) ? 0 : width; | |
height = (height < 0) ? 0 : height; | |
cout << "Image width: " << width << " height: " << height << endl; | |
for(y = 0; y < height/2;y++) { | |
cout << "y: " << y << " height - y " << height - y << endl; | |
for(x = 0; x < width;x++) { | |
int bottom = (width*y) + x; | |
int top = (width*(height-y)) + x; | |
unsigned char tmp = data[bottom]; | |
data[bottom] = data[top]; | |
data[top] = tmp; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment