1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-30 15:39:27 +02:00

Merge branch 'paint-by-numbers'

This commit is contained in:
James Crook 2018-04-04 21:37:22 +01:00
commit 902e1ab0a1
2 changed files with 22 additions and 3 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>" );
@ -1030,11 +1042,14 @@ bool ThemeBase::ReadImageCache( teThemeType type, bool bOkIfNotFound)
if( (mBitmapFlags[i] & resFlagInternal)==0)
{
mFlow.GetNextPosition( Image.GetWidth(),Image.GetHeight() );
// wxLogDebug(wxT("Copy at %i %i (%i,%i)"), mxPos, myPos, xWidth1, yHeight1 );
wxRect R = mFlow.RectInner();
//wxLogDebug( "[%i, %i, %i, %i, \"%s\"], ", R.x, R.y, R.width, R.height, mBitmapNames[i].c_str() );
Image = GetSubImageWithAlpha( ImageCache, mFlow.RectInner() );
mBitmaps[i] = wxBitmap(Image);
}
}
if( !ImageCache.HasAlpha() )
ImageCache.InitAlpha();
// return true; //To not load colours..
// Now load the colours.
@ -1046,6 +1061,8 @@ bool ThemeBase::ReadImageCache( teThemeType type, bool bOkIfNotFound)
{
mFlow.GetNextPosition( iColSize, iColSize );
mFlow.RectMid( x, y );
wxRect R = mFlow.RectInner();
//wxLogDebug( "[%i, %i, %i, %i, \"%s\"], ", R.x, R.y, R.width, R.height, mColourNames[i].c_str() );
// Only change the colour if the alpha is opaque.
// This allows us to add NEW colours more easily.
if( ImageCache.GetAlpha(x,y ) > 128 )