I’m trying to figure out why the color I write for the texture of my UImage doesn’t match what I specify in my FColor. For the sake of this post, I simplified the code but the result is the same:
TArray<uint8> textureBuffer;
textureBuffer.Init(0, 128 * 128 * 4);
auto pixelIndex = 0;
for (auto Y = 0; Y < 128; ++Y)
{
for (auto X = 0; X < 128; ++X)
{
textureBuffer[pixelIndex++] = 33;
textureBuffer[pixelIndex++] = 66;
textureBuffer[pixelIndex++] = 99;
textureBuffer[pixelIndex++] = 255;
}
}
auto updateTextureRegion = new FUpdateTextureRegion2D(0, 0, 0, 0, 128, 128);
const auto BufferPitch = 128 * 4;
_texture->UpdateTextureRegions(0, 1, updateTextureRegion, BufferPitch, 4,
textureBuffer.GetData(), &FreeUpdateMemory);
Basically, I create an array of RGB(99, 66, 33). I then dump the array using _imageWidget->SetBrushFromTexture(_texture). When I look at the result, the pixels seem much brighter. This is confirmed using a drawing software.
I tried playing with the Image widget settings such as Tint and ColorAndOpacity, but no luck. Couldn’t find anything on the web/forums either.