Jump to content

"Create Image Viewer" - Program inverts colors?


Kantros
 Share

Go to solution Solved by Josh,

Recommended Posts

I am going through the documentation and I may have ran into a bug or maybe have misunderstood the program.

In the image viewer the colors are inverted, for example below the blue image is how it's supposed to be but when displayed in the "Create Image Viewer" program, it is red.

When I "Save" the file it goes back to being blue like it should. I don't see anything in the code manipulating the color. Whats happening here?

RedLogo.png

SupposedToBe.png

  • Upvote 1
Link to comment
Share on other sites

Let me see what's going on here...I think on Windows the red and blue channels are swapped in GDI+ but if my example works correctly then your image might have a different pixel format...

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

Okay, here is a test program demonstrating the problem. I'm just loading your image straight from the server, kind of cool.

Now I will debug this...

#include "UltraEngine.h"

using namespace UltraEngine;

int main(int argc, const char* argv[])
{
    auto plugin = LoadPlugin("Plugins/FITextureLoader.*");

    // Get the available displays
    auto displays = GetDisplays();

    // Create a window
    auto window = CreateWindow("Image Test", 0, 0, 1024, 768, displays[0], WINDOW_TITLEBAR | WINDOW_RESIZABLE | WINDOW_CENTER);

    // Create user interface
    auto ui = CreateInterface(window);
    iVec2 sz = ui->root->ClientSize();

    // Main panel
    int padding = 4;
    auto mainpanel = CreatePanel(padding, padding, sz.x - padding * 2, sz.y - padding * 2, ui->root, PANEL_BORDER);
    mainpanel->SetLayout(1, 1, 1, 1);
    mainpanel->SetColor(0.1, 0.1, 0.1);

    auto pm = LoadPixmap("https://leadwerksstorage.s3.us-east-2.amazonaws.com/monthly_2021_05/BethLogo.png.ae15713efcbf7fdc4f0b30790d86b73a.png");
    mainpanel->SetPixmap(pm);

    while (true)
    {
        const Event ev = WaitEvent();
        switch (ev.id)
        {
        case EVENT_WIDGETACTION:
            break;
        case EVENT_WINDOWCLOSE:
            if (ev.source == window) return 0;
            break;
        }
    }
    return 0;
}

 

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

This is working correctly when I build the application from the full engine source code, although I am not sure what I changed.

I would like to wait a bit before uploading an update, so any other small issues that come up this week can get resolved at the same time.

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

  • 4 weeks later...

FYI, a beta is going to go out soon, along with the first test build for Linux, and after testing this fix will go into version 1.01. Hopefully it is not causing you trouble in the meantime. I will lock this thread now and consider the issue solved. Thanks for reporting it!

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

  • Josh locked this topic
  • 1 month later...
Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...