Allow images in higher resolution to be stored in own folder

- The is an alternative used in other toolkits
This commit is contained in:
Robert Roebling
2025-12-06 18:18:50 +01:00
committed by Vadim Zeitlin
parent 5881cc3d29
commit c0bbcd2c71
2 changed files with 8 additions and 1 deletions
+2 -1
View File
@@ -232,7 +232,8 @@ public:
Create a bundle from bitmaps stored as files.
Looking in @a path for files using @a filename as prefix and potentionally a
suffix with scale, e.g. "_2x" or "@2x"
suffix with scale, e.g. "_2x" or "@2x". Alternatively, it will look for
files with the same filename in a directory "2.0x/" (@since 3.3.2).
@param path Path of the directory containing the files
@param filename Bitmap's filename without any scale suffix
+6
View File
@@ -529,6 +529,12 @@ wxBitmapBundle wxBitmapBundle::FromFiles(const wxString& path, const wxString& f
fn.SetName(wxString::Format("%s_%dx", filename, dpiFactor));
}
if ( !fn.FileExists() && dpiFactor != 1 )
{
// try /2.0x/image.png naming scheme
fn.AppendDir( wxString::Format("%d.0x", dpiFactor));
}
if ( fn.FileExists() )
{
wxBitmap bmp(fn.GetFullPath(), wxBITMAP_TYPE_ANY);