Gtk Warning on Linux when setting a bit mask

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
rsb
I live to help wx-kind
I live to help wx-kind
Posts: 170
Joined: Fri May 29, 2015 7:26 pm

Gtk Warning on Linux when setting a bit mask

Post by rsb »

When reading a .png file into our application to use as a stipple brush, we get the following warning on Linux.
Same code on Windows but no warning.

Gtk - WARNING ** : Attempt to draw a drawable with depth 24 to a drawable with depth 1

Any idea what could cause this?

Also, the stipple pattern looks corrupt. Windows is fine.

Thanks.

--------------------------------------------------- Code --------------------------------------------------------------

fill_pattern_p->pWX_bitmap = new wxBitmap ;
fill_pattern_p->pWX_bitmap->LoadFile(pathname, wxBITMAP_TYPE_PNG) ;
fill_pattern_p->pWX_bitmap->SetDepth(1) ;

if( !fill_pattern_p->pWX_bitmap->IsOk() )
{
return ;
}
fill_pattern_p->pWX_bitmap->SetMask( new wxMask( *(fill_pattern_p->pWX_bitmap) ) ); <---------------- Warning Here

--------------------------------------------------- End Code ----------------------------------------------------------

wxWidgets: 3.0.2
OS: Linux Btfsplk 2.6.32-696.6.3.el6.x86_64 #1 SMP Fri Jun 30 13:24:18 EDT 2017 x86_64 x86_64 x86_64 GNU/Linux
Compiler: gcc
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Gtk Warning on Linux when setting a bit mask

Post by doublemax »

Code: Select all

fill_pattern_p->pWX_bitmap->SetDepth(1) ;
This does not what you probably expect.

Try the wxMask ctor that takes an additional colour parameter.
Use the source, Luke!
rsb
I live to help wx-kind
I live to help wx-kind
Posts: 170
Joined: Fri May 29, 2015 7:26 pm

Re: Gtk Warning on Linux when setting a bit mask

Post by rsb »

Thanks.
Post Reply