Reconstructing texture data
C++
code posted
by
Jack
created at 05 Jun 14:14
Edit
|
Back
1 2 3 4 5 6 7 8 9 10 11 |
size_t oldByteSize = width * height * 2; //gray alpha size_t byteSize = width * height * 4; //rgba uint8_t* newData = (uint8_t*)malloc(byteSize); size_t i = 0, j = 0; for(; i < oldByteSize; i+=2, j+=4) { newData[0 + j] = data[i]; newData[1 + j] = data[i]; newData[2 + j] = data[i]; newData[3 + j] = data[i+1]; } |
338 Bytes in 2 ms with coderay