Draw: FIXED_COLORS and FIXED_SIZE flags

git-svn-id: svn://ultimatepp.org/upp/trunk@13016 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2019-04-21 19:43:16 +00:00
parent 9eac89a556
commit 8548ac5a57
3 changed files with 17 additions and 3 deletions

View file

@ -300,6 +300,7 @@ class Iml {
VectorMap<String, IImage> map;
const Image::Init *img_init;
const char **name;
dword global_flags = 0;
bool premultiply;
Index<String> ex_name[3]; // 0 HiDPI - HD, 1 DK - Dark, 2 HDK - HiDPI + dark
@ -318,13 +319,15 @@ public:
int GetBinSize() const;
#endif
void Premultiplied() { premultiply = false; }
ImageIml GetRaw(int mode, int i); // tries to get image for mode, can return Null
ImageIml GetRaw(int mode, const String& id); // tries to get image for mode by id, can return Null
// these methods serve for .iml import
Iml(const Image::Init *img_init, const char **name, int n);//Deprecated - legacy .iml
void AddData(const byte *data, int len, int count, int mode = 0);
void AddId(int mode1, const char *name);
void Premultiplied() { premultiply = false; }
void GlobalFlag(dword f) { global_flags |= f; }
};
void Register(const char *imageclass, Iml& iml);

View file

@ -116,9 +116,10 @@ Image Iml::Get(int i)
m.image = GetRaw(mode, id).image;
if(IsNull(m.image)) {
ImageIml im = GetRaw(0, id);
if((mode & GUI_MODE_UHD) && !(im.flags & (IML_IMAGE_FLAG_FIXED|IML_IMAGE_FLAG_FIXED_SIZE)))
dword f = im.flags | global_flags;
if((mode & GUI_MODE_UHD) && !(f & (IML_IMAGE_FLAG_FIXED|IML_IMAGE_FLAG_FIXED_SIZE)))
im.image = Upscale2x(im.image);
if((mode & GUI_MODE_DARK) && !(im.flags & (IML_IMAGE_FLAG_FIXED|IML_IMAGE_FLAG_FIXED_COLORS)))
if((mode & GUI_MODE_DARK) && !(f & (IML_IMAGE_FLAG_FIXED|IML_IMAGE_FLAG_FIXED_COLORS)))
im.image = DarkTheme(im.image);
m.image = im.image;
}

View file

@ -46,6 +46,16 @@ UPP::Iml& IMAGECLASS::Iml() {
};
static UPP::Iml iml(init, name, COUNT);
#ifdef FIXED_COLORS
#undef FIXED_COLORS
iml.GlobalFlag(IML_IMAGE_FLAG_FIXED_COLORS);
#endif
#ifdef FIXED_SIZE
#undef FIXED_SIZE
iml.GlobalFlag(IML_IMAGE_FLAG_FIXED_SIZE);
#endif
#undef IMAGE_PACKED
#undef IMAGE_ID