29#include <wx/mstream.h>
31#include <wx/menuitem.h>
32#include <wx/aui/auibar.h>
33#include <wx/dcclient.h>
34#include <wx/dcmemory.h>
38#include <unordered_map>
58 return bitmap == other.bitmap &&
scale == other.scale;
71 static const bool sz64 =
sizeof( uintptr_t ) == 8;
72 static const size_t mask = sz64 ? 0xF000000000000000uLL : 0xF0000000uL;
73 static const size_t offset = sz64 ? 60 : 28;
80 ( (uintptr_t)(
id.bitmap ) & ~mask ) |
81 ( ( (uintptr_t)(
id.
scale ) & 0xF ) << offset );
126 #if defined( __WXMSW__)
133 const int vert_size = aWindow->ConvertDialogToPixels( wxSize( 0, 8 ) ).y;
139 if( vert_size > 34 )
return 8;
140 else if( vert_size > 29 )
return 7;
141 else if( vert_size > 24 )
return 6;
185 return wxBitmap( aBitmap );
189 wxImage
image = aBitmap.ConvertToImage();
191 wxIMAGE_QUALITY_BILINEAR );
193 return wxBitmap(
image );
200 wxBitmap* bitmap =
new wxBitmap(
GetBitmapStore()->GetBitmap( aBitmap ) );
wxBitmap * KiBitmapNew(BITMAPS aBitmap)
Allocate a wxBitmap on heap from a memory record, held in a BITMAPS.
static std::unique_ptr< BITMAP_STORE > s_BitmapStore
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap)
void ClearScaledBitmapCache()
Wipes out the scaled bitmap cache so that the icon theme can be changed.
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
static std::mutex s_BitmapCacheMutex
int KiIconScale(wxWindow *aWindow)
Return the automatic scale factor that would be used for a given window by KiScaledBitmap and KiScale...
BITMAP_STORE * GetBitmapStore()
wxBitmapBundle KiDisabledBitmapBundle(BITMAPS aBitmap)
static std::unordered_map< SCALED_BITMAP_ID, wxBitmap > s_ScaledBitmapCache
wxBitmap KiScaledBitmap(BITMAPS aBitmap, wxWindow *aWindow, int aHeight, bool aQuantized)
Construct a wxBitmap from a memory record, scaling it if device DPI demands it.
BITMAPS
A list of all bitmap identifiers.
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
Helper to retrieve bitmaps while handling icon themes and scaling.
wxBitmap GetBitmap(BITMAPS aBitmapId, int aHeight=-1)
Retrieves a bitmap from the given bitmap id.
wxBitmap GetBitmapScaled(BITMAPS aBitmapId, int aScaleFactor, int aHeight=-1)
Retrieves a bitmap from the given bitmap id, scaled to a given factor.
wxBitmapBundle GetDisabledBitmapBundle(BITMAPS aBitmapId)
Constructs and returns a bitmap bundle for the given icon ID, with the bitmaps converted to disabled ...
wxBitmapBundle GetBitmapBundle(BITMAPS aBitmapId)
Constructs and returns a bitmap bundle containing all available sizes of the given ID.
static wxString GetStockDataPath(bool aRespectRunFromBuildDir=true)
Gets the stock (install) data path, which is the base path for things like scripting,...
bool operator==(SCALED_BITMAP_ID const &other) const noexcept
SCALED_BITMAP_ID argument_type
result_type operator()(argument_type const &id) const noexcept