Menu

mpBitmapLayer: "IsOk()" failed in GetWidth(): invalid bitmap ..

Help
Hristijan
2021-06-15
2021-06-15
  • Hristijan

    Hristijan - 2021-06-15

    I want to load an image using mpBitmapLayer.

    mpBitmapLayer *bitmapLayer = new mpBitmapLayer();
    wxImage *image = new wxImage("/some/path/image.jpg", wxBITMAP_TYPE_JPEG);
    bitmapLayer->SetBitmap(*image, 0, 0, 100, 100);
    bitmapLayer->SetAlign(mpALIGN_CENTER);
    

    However, I get the following errors:

    ./src/gtk/bitmap.cpp(924): assert "IsOk()" failed in GetWidth(): invalid bitmap
    ./src/gtk/bitmap.cpp(988): assert "rect.x >= 0 && rect.y >= 0 && rect.x + w <= bmpData->m_width && rect.y + h <= bmpData->m_height" failed in GetSubB
    itmap(): invalid bitmap region
    ./src/gtk/bitmap.cpp(814): assert "IsOk()" failed in ConvertToImage(): invalid bitmap
    ./src/common/image.cpp(429): assert "IsOk()" failed in Scale(): invalid image
    ...
    

    The same problem happens in the sample3 sample program provided by the library.

    user@user ~/w/m/s/sample3> ./mpSample3
    18:22:23: Warning: Mismatch between the program and library build versions detected.
    The library used 3.0 (wchar_t,compiler with C++ ABI 1014,wx containers,compatible with 2.8),
    and your program used 3.0 (wchar_t,compiler with C++ ABI 1016,wx containers,compatible with 2.8).
    ./src/gtk/bitmap.cpp(924): assert "IsOk()" failed in GetWidth(): invalid bitmap
    

    What can be the problem?

     
  • Hristijan

    Hristijan - 2021-06-15

    Update: Resizing the image seemed to helped clear out the error:

    ./src/gtk/bitmap.cpp(988): assert "rect.x >= 0 && rect.y >= 0 && rect.x + w <= bmpData->m_width && rect.y + h <= bmpData->m_height" failed in GetSubB
    itmap(): invalid bitmap region
    

    However, the

    ./src/gtk/bitmap.cpp(924): assert "IsOk()" failed in GetWidth(): invalid bitmap
    

    Is still there on startup.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.