Bug: can't add user-defined images using .xpm

Feedback and Reviews for Audacity 2.x

This board is ONLY for general feedback and discussion about Audacity 2.X.

If you require help, or think you have found a "bug", please post on the forum board relevant to your operating system.
Windows
Mac OS X
GNU/Linux and Unix-like

Bug: can't add user-defined images using .xpm

Permanent link to this post Posted by jik » Tue Aug 15, 2017 5:03 pm

There is a bug in overloaded function RegisterImage(iIndex, pXpm, Name). This function is used if we want to add user-defined image using .xpm file. The Mask is not set. As a result, initAlpha() clears the image. SetMaskColour() should be added before initAlpha():
Code: Select all
void ThemeBase::RegisterImage( int &iIndex, char const ** pXpm, const wxString & Name ) {
   wxASSERT( iIndex == -1 ); // Don't initialise same bitmap twice!
   wxImage Img(pXpm);
   Img.SetMaskColour(0xDE, 0xDE, 0xDE); // <-- missed call
   Img.InitAlpha();
   RegisterImage( iIndex, Img, Name );
}
jik
 
Posts: 3
Joined: Tue Aug 15, 2017 4:35 pm
Operating System: Windows 7

Re: Bug: can't add user-defined images using .xpm

Permanent link to this post Posted by steve » Tue Aug 15, 2017 5:16 pm

Which version are you looking at? That does not appear to quite match the current code: https://github.com/audacity/audacity/bl ... /Theme.cpp
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
steve
Site Admin
 
Posts: 44703
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Bug: can't add user-defined images using .xpm

Permanent link to this post Posted by jik » Tue Aug 15, 2017 5:24 pm

line 457 by your github link:
Code: Select all
void ThemeBase::RegisterImage( int &iIndex, char const ** pXpm, const wxString & Name )
{
   wxASSERT( iIndex == -1 ); // Don't initialise same bitmap twice!
   wxBitmap Bmp( pXpm ); // a 24 bit bitmap.
   wxImage Img( Bmp.ConvertToImage() );
   Img.SetMaskColour(0xDE, 0xDE, 0xDE); // <-- missed call
   Img.InitAlpha();
   RegisterImage( iIndex, Img, Name );
}
jik
 
Posts: 3
Joined: Tue Aug 15, 2017 4:35 pm
Operating System: Windows 7

Re: Bug: can't add user-defined images using .xpm

Permanent link to this post Posted by steve » Tue Aug 15, 2017 5:41 pm

I'm not familiar with this part of the code, so all I can do is pass this on to the developer's mailing list, or you can do that yourself if you prefer.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
steve
Site Admin
 
Posts: 44703
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Bug: can't add user-defined images using .xpm

Permanent link to this post Posted by jik » Tue Aug 15, 2017 5:58 pm

Function wxImage::InitAlpha() check the Mask. If there is no Mask it just clears the image:
Code: Select all
    if ( HasMask() )
    {
      ...
    }
    else // no mask
    {
        // make the image fully opaque
        memset(alpha, wxIMAGE_ALPHA_OPAQUE, lenAlpha);
    }

Could you please pass the report on the developer's mailing list?
jik
 
Posts: 3
Joined: Tue Aug 15, 2017 4:35 pm
Operating System: Windows 7

Re: Bug: can't add user-defined images using .xpm

Permanent link to this post Posted by steve » Tue Aug 15, 2017 6:04 pm

jik wrote:Could you please pass the report on the developer's mailing list?

Sure, will do. Thanks.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
steve
Site Admin
 
Posts: 44703
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu


Return to Audacity 2.x Feedback and Reviews



Who is online

Users browsing this forum: No registered users and 1 guest