Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

"Create Image Viewer" - Program inverts colors?


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

Link to post
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...

Link to post
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;
}

 

Link to post
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.

Link to post
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...