1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-16 16:10:06 +02:00

Add code for iota theme-bitmap

This #ifdeffed out TEST_CARD is useful for javascript code that shows how a
theme will look, when applied to Audacity.  With the code enabled, each
pixel of audacity is painted with a colour that encodes the location in
the theme image map that was used.

Net result - in javascript you can change any colour in the theme cache
and instantly see how Audacity will look.
This commit is contained in:
James Crook 2017-05-05 12:15:00 +01:00
parent bf9beb1f36
commit 8782a7264a
2 changed files with 18 additions and 2 deletions

View File

@ -408,10 +408,12 @@ wxImage GetSubImageWithAlpha( const wxImage & Src, const wxRect &rect )
data+=width;
}
image.InitAlpha();
if( !Src.HasAlpha() )
return image;
// OK, so we've copied the RGB data.
// Now do the Alpha channel.
wxASSERT( Src.HasAlpha() );
image.InitAlpha();
//wxASSERT( Src.HasAlpha() );
subleft/=3;
width/=3;

View File

@ -735,6 +735,18 @@ void ThemeBase::CreateImageCache( bool bBinarySave )
R.GetLeft(), R.GetTop(), R.GetRight(), R.GetBottom() );
#endif
}
#if TEST_CARD
int j;
for(i=0;i<ImageCacheWidth;i++)
for(j=0;j<ImageCacheHeight;j++){
int r = j &0xff;
int g = i &0xff;
int b = (j >> 8) | ((i>>4)&0xf0);
wxRect R( i,j, 1, 1);
ImageCache.SetRGB( R, r, g, b );
ImageCache.SetAlpha( i,j, 255);
}
#endif
#ifdef IMAGE_MAP
wxLogDebug( "</map>" );
@ -1035,6 +1047,8 @@ bool ThemeBase::ReadImageCache( teThemeType type, bool bOkIfNotFound)
mBitmaps[i] = wxBitmap(Image);
}
}
if( !ImageCache.HasAlpha() )
ImageCache.InitAlpha();
// return true; //To not load colours..
// Now load the colours.