I've been stuck on this for awhile, I eventually gave up but can anyone lead me in the correct direction. Also side note, I need the final result to have alpha.
static std::unique_ptr<unsigned char [ ]> ImageData;
if ( !ImageData) {
ImageData = std::make_unique<unsigned char [ ]>( Width* Height);
for ( int x = 0; i < Width; x++) {
for ( int y = 0; y < Height; y++ ) {
float Red = 128, Green = 128, Blue = 255, Alpha = 255;
// some cool math to determine color based off x/y.
// . . .
const unsigned char a[] = { Red, Green, Blue, Alpha };
*reinterpret_cast<unsigned char*>(ImageData.get() + x + y * Height) = *a;
};
};
};
The image generated is completely trash and unusable, it's just random corruption everywhere.