MCPcopy Create free account
hub / github.com/audacity/audacity / CreateOneImageCache

Method CreateOneImageCache

libraries/lib-theme/Theme.cpp:572–726  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

570}
571
572bool ThemeBase::CreateOneImageCache( teThemeType id, bool bBinarySave )
573{
574 SwitchTheme( id );
575 auto &resources = *mpSet;
576
577 wxImage ImageCache( ImageCacheWidth, ImageCacheHeight );
578 ImageCache.SetRGB( wxRect( 0,0,ImageCacheWidth, ImageCacheHeight), 1,1,1);//Not-quite black.
579
580 // Ensure we have an alpha channel...
581 if( !ImageCache.HasAlpha() )
582 {
583 ImageCache.InitAlpha();
584 }
585
586 FlowPacker context{ ImageCacheWidth };
587
588//#define IMAGE_MAP
589#ifdef IMAGE_MAP
590 wxLogDebug( wxT("<img src=\"ImageCache.png\" usemap=\"#map1\">" ));
591 wxLogDebug( wxT("<map name=\"map1\">") );
592#endif
593
594 // Save the bitmaps
595 for (size_t i = 0; i < resources.mImages.size() ; ++i)
596 {
597 wxImage &SrcImage = resources.mImages[i];
598 context.mFlags = mBitmapFlags[i];
599 if( !(mBitmapFlags[i] & resFlagInternal) )
600 {
601 context.GetNextPosition( SrcImage.GetWidth(), SrcImage.GetHeight());
602 ImageCache.SetRGB( context.Rect(), 0xf2, 0xb0, 0x27 );
603 if( !(context.mFlags & resFlagSkip) )
604 PasteSubImage( &ImageCache, &SrcImage,
605 context.mxPos + context.mBorderWidth,
606 context.myPos + context.mBorderWidth);
607 else
608 ImageCache.SetRGB( context.RectInner(), 1,1,1);
609#ifdef IMAGE_MAP
610 // No href in html. Uses title not alt.
611 wxRect R( context.Rect() );
612 wxLogDebug( wxT("<area title=\"Bitmap:%s\" shape=rect coords=\"%i,%i,%i,%i\">"),
613 mBitmapNames[i],
614 R.GetLeft(), R.GetTop(), R.GetRight(), R.GetBottom() );
615#endif
616 }
617 }
618
619 // Now save the colours.
620 int x,y;
621
622 context.SetColourGroup();
623 for (size_t i = 0; i < resources.mColours.size(); ++i)
624 {
625 context.GetNextPosition( iColSize, iColSize );
626 wxColour c = resources.mColours[i];
627 ImageCache.SetRGB( context.Rect() , 0xf2, 0xb0, 0x27 );
628 ImageCache.SetRGB( context.RectInner() , c.Red(), c.Green(), c.Blue() );
629

Callers

nothing calls this directly

Calls 15

PasteSubImageFunction · 0.85
ThemeSubdirFunction · 0.85
ShowMessageBoxFunction · 0.85
ThemeFilePrefixFunction · 0.85
GetNextPositionMethod · 0.80
GetHeightMethod · 0.80
RectMethod · 0.80
RectInnerMethod · 0.80
GetRightMethod · 0.80
SetColourGroupMethod · 0.80
RescaleMethod · 0.80
wxRectClass · 0.70

Tested by

no test coverage detected