On Fri, 20 Aug 2021 23:04:06 +0530 Jason Liam wrote:
JL> Hi i am trying to display an image inside a wxPanel but getting an assert
JL> described in the subject line.
Sorry for a maybe stupid question, but I'd genuinely like to understand:
is the assert message unclear? I.e. do you have any problem with
understanding what it says?
JL> wxWidgets 3.1.5 on Ubuntu 18.04 64 bit.
JL> Also, using the return value from the statement image.LoadFile(m_file,
JL> m_format) is 1 as printed on the console.
JL> The following is the content of the log file that is generated:
JL> ASSERT INFO:
JL> ../src/gtk/bitmap.cpp(1375): assert ""IsOk()"" failed in Draw(): invalid
JL>  wxBitmap::Draw(_cairo*, int, int, bool, wxColour const*, wxColour
JL> const*) const
JL>  wxGTKCairoDCImpl::DoDrawBitmap(wxBitmap const&, int, int, bool)
JL>  wxDC::DrawBitmap(wxBitmap const&, int, int, bool)
JL>  wxImagePanel::render(wxDC&)
JL> How should I resolve this?
To me it seems absolutely clear that you need to avoid passing an invalid,
i.e. uninitialized, bitmap to DrawBitmap() that you call from your render()
function. But, again, I'd be curious to know if the assert message could
have been any more clear so that it would be clear to everybody.
TT-Solutions: wxWidgets consultancy and technical support