Clear or erase wxBitmap Topic is solved
-
- Earned a small fee
- Posts: 13
- Joined: Thu Apr 22, 2021 9:23 am
Clear or erase wxBitmap
Is there an easy way to fill a rectangular area of wxBitmap or entire bitmap with transparent color?
Re: Clear or erase wxBitmap
Hi,
Convert it to image, set the transparency/alpha, then convert back.
How big is the bitmap?
Thank you.
Convert it to image, set the transparency/alpha, then convert back.
How big is the bitmap?
Thank you.
-
- Earned a small fee
- Posts: 13
- Joined: Thu Apr 22, 2021 9:23 am
Re: Clear or erase wxBitmap
It can have any size up to 4096*4096 pixels.
- doublemax@work
- Super wx Problem Solver
- Posts: 474
- Joined: Wed Jul 29, 2020 6:06 pm
- Location: NRW, Germany
Re: Clear or erase wxBitmap
How time critical is the operation and how often do you have to do it?
Re: Clear or erase wxBitmap
Hi,
Are you targetting Windows only or you want it cross-platform?
Thank you.
Are you targetting Windows only or you want it cross-platform?
Thank you.
-
- Earned a small fee
- Posts: 13
- Joined: Thu Apr 22, 2021 9:23 am
Re: Clear or erase wxBitmap
I think I've found a solution. Thank you for the responses.
Code: Select all
wxImage image("image.jpeg");
image.InitAlpha();
this->bitmap = wxBitmap(image);
Code: Select all
wxMemoryDC dc(this->bitmap);
dc.SetLogicalFunction(wxCLEAR);
dc.DrawRectangle(100, 100, 40, 20);