wxImage not works wxNativePixelData

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
Alfresco
In need of some credit
In need of some credit
Posts: 5
Joined: Wed Feb 20, 2019 10:38 am

wxImage not works wxNativePixelData

Post by Alfresco »

Code: Select all

wxImagePanelAfter::wxImagePanelAfter(wxFrame* parent, wxImagePanel* pan):
    wxImagePanel(parent)
{
   bool t  =  image.Create(pan->width, pan->height);
....
t == true!

Code: Select all

void wxImagePanelAfter::keyPressed(wxKeyEvent& event)
    {
     wxNativePixelData data(image);
here stops and says that incorrect Bitmap type wxBitmapGetRawData()
Last edited by catalin on Mon Jul 06, 2020 12:52 pm, edited 2 times in total.
Reason: code tags (wow, terrible formattng though...)
Alfresco
In need of some credit
In need of some credit
Posts: 5
Joined: Wed Feb 20, 2019 10:38 am

Re: wxImage not works wxNativePixelData

Post by Alfresco »

So i used VS 2019 Comunity to compile wxwidgets 3
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4204
Joined: Sun Jan 03, 2010 5:45 pm

Re: wxImage not works wxNativePixelData

Post by PB »

That is not surprising as wxNativePixelData works only with wxBitmaps without the alpha channel, as clearly stated in the docs. The wxImage in your code is automatically converted to wxBitmap, but that wxBitmap probably has the alpha channel.

Use wxImagePixelData with wxImage or use wxAlphaPixel data with a converted bitmap.
Post Reply