-
-
Save yuriks/1251653 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
uint8* dest = malloc(width * height * 4); | |
short* src = imgData; | |
for (int i = 0; i < width * height; ++i) { | |
short x = *src++; | |
*dest++ = (x >> 8) & 0xFF; | |
*dest++ = x & 0xFF; | |
*dest++ = 0; | |
*dest++ = 0; | |
} |
dennda
commented
Sep 29, 2011
uint8 *fourchan = (uint8*) malloc(sizeof(uint8) * width * height * 4);
short cur;
short *subscript = (short*) imgData;
for (int i = 0; i < width * height; i++) {
cur = subscript[i] + 1000;
fourchan[i*4] = cur;
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment