Skip to content

Instantly share code, notes, and snippets.

@NikitaShkaruba
Created November 10, 2017 23:54
Show Gist options
  • Save NikitaShkaruba/bc86bdc05163aba3e270193112601ffc to your computer and use it in GitHub Desktop.
Save NikitaShkaruba/bc86bdc05163aba3e270193112601ffc to your computer and use it in GitHub Desktop.
size_t width = image.height;
size_t height = image.width3;
char** pixels = (char**) calloc(height, sizeof(char*));
for (int i = 0; i < width; i ++) {
pixels[i] = (char*) calloc(width, sizeof(char));
}
for (int i = 0; i < height; i++) {
for (int j = 0; j < width; j++) {
int y = height - i - 1;
int x = width - j - 1;
pixels[y][x] = image.array[width * i - 1 + j] //initial_pixels[i][j];
}
}
for (int i = 0; i < height; i++) {
for (int j = 0; j < width; j++) {
image.array[width * i -1 + j] = pixels[i][j];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment