25#include <wx/mstream.h>
27#include <wx/menuitem.h>
28#include <wx/aui/auibar.h>
29#include <wx/dcclient.h>
30#include <wx/dcmemory.h>
34#include <unordered_map>
54 return bitmap == other.bitmap &&
scale == other.scale;
67 static const bool sz64 =
sizeof( uintptr_t ) == 8;
68 static const size_t mask = sz64 ? 0xF000000000000000uLL : 0xF0000000uL;
69 static const size_t offset = sz64 ? 60 : 28;
76 ( (uintptr_t)(
id.bitmap ) & ~mask ) |
77 ( ( (uintptr_t)(
id.scale ) & 0xF ) << offset );
134#if defined( __WXMSW__)
141 const int vert_size = aWindow->ConvertDialogToPixels( wxSize( 0, 8 ) ).y;
147 if( vert_size > 34 )
return 8;
148 else if( vert_size > 29 )
return 7;
149 else if( vert_size > 24 )
return 6;
193 return wxBitmap( aBitmap );
197 wxImage
image = aBitmap.ConvertToImage();
199 wxIMAGE_QUALITY_BILINEAR );
201 return wxBitmap(
image );
208 wxBitmap* bitmap =
new wxBitmap(
GetBitmapStore()->GetBitmap( aBitmap ) );
wxBitmap * KiBitmapNew(BITMAPS aBitmap)
Allocate a wxBitmap on heap from a memory record, held in a BITMAPS.
wxBitmapBundle KiBitmapBundleDef(BITMAPS aBitmap, int aDefHeight)
Constructs and returns a bitmap bundle for the given icon ID, with the default bitmap size being aDef...
static std::unique_ptr< BITMAP_STORE > s_BitmapStore
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()
static std::unordered_map< SCALED_BITMAP_ID, wxBitmap > s_ScaledBitmapCache
KICOMMON_API wxBitmapBundle KiDisabledBitmapBundleDef(BITMAPS aBitmap, int aDefHeight)
wxBitmap KiScaledBitmap(BITMAPS aBitmap, wxWindow *aWindow, int aHeight, bool aQuantized)
Construct a wxBitmap from a memory record, scaling it if device DPI demands it.
wxBitmapBundle KiDisabledBitmapBundle(BITMAPS aBitmap, int aMinHeight)
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap, int aMinHeight)
BITMAPS
A list of all bitmap identifiers.
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
Helper to retrieve bitmaps while handling icon themes and scaling.
wxBitmapBundle GetBitmapBundleDef(BITMAPS aBitmapId, int aDefHeight)
Constructs and returns a bitmap bundle for the given icon ID, with the default bitmap size being aDef...
wxBitmapBundle GetBitmapBundle(BITMAPS aBitmapId, int aMinHeight=-1)
Constructs and returns a bitmap bundle containing all available sizes of the given ID.
wxBitmapBundle GetDisabledBitmapBundleDef(BITMAPS aBitmapId, int aDefHeight)
Constructs and returns a bitmap bundle for the given icon ID, with the bitmaps converted to disabled ...
wxBitmapBundle GetDisabledBitmapBundle(BITMAPS aBitmapId, int aMinHeight=-1)
Constructs and returns a bitmap bundle for the given icon ID, with the bitmaps converted to disabled ...
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.
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