| 570 | } |
| 571 | |
| 572 | bool 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 |
nothing calls this directly
no test coverage detected