SpiderPig Posted February 15, 2023 Share Posted February 15, 2023 A panel with a pixmap does not change colour or alpha. I've tried WIDGETCOLOR_BACKGROUND and WIDGETCOLOR_FORGROUND. #include "UltraEngine.h" #include "ComponentSystem.h" using namespace UltraEngine; int main(int argc, const char* argv[]) { auto displays = GetDisplays(); auto window = CreateWindow("Ultra Engine", 0, 0, 1440, 900, displays[0]); auto framebuffer = CreateFramebuffer(window); auto world = CreateWorld(); auto camera = CreateCamera(world); camera->Move(0, 2, -3); camera->SetClearColor(1, 0, 0); auto light = CreateDirectionalLight(world); light->SetRotation(35, 35, 35); auto floor = CreateBox(world, 100.0f, 0.5f, 100.0f); auto default_font = LoadFont("Fonts\\arial.ttf"); auto ui = CreateInterface(world, default_font, framebuffer->size); ui->SetRenderLayers(2); ui->root->SetColor(0.0f, 0.0f, 0.0f, 0.0f); auto ui_camera = CreateCamera(world, PROJECTION_ORTHOGRAPHIC); ui_camera->SetPosition((float)framebuffer->size.x * 0.5f, (float)framebuffer->size.y * 0.5f, 0); ui_camera->SetRenderLayers(2); ui_camera->SetClearMode(CLEAR_DEPTH); auto panel = CreatePanel(0, 0, 512, 512, ui->root); panel->SetPixmap(LoadPixmap("https://raw.githubusercontent.com/UltraEngine/Documentation/master/Assets/Materials/Ground/dirt01.dds")); panel->SetColor(1.0f, 0.0f, 1.0f, 0.5f); while (window->KeyHit(KEY_ESCAPE) == false && window->Closed() == false) { while (PeekEvent()) { ui->ProcessEvent(WaitEvent()); } world->Update(); world->Render(framebuffer); } return 0; } Quote Link to comment Share on other sites More sharing options...
klepto2 Posted February 15, 2023 Share Posted February 15, 2023 The pixmap and texture block uses the alpha value of the pixmap or texture itself. I do something like this to render alpha based pixmaps: auto data = _scintillaRenderTarget->pixels->Data(); for (i = 0; i < _scintillaRenderTarget->pixels->GetSize(); i += 4) { index = i; B = data[index]; G = data[index + 1]; R = data[index + 2]; data[index] = R; data[index + 1] = G; data[index + 2] = B; data[index + 3] = char(color[WIDGETCOLOR_BACKGROUND].a * 255); } but i agree, the source alpha should be mulitplied with the destination alpha in the case of widget usage. 1 Quote Windows 10 Pro 64-Bit-Version NVIDIA Geforce 1080 TI Link to comment Share on other sites More sharing options...
klepto2 Posted February 15, 2023 Share Posted February 15, 2023 Note: The code above converts a deviceindependent bitmap into RGBA format, so you would just need this part in the loop: data[index + 3] = char(color[WIDGETCOLOR_BACKGROUND].a * 255); 1 Quote Windows 10 Pro 64-Bit-Version NVIDIA Geforce 1080 TI Link to comment Share on other sites More sharing options...
Josh Posted February 17, 2023 Share Posted February 17, 2023 The reason for this is that on Linux I don't know if it is possible to change the color of a drawn image. I am using XRenderComposite to draw the picture. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
SpiderPig Posted February 17, 2023 Author Share Posted February 17, 2023 I thought it may have been a shader thing. I might just use klepto2's idea then. Quote Link to comment Share on other sites More sharing options...
Solution Josh Posted March 1, 2023 Solution Share Posted March 1, 2023 So currently this is a design decision, not a bug. As long as I say this is the way it is supposed to be, it it not a bug. If I say that color should affect images, then there is a bug on Linux, which can't really be fixed due to the limitations of the platform. 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.