Draw: Refactored loading and adjusting .iml images for UHD/Dark modes

This commit is contained in:
Mirek Fidler 2024-07-24 12:50:31 +02:00
parent 9e58a577e2
commit c49a6a76ac
6 changed files with 209 additions and 114 deletions

View file

@ -101,53 +101,44 @@ ImageIml Iml::GetRaw(int mode, const String& id)
Image MakeImlImage(const String& id, Function<ImageIml(int, const String& id)> GetRaw, dword global_flags)
{
Image image;
int mode = IsUHDMode() * GUI_MODE_UHD + IsDarkTheme() * GUI_MODE_DARK;
auto GetImg = [&](int mode, const String& id) {
ImageIml m = GetRaw(mode, id);
if(m.flags & IML_IMAGE_FLAG_S3)
m.image = DownSample3x(m.image);
return m;
const static int mode_candidates[4][4] = {
{ GUI_MODE_NORMAL, GUI_MODE_UHD, -1 },
{ GUI_MODE_DARK, GUI_MODE_DARK_UHD, GUI_MODE_NORMAL, GUI_MODE_UHD },
{ GUI_MODE_UHD, GUI_MODE_NORMAL, -1 },
{ GUI_MODE_DARK_UHD, GUI_MODE_DARK, GUI_MODE_UHD, GUI_MODE_NORMAL }
};
if(mode == GUI_MODE_NORMAL) {
image = GetImg(GUI_MODE_NORMAL, id).image;
if(IsNull(image)) {
ImageIml im = GetImg(GUI_MODE_NORMAL, id + "__UHD");
image = im.image;
if((im.flags & IML_IMAGE_FLAG_UHD) && !((im.flags | global_flags) & (IML_IMAGE_FLAG_FIXED|IML_IMAGE_FLAG_FIXED_SIZE)))
image = Downscale2x(image);
ImageIml im;
const int *candidates = mode_candidates[mode];
for(int i = 0; i < 4 && candidates[i] >= 0; i++) {
int cmode = candidates[i];
auto Mode = [&](dword m, const char *s) { return cmode & m ? String(s) : String(); };
im = GetRaw(GUI_MODE_NORMAL, id + Mode(GUI_MODE_UHD, "__UHD") + Mode(GUI_MODE_DARK, "__DARK"));
if(IsNull(im.image))
im = GetRaw(cmode, id); // try alternative iml
if(!IsNull(im.image)) {
if(im.flags & IML_IMAGE_FLAG_S3)
im.image = DownSample3x(im.image);
break;
}
}
else {
auto Mode = [&](dword m, const char *s) { return mode & m ? String(s) : String(); };
image = GetImg(GUI_MODE_NORMAL, id + Mode(GUI_MODE_UHD, "__UHD") + Mode(GUI_MODE_DARK, "__DARK")).image;
if(IsNull(image))
image = GetImg(mode, id).image; // try to load from alternative iml
if(IsNull(image)) { // we do not have specific image for given mode, need to convert
ImageIml im;
if(mode & GUI_MODE_UHD) {
im = GetImg(GUI_MODE_NORMAL, id + "__UHD");
if(IsNull(im.image))
im = GetImg(GUI_MODE_UHD, id);
}
if(IsNull(im.image))
if(mode & GUI_MODE_DARK) {
im = GetImg(0, id + "__DARK");
if(IsNull(im.image))
im = GetImg(GUI_MODE_DARK, id);
}
if(IsNull(im.image))
im = GetImg(GUI_MODE_NORMAL, id);
if((mode & GUI_MODE_UHD) && !(im.flags & IML_IMAGE_FLAG_UHD) && !((im.flags | global_flags) & (IML_IMAGE_FLAG_FIXED|IML_IMAGE_FLAG_FIXED_SIZE)))
im.image = Upscale2x(im.image);
if((mode & GUI_MODE_DARK) && !(im.flags & IML_IMAGE_FLAG_DARK) && !((im.flags | global_flags) & (IML_IMAGE_FLAG_FIXED|IML_IMAGE_FLAG_FIXED_COLORS)))
im.image = DarkTheme(im.image);
image = im.image;
}
if(IsNull(im.image))
return Null;
ScanOpaque(image);
}
return image;
if(!(mode & GUI_MODE_UHD) && (im.flags & IML_IMAGE_FLAG_UHD) && !((im.flags | global_flags) & (IML_IMAGE_FLAG_FIXED|IML_IMAGE_FLAG_FIXED_SIZE)))
im.image = Downscale2x(im.image);
if((mode & GUI_MODE_UHD) && !(im.flags & IML_IMAGE_FLAG_UHD) && !((im.flags | global_flags) & (IML_IMAGE_FLAG_FIXED|IML_IMAGE_FLAG_FIXED_SIZE)))
im.image = Upscale2x(im.image);
if((mode & GUI_MODE_DARK) && !(im.flags & IML_IMAGE_FLAG_DARK) && !((im.flags | global_flags) & (IML_IMAGE_FLAG_FIXED|IML_IMAGE_FLAG_FIXED_COLORS)))
im.image = DarkTheme(im.image);
ScanOpaque(im.image);
return im.image;
}
Image Iml::Get(int i)

View file

@ -27,30 +27,24 @@ topic "Supporting UHD displays and Dark theme";
[s0; &]
[s0; [^topic`:`/`/Draw`/srcdoc`/UhdAndDarkTheme`_en`-us`#1^ 1. GUI
mode detection]&]
[s0; [^topic`:`/`/Draw`/srcdoc`/UhdAndDarkTheme`_en`-us`#2^ 2. Activating
Dark mode support]&]
[s0; [^topic`:`/`/Draw`/srcdoc`/UhdAndDarkTheme`_en`-us`#3^ 3. Scaling
[s0; [^topic`:`/`/Draw`/srcdoc`/UhdAndDarkTheme`_en`-us`#3^ 2. Scaling
GUI for actual GUI font and UHD resolution]&]
[s0; [^topic`:`/`/Draw`/srcdoc`/UhdAndDarkTheme`_en`-us`#4^ 4. Color
[s0; [^topic`:`/`/Draw`/srcdoc`/UhdAndDarkTheme`_en`-us`#4^ 3. Color
adjustment]&]
[s0; [^topic`:`/`/Draw`/srcdoc`/UhdAndDarkTheme`_en`-us`#5^ 5. Iml
[s0; [^topic`:`/`/Draw`/srcdoc`/UhdAndDarkTheme`_en`-us`#5^ 4. Iml
files]&]
[s0; &]
[s3;:1: 1. GUI mode detection&]
[s5; UHD mode is activated when GUI font is larger than 24 pixels.
Dark theme mode is activated if [* IsDark]([* SColorPaper]()), which
means that grayscale value of default background is less than
80. Note that both modes create 4 combinations in total `- standard
resolution with light theme, standard resolution with dark theme,
UHD resolution with light theme, UHD resolution with dark theme.&]
[s5; UHD mode is activated when standard GUI font is larger than
24 pixels. Dark theme mode is activated if [* IsDark]([* SColorPaper]()),
which means that grayscale value of default background is less
than 80. Note that both modes create 4 combinations in total
`- standard resolution with light theme, standard resolution
with dark theme, UHD resolution with light theme, UHD resolution
with dark theme.&]
[s5; [* IsUHDMode() ]and [* IsDarkTheme() ]functions return respective
current GUI status.&]
[s3;:2: 2. Activating Dark mode support&]
[s5; On some platforms (Win32), application needs to call Ctrl`::SetDarkThemeEnabled()
; at the starth of GUI`_APP`_MAIN to actually allow dark mode.
This is make sure that application behaves correctly with dark
colors.&]
[s3;:3: 3. Scaling GUI for actual GUI font and UHD resolution&]
[s3;:3: 2. Scaling GUI for actual GUI font and UHD resolution&]
[s5; U`+`+ coordinates in drawing operations are always in real pixels
for screen targets. U`+`+ provides various functions to adjust
GUI elements metrics to host platform font size and UHD mode.
@ -88,11 +82,11 @@ by 2, otherwise returns it unchanged.]
:: [s5; Returns [* b] if UHD is active, [* a] otherwise.]}}&]
[s5; Usually [* DPI ]functions are used if the value is Image related,
`'Z`' functions if it is text size related.&]
[s3;:4: 4. Color adjustment&]
[s3;:4: 3. Color adjustment&]
[s5; If application is specifying any colors, these colors need to
be adjusted for dark theme. This can be often done by using [^topic`:`/`/Draw`/src`/Colors`_en`-us^ p
redefined colors]. Sometimes only the light theme color is available
that needs to be converted to dark theme `- this can be done
that needs to be converted to the dark theme `- this can be done
using [* DarkTheme ]function. Alternatively [* AdjustIfDark] converts
the color with [* DarkTheme] only if dark theme mode is currently
active.&]
@ -100,8 +94,9 @@ active.&]
[s5; Iml files most often contain images that are used in GUI interface.
Obviously, these images must be usually different for any of
4 GUI modes.&]
[s5; .iml should always contain images for standard resolution /
light theme. These images are used to define the set of icons.&]
[s5; .iml should always contain images for either standard or UHD
resolution and the light theme. These images are used to define
the set of icons.&]
[s5; U`+`+ then uses smart algorithms to convert such images for
the current GUI mode. These work acceptably well in most cases.&]
[s5; Developer might decide to provide dedicated variants for any
@ -133,21 +128,6 @@ it.]
checked, the Image is exported as .ico and .png files. This is
intended for application icon (e.g. shown in host shell).]]}}&]
[s0; &]
[s5; Alternatively, .iml dedicated for overrides for particular mode
is used. This override is then used as parameter to `"iml`_source`"
part of .iml inclusion process:&]
[s0; &]
[s7; #define IMAGECLASS MyImg&]
[s7; #define IMAGEFILE <MyApp/MyImg.iml>&]
[s7; #define [* IMAGEFILE`_UHD ]<MyApp/MyImgHD.iml>&]
[s7; &]
[s7; #include <Draw/iml`_source.h>&]
[s0; &]
[s5; The macro names for corresponding GUI modes are [* IMAGEFILE`_DARK],
[* IMAGEFILE`_UHD], [* IMAGEFILE`_DARK`_UHD]. Note that theide tool
that creates .iml import code will automatically add reasonably
named .iml files (like MyAppHD.iml, MyAppDK.iml, MyAppHDDK.iml)
as variant .imls automatically.&]
[s5; Finally, it is also possible to disable automatic conversion
for the while .iml file by #defining FIXED`_COLORS and/or FIXED`_SIZE
macros:&]

View file

@ -5,8 +5,7 @@ uses
file
main.cpp,
Test.iml,
TestHD.iml;
Test.iml;
mainconfig
"" = "GUI";

View file

@ -2,24 +2,160 @@ PREMULTIPLIED
IMAGE_ID(Test1)
IMAGE_ID(Test2)
IMAGE_ID(Test2__DARK)
IMAGE_ID(Test2__UHD__DARK)
IMAGE_ID(Test2__UHD)
IMAGE_ID(Test2__UHD__DARK)
IMAGE_ID(Test3__UHD)
IMAGE_ID(Test4)
IMAGE_ID(Test5__UHD)
IMAGE_ID(Test6__UHD)
IMAGE_ID(Test3)
IMAGE_ID(Test3__DARK)
IMAGE_ID(Test5)
IMAGE_ID(Test6)
IMAGE_BEGIN_DATA
IMAGE_DATA(120,156,237,154,221,109,3,49,12,131,111,132,140,144,113,58,66,199,205,8,221,232,26,228,233,26,216,178,68,74,20,138)
IMAGE_DATA(248,208,188,156,69,126,244,159,16,20,121,220,142,219,49,121,78,199,199,122,24,189,85,135,142,121,24,94,237,200,131,213)
IMAGE_DATA(71,181,150,71,183,158,157,127,198,250,35,251,207,142,89,117,202,251,179,242,25,62,143,221,12,118,51,40,208,239,102,240)
IMAGE_DATA(15,155,193,207,172,25,156,231,243,111,241,49,19,16,122,171,14,29,243,48,188,218,145,7,171,143,106,45,143,110,61,59)
IMAGE_DATA(255,140,245,71,246,159,29,243,206,173,250,254,172,124,102,181,223,247,227,238,241,132,2,195,198,36,183,42,71,148,155,153)
IMAGE_DATA(35,234,153,157,1,245,201,224,103,231,87,179,81,175,234,51,236,169,169,184,199,43,127,117,15,137,100,171,224,95,57,10)
IMAGE_DATA(182,197,234,228,171,214,126,196,87,179,87,25,54,255,179,249,29,231,255,253,157,146,111,189,235,226,119,244,127,69,6,175)
IMAGE_DATA(127,215,247,143,170,12,168,23,187,31,25,251,137,122,100,157,165,72,159,170,236,105,150,183,170,151,118,178,189,89,16,175)
IMAGE_DATA(47,234,159,1,175,44,243,15,108,76,114,171,114,68,185,153,57,162,158,217,25,80,159,12,126,118,126,53,27,245,170,62)
IMAGE_DATA(195,158,154,138,123,188,242,87,247,144,72,182,10,254,149,163,96,91,172,78,190,106,237,71,124,53,123,149,97,243,63,155)
IMAGE_DATA(223,113,254,223,223,41,249,214,187,46,126,71,255,87,100,240,250,87,100,136,122,102,102,64,189,216,253,200,216,79,212,35)
IMAGE_DATA(235,44,69,250,84,101,79,179,188,85,189,180,147,237,205,130,120,237,223,12,254,173,245,106,71,30,172,62,170,181,60,186)
IMAGE_DATA(245,236,252,51,214,31,217,127,118,204,170,83,222,159,149,207,240,217,191,25,188,212,122,181,35,15,86,31,213,90,30,221)
IMAGE_DATA(122,118,254,25,235,143,236,63,59,230,157,91,245,253,89,249,204,106,127,1,101,192,255,23,0,0,0,0,0,0,0,0)
IMAGE_END_DATA(448, 7)
IMAGE_DATA(120,156,237,154,235,109,132,64,12,132,93,64,126,164,140,212,64,23,233,33,162,144,84,112,213,220,175,116,66,49,228,44)
IMAGE_DATA(221,40,147,193,11,40,15,20,178,243,73,40,199,218,187,128,7,239,131,77,188,196,99,24,99,204,201,185,220,142,249,118)
IMAGE_DATA(140,13,251,116,183,15,247,243,225,126,126,33,159,145,252,242,184,146,127,136,141,125,0,202,38,42,27,26,190,213,61,129)
IMAGE_DATA(235,189,252,172,224,254,247,232,129,152,168,30,99,44,245,65,29,62,231,88,107,29,214,105,16,31,213,131,117,226,107,242)
IMAGE_DATA(243,156,17,220,59,98,183,165,7,98,165,122,104,172,99,167,15,199,185,186,143,107,44,223,133,136,143,124,174,98,127,102)
IMAGE_DATA(61,242,185,198,216,215,95,113,92,56,214,85,223,165,245,244,119,68,157,31,240,97,141,56,246,218,46,218,224,251,62,179)
IMAGE_DATA(30,96,175,30,236,247,21,61,116,252,224,58,208,3,215,64,187,184,86,171,175,84,173,122,210,35,226,115,191,242,213,252)
IMAGE_DATA(64,204,248,122,104,151,227,63,147,13,49,103,189,34,150,241,239,77,15,248,126,119,252,64,27,124,62,137,141,207,161,71)
IMAGE_DATA(149,103,58,230,244,164,71,196,82,15,29,11,134,216,158,95,93,164,14,199,127,42,108,60,110,85,115,45,148,245,168,135)
IMAGE_DATA(198,50,98,223,250,163,154,95,113,159,164,57,56,146,237,186,114,159,172,61,207,223,171,53,141,49,198,24,243,127,240,102)
IMAGE_DATA(136,49,230,196,240,34,174,218,112,0,222,12,57,6,124,220,78,182,62,74,121,51,228,120,90,57,226,205,144,227,209,143)
IMAGE_DATA(220,140,55,67,142,133,251,5,237,143,19,111,134,28,7,107,81,197,52,241,102,200,49,172,205,95,24,111,134,28,67,53)
IMAGE_DATA(86,182,252,188,25,242,187,112,110,180,214,4,192,155,33,198,24,99,204,31,228,209,155,33,198,152,179,242,240,16,195,219)
IMAGE_DATA(91,76,243,28,115,30,175,175,245,34,145,125,112,60,61,45,255,139,11,126,217,238,86,125,190,86,218,243,192,121,182,157)
IMAGE_DATA(62,92,214,3,25,19,60,115,198,48,99,240,252,188,252,40,165,241,74,31,213,4,245,171,54,90,241,134,31,219,185,157)
IMAGE_DATA(159,127,226,115,209,202,17,141,103,229,11,141,178,76,99,185,85,159,237,208,66,115,172,55,240,206,238,213,67,203,112,142)
IMAGE_DATA(118,56,119,246,230,7,180,172,114,180,39,16,159,214,123,89,233,193,121,160,125,93,53,62,232,248,193,49,87,123,111,227)
IMAGE_DATA(6,195,90,180,222,203,173,252,64,95,5,45,181,207,98,95,216,52,127,112,253,106,108,234,5,30,59,91,115,171,164,165)
IMAGE_DATA(7,247,255,250,254,115,76,181,190,142,215,91,246,94,64,28,215,180,128,95,213,255,231,95,104,202,109,104,89,107,126,86)
IMAGE_DATA(205,175,42,123,15,112,110,180,214,5,96,109,253,209,234,95,80,7,191,171,249,213,30,123,239,243,44,99,140,49,102,141)
IMAGE_DATA(119,176,101,183,66,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)
IMAGE_END_DATA(672, 3)
IMAGE_BEGIN_DATA
IMAGE_DATA(120,156,237,218,201,109,195,48,16,5,80,29,83,70,234,72,65,174,199,213,184,134,244,144,98,108,243,16,96,48,96,36)
IMAGE_DATA(146,178,3,45,239,1,188,9,90,128,249,210,144,226,199,247,244,57,1,0,0,0,192,78,221,158,227,30,198,207,115,92)
IMAGE_DATA(7,206,19,207,113,25,60,46,222,203,109,240,28,247,134,81,158,241,107,233,129,56,181,82,31,75,117,212,99,79,249,104)
IMAGE_DATA(185,6,231,86,222,161,45,239,217,86,123,204,135,140,80,83,106,42,214,72,236,167,114,191,213,218,135,108,49,31,181,251)
IMAGE_DATA(200,207,190,116,191,156,79,201,195,220,55,98,164,118,246,146,143,34,247,150,190,33,68,37,31,191,253,85,173,54,142,158)
IMAGE_DATA(143,124,173,222,185,22,231,149,251,143,86,123,203,199,53,29,107,61,139,22,163,125,199,171,243,209,58,70,243,145,223,3)
IMAGE_DATA(230,32,44,201,107,90,61,228,131,35,203,217,232,237,55,228,131,35,42,57,88,155,141,105,122,125,62,204,63,216,130,88)
IMAGE_DATA(35,107,246,93,196,140,205,237,79,217,74,62,172,95,177,36,103,99,141,152,143,191,106,59,255,119,200,89,252,207,124,196)
IMAGE_DATA(227,252,255,32,139,181,184,54,27,69,238,87,114,205,213,254,91,207,221,211,187,242,81,235,39,205,61,136,106,181,218,58)
IMAGE_DATA(255,157,211,51,175,174,245,96,246,95,177,5,61,235,68,61,249,104,217,19,60,87,147,246,239,178,5,61,53,52,210,123)
IMAGE_DATA(196,253,43,121,142,211,58,103,126,103,62,202,185,173,87,1,0,0,0,0,0,0,156,216,3,140,203,5,170,0,0,0)
IMAGE_END_DATA(352, 1)
IMAGE_BEGIN_DATA
IMAGE_DATA(120,156,237,155,205,109,3,33,16,133,41,192,5,228,152,163,107,72,23,110,34,133,184,130,84,147,147,11,72,15,41,198)
IMAGE_DATA(17,138,86,66,79,195,252,153,181,204,242,62,105,165,200,193,15,24,152,97,128,245,219,79,121,47,132,16,66,8,33,132)
IMAGE_DATA(16,66,8,33,132,204,200,245,90,190,239,247,114,223,158,219,173,252,94,46,229,43,170,211,106,156,207,229,51,83,174,109)
IMAGE_DATA(75,253,59,163,209,254,175,247,212,62,158,78,229,35,218,199,189,244,107,121,212,176,190,131,227,166,181,165,55,30,30,123)
IMAGE_DATA(215,126,160,102,102,126,204,134,212,239,232,24,181,204,228,31,158,58,60,117,143,208,239,141,131,102,195,138,215,63,180,182)
IMAGE_DATA(88,246,94,213,55,42,82,204,146,98,143,87,111,70,255,200,248,200,104,253,58,223,50,223,139,250,71,198,222,171,250,70)
IMAGE_DATA(181,83,175,223,104,119,111,158,240,138,254,33,181,3,251,238,137,213,123,234,183,113,10,109,175,181,195,99,43,108,11,150)
IMAGE_DATA(211,52,48,126,102,214,218,89,105,99,150,180,70,100,230,206,44,254,81,193,188,33,50,246,35,245,113,254,162,190,22,175)
IMAGE_DATA(189,182,106,231,57,142,117,79,99,101,223,168,84,187,111,54,176,214,213,35,250,7,214,101,197,234,189,244,165,254,182,159)
IMAGE_DATA(105,249,237,94,254,129,237,94,205,55,44,164,152,230,97,54,255,192,188,127,116,30,233,209,151,180,112,237,233,181,203,99)
IMAGE_DATA(43,108,3,174,71,168,33,157,101,122,108,178,18,123,230,29,86,185,17,123,78,111,59,48,14,140,94,39,45,125,45,14)
IMAGE_DATA(181,49,191,151,99,101,108,149,209,136,236,205,142,14,230,157,145,239,210,63,98,250,90,252,183,246,135,81,91,245,238,99)
IMAGE_DATA(60,26,92,67,254,65,223,136,222,159,209,63,98,250,218,255,48,199,146,234,241,206,109,109,28,37,141,237,126,184,253,108)
IMAGE_DATA(149,115,93,137,106,191,71,125,163,50,218,63,142,188,255,144,206,128,181,39,114,183,135,245,122,247,248,88,118,196,156,56)
IMAGE_DATA(2,145,120,163,225,201,153,177,190,85,207,175,70,239,29,180,252,76,179,165,118,86,134,62,188,98,158,53,178,255,120,207)
IMAGE_DATA(37,149,177,206,102,158,233,31,158,249,19,173,219,171,31,245,141,76,44,193,248,111,229,104,214,26,101,197,189,163,225,61)
IMAGE_DATA(103,247,98,197,44,41,167,208,218,180,151,127,72,249,228,200,251,115,75,31,237,160,173,215,153,187,189,182,29,143,218,219)
IMAGE_DATA(163,113,68,34,249,111,118,238,88,143,20,139,86,120,255,74,155,243,136,182,135,201,220,127,68,222,47,145,202,100,236,53)
IMAGE_DATA(35,145,252,55,226,31,158,119,130,189,99,113,196,247,119,209,62,86,190,162,149,207,220,159,163,189,50,246,142,206,137,25)
IMAGE_DATA(137,140,113,198,22,237,251,43,237,163,253,22,161,242,44,255,168,218,123,254,254,163,167,159,57,51,235,173,55,94,91,105)
IMAGE_DATA(251,108,175,134,244,142,177,213,110,66,8,33,132,16,66,8,33,132,16,66,8,33,132,16,66,8,121,117,254,0,75,114)
IMAGE_DATA(55,59,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)
IMAGE_END_DATA(704, 1)
IMAGE_BEGIN_DATA
IMAGE_DATA(120,156,237,219,97,170,131,48,12,192,241,138,8,126,240,16,59,135,7,122,231,121,167,217,25,118,135,119,152,55,2,14)
IMAGE_DATA(98,166,177,205,134,168,253,255,64,24,110,203,44,36,173,173,93,255,72,183,4,0,0,0,0,0,0,156,208,216,117,221)
IMAGE_DATA(125,24,134,255,215,209,247,253,95,211,52,63,165,129,116,12,239,251,222,231,244,181,200,235,72,12,253,222,218,33,109,148)
IMAGE_DATA(182,151,182,17,85,25,189,28,106,219,246,183,36,216,153,234,35,231,55,80,55,233,67,183,242,39,21,244,177,103,172,15)
IMAGE_DATA(106,4,43,198,149,28,155,157,47,25,67,142,88,31,75,215,33,231,108,141,68,238,39,113,93,146,15,146,127,50,134,216)
IMAGE_DATA(60,212,57,122,197,250,152,204,250,1,198,16,228,176,125,107,73,191,122,178,250,72,118,93,34,183,157,168,210,219,92,253)
IMAGE_DATA(10,243,115,239,58,164,125,209,185,22,234,98,199,141,210,218,16,223,174,143,220,35,90,31,159,140,149,168,139,237,75,35)
IMAGE_DATA(125,42,245,129,26,232,117,223,233,57,90,22,234,3,149,152,205,69,82,230,24,194,252,3,87,33,185,33,99,195,210,250)
IMAGE_DATA(174,136,244,171,122,220,241,230,47,71,169,15,214,175,176,70,231,198,194,61,84,104,252,208,245,225,228,182,27,123,207,250)
IMAGE_DATA(208,159,227,249,7,52,103,189,106,180,251,78,114,99,218,251,21,155,115,75,207,173,109,140,157,234,227,173,141,204,61,96)
IMAGE_DATA(229,236,191,250,228,25,72,36,54,251,175,112,36,94,141,4,243,198,221,19,188,21,155,253,187,56,154,111,253,255,67,123)
IMAGE_DATA(205,255,109,62,110,197,222,171,62,166,216,172,87,1,0,0,0,0,0,0,0,0,0,64,197,158,198,11,66,203,0,0)
IMAGE_END_DATA(384, 1)
IMAGE_BEGIN_DATA
IMAGE_DATA(120,156,237,218,189,109,195,48,16,134,97,118,105,60,68,74,207,144,45,188,68,6,241,4,153,38,149,7,200,14,25,198)
IMAGE_DATA(193,21,4,14,31,40,254,68,145,114,36,222,7,80,99,139,38,21,223,39,146,114,94,190,210,107,2,0,0,0,0,0)
IMAGE_DATA(0,102,119,77,215,247,103,122,62,237,120,164,199,247,72,219,123,186,127,230,182,61,199,37,93,222,114,91,235,43,191,126)
IMAGE_DATA(75,183,143,173,207,180,241,149,250,246,237,245,188,145,49,149,174,187,183,141,191,30,172,169,86,39,45,71,228,67,199,100)
IMAGE_DATA(135,246,107,231,251,247,109,28,181,246,71,228,99,171,111,172,67,235,59,74,62,252,156,166,53,104,159,209,202,207,153,249)
IMAGE_DATA(32,35,107,210,26,220,155,143,209,26,169,229,67,63,219,175,159,106,235,170,172,245,126,75,171,125,233,111,247,155,126,16)
IMAGE_DATA(87,207,125,180,229,200,124,148,198,216,90,87,149,218,29,145,15,163,243,24,115,200,58,180,174,163,230,163,116,159,174,173)
IMAGE_DATA(171,178,51,242,97,116,142,27,237,7,241,248,154,179,239,215,223,147,163,229,67,207,235,173,219,179,242,161,243,25,207,179)
IMAGE_DATA(230,167,247,187,191,202,71,235,208,218,233,205,71,105,63,222,202,226,232,254,90,199,214,155,15,157,223,216,131,204,205,215)
IMAGE_DATA(115,254,46,163,231,195,144,15,28,205,223,135,125,125,69,207,199,86,31,189,235,43,242,129,30,190,30,253,235,145,247,31)
IMAGE_DATA(209,247,231,236,63,214,80,90,195,215,142,222,156,156,253,124,87,231,146,255,124,190,107,120,126,181,134,25,243,161,181,151)
IMAGE_DATA(207,137,240,251,96,233,60,126,255,152,215,108,249,208,117,149,31,207,232,255,151,28,145,15,27,67,79,78,49,191,136,251)
IMAGE_DATA(15,173,127,93,215,235,186,191,213,190,231,240,125,140,182,101,238,88,87,180,124,108,173,171,106,237,247,214,247,158,246,100)
IMAGE_DATA(99,109,145,242,81,91,87,41,93,103,249,115,207,200,135,93,47,207,171,0,0,0,0,0,0,0,0,0,0,96,46,63)
IMAGE_DATA(134,126,198,227,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)
IMAGE_END_DATA(480, 1)
IMAGE_BEGIN_DATA
IMAGE_DATA(120,156,237,155,201,109,196,48,12,69,125,14,82,68,142,83,67,186,152,38,82,200,84,144,106,114,154,2,210,67,138,153)
IMAGE_DATA(128,7,1,196,143,22,146,90,236,140,255,3,12,100,177,40,138,226,151,100,201,126,249,222,222,54,66,8,33,132,16,66)
IMAGE_DATA(8,33,132,16,66,254,27,215,237,250,249,216,30,143,210,117,223,238,63,86,91,183,237,246,85,179,133,215,235,246,250,158)
IMAGE_DATA(202,74,61,233,239,226,83,201,230,101,187,124,228,234,214,229,241,62,143,79,185,54,91,203,232,246,68,17,27,210,102,108)
IMAGE_DATA(143,252,174,227,50,203,134,142,183,252,188,71,59,172,121,36,182,74,249,48,138,150,47,123,235,67,192,114,88,47,106,28)
IMAGE_DATA(251,117,133,62,70,228,148,53,126,181,156,232,181,49,66,31,35,125,152,29,243,22,168,239,35,234,67,226,88,138,135,216)
IMAGE_DATA(104,233,103,165,62,162,253,229,141,93,46,183,90,125,137,87,110,28,239,213,199,104,31,122,226,209,11,230,86,175,189,158)
IMAGE_DATA(216,214,244,129,182,117,60,106,235,170,68,111,28,91,229,81,191,222,122,112,254,203,173,213,114,247,212,254,159,243,33,119)
IMAGE_DATA(15,214,211,211,135,43,125,168,141,153,163,208,117,140,176,63,83,31,66,110,236,177,196,104,182,62,4,28,107,60,237,175)
IMAGE_DATA(229,189,70,218,91,90,191,99,108,74,54,90,121,213,211,135,171,125,208,57,227,89,231,88,209,249,37,246,117,125,189,107)
IMAGE_DATA(132,25,250,200,141,211,150,254,88,161,15,1,231,56,139,109,108,83,196,63,175,141,154,159,209,62,220,195,135,217,250,176)
IMAGE_DATA(172,21,61,246,102,235,163,230,115,173,63,86,233,3,231,51,203,126,22,150,241,250,22,177,129,185,172,253,140,246,225,106)
IMAGE_DATA(31,176,62,235,222,158,135,150,54,188,49,242,60,87,97,238,88,245,145,123,30,111,249,104,245,169,228,155,85,31,145,185)
IMAGE_DATA(32,50,231,212,108,88,198,81,140,161,246,51,170,143,89,62,88,47,171,159,86,196,191,148,147,184,143,140,254,89,247,245)
IMAGE_DATA(87,232,67,120,86,125,68,215,8,103,214,199,168,115,39,47,218,7,235,220,181,66,31,165,58,172,235,171,35,235,131,243)
IMAGE_DATA(199,95,91,71,211,69,194,51,158,39,206,254,124,62,226,249,35,210,231,103,121,254,104,237,113,143,36,237,21,202,149,139)
IMAGE_DATA(195,17,245,129,122,192,113,102,207,253,93,129,251,87,243,125,176,238,233,247,210,210,123,164,207,86,158,15,166,123,142,112)
IMAGE_DATA(62,152,187,111,198,249,135,212,157,206,63,106,107,192,218,60,180,242,252,99,150,15,150,62,239,165,118,158,21,93,19,207)
IMAGE_DATA(210,7,198,83,231,144,247,253,146,25,250,208,123,29,145,122,34,231,231,216,206,51,157,159,91,250,124,4,150,231,32,207)
IMAGE_DATA(190,242,44,125,180,226,217,218,11,111,181,49,119,233,58,188,101,159,229,253,171,72,91,87,189,3,182,106,157,85,107,143)
IMAGE_DATA(183,206,25,250,40,173,171,90,237,232,201,239,158,242,207,244,254,110,180,189,35,125,176,158,159,183,226,210,67,110,126,143)
IMAGE_DATA(212,53,90,31,181,117,21,130,115,174,190,119,133,62,164,189,35,191,255,64,251,123,124,255,209,51,30,172,248,6,197,147)
IMAGE_DATA(31,132,16,66,8,33,132,16,66,8,33,132,16,66,8,33,132,16,146,227,23,207,137,244,89,0,0,0,0,0,0,0)
IMAGE_END_DATA(736, 1)
IMAGE_BEGIN_DATA
IMAGE_DATA(120,156,237,155,221,109,235,48,12,133,61,64,134,232,99,102,232,22,89,162,131,100,130,78,211,167,12,208,29,58,76,10)
IMAGE_DATA(62,8,80,15,72,241,72,182,220,36,62,31,96,224,162,142,126,72,241,208,250,187,167,239,229,109,17,66,8,33,132,16)
IMAGE_DATA(66,8,33,132,16,226,217,184,44,151,207,251,114,191,71,207,109,185,253,176,117,93,151,235,87,171,46,124,78,203,233,189)
IMAGE_DATA(148,181,118,202,223,173,79,81,157,231,229,252,225,181,93,151,199,223,245,244,201,179,153,45,83,219,51,130,245,25,237,40)
IMAGE_DATA(117,71,118,183,124,103,101,122,236,54,95,111,229,179,87,33,139,233,255,214,135,129,229,176,93,212,120,61,206,94,249,25)
IMAGE_DATA(250,136,218,102,241,116,193,142,133,244,49,143,108,92,30,65,31,56,206,245,56,90,29,153,126,246,212,199,136,70,122,252)
IMAGE_DATA(230,141,135,244,49,7,140,173,181,245,213,227,220,27,35,45,125,96,221,246,148,249,70,107,94,85,200,222,103,100,229,189)
IMAGE_DATA(56,236,105,7,99,180,206,27,246,239,108,142,153,249,46,2,125,87,183,187,214,103,175,64,61,174,163,243,130,154,153,250)
IMAGE_DATA(48,48,6,179,121,149,87,110,134,62,12,204,53,172,253,88,46,90,195,160,221,245,187,17,125,160,230,90,115,218,163,234)
IMAGE_DATA(163,142,47,243,113,237,231,17,189,204,214,71,54,95,136,234,222,67,31,6,198,220,72,253,35,235,252,94,125,48,121,69)
IMAGE_DATA(250,224,214,132,61,245,205,214,71,171,207,173,49,220,75,31,24,119,108,156,71,235,15,179,213,234,204,234,233,209,7,230)
IMAGE_DATA(152,104,221,32,125,112,107,176,158,56,239,89,103,226,152,179,99,236,173,199,179,62,178,125,138,250,198,198,10,198,94,79)
IMAGE_DATA(92,49,185,42,242,203,26,223,69,191,93,235,179,103,199,236,41,126,197,253,117,140,243,181,121,112,75,125,24,175,168,15)
IMAGE_DATA(35,59,139,138,242,61,235,59,172,139,253,230,30,81,31,25,76,222,66,246,208,71,212,198,204,177,222,75,31,5,107,223)
IMAGE_DATA(124,16,125,83,48,31,48,190,203,214,227,136,244,209,102,237,158,200,17,215,231,163,235,143,140,250,91,239,217,154,249,142)
IMAGE_DATA(221,231,171,217,66,231,207,76,201,79,246,120,254,122,68,125,120,121,148,25,247,189,244,49,178,127,197,250,172,181,15,220)
IMAGE_DATA(115,182,202,246,75,250,248,155,83,240,253,136,127,246,60,31,44,191,121,132,243,65,239,119,172,253,236,55,7,227,156,209)
IMAGE_DATA(135,183,30,103,191,105,71,215,71,235,60,107,116,31,127,150,62,90,123,146,189,247,75,102,232,195,155,255,176,237,96,255)
IMAGE_DATA(189,187,136,217,158,108,228,59,244,203,232,153,254,17,245,97,48,235,233,158,251,10,179,244,145,229,64,204,193,89,121,230)
IMAGE_DATA(137,238,90,48,79,175,237,204,190,85,43,94,61,223,245,214,137,185,101,173,207,94,133,214,190,251,154,123,118,91,233,131)
IMAGE_DATA(221,119,97,239,18,205,214,199,232,61,29,118,239,207,179,95,250,152,11,250,50,251,255,6,17,91,235,131,61,235,53,188)
IMAGE_DATA(121,74,121,183,135,62,240,94,225,8,222,93,196,98,75,235,28,93,250,16,66,8,33,132,16,66,8,33,132,16,66,8)
IMAGE_DATA(33,132,16,66,136,49,126,1,18,79,10,47,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)
IMAGE_END_DATA(736, 1)

View file

@ -1,10 +0,0 @@
PREMULTIPLIED
IMAGE_ID(Test3)
IMAGE_BEGIN_DATA
IMAGE_DATA(120,156,237,148,65,14,128,32,16,3,121,10,255,127,133,63,83,143,134,152,133,45,109,247,160,6,47,196,204,52,178,244)
IMAGE_DATA(232,173,55,244,57,239,21,189,48,120,211,171,202,145,245,50,115,100,153,236,12,40,135,225,103,231,119,187,81,150,122,134)
IMAGE_DATA(87,190,81,220,227,25,223,221,33,153,108,10,255,211,227,112,71,174,74,191,235,223,191,249,221,238,89,134,223,255,109,127)
IMAGE_DATA(197,252,143,123,78,127,180,87,229,175,232,127,71,134,85,190,34,67,150,201,204,128,178,118,207,131,113,158,40,131,53,75)
IMAGE_DATA(153,158,82,118,90,196,118,117,105,165,123,53,11,194,186,0,4,35,255,16,0,0,0,0,0,0,0,0,0,0,0,0)
IMAGE_END_DATA(160, 1)

View file

@ -8,11 +8,6 @@ using namespace Upp;
#define IMAGECLASS TestImg
#define IMAGEFILE <ImlUHDDark/Test.iml>
#define IMAGEFILE_UHD <ImlUHDDark/TestHD.iml>
// #define FIXED_COLORS
// #define FIXED_SIZE
#include <Draw/iml_source.h>
struct Test : TopWindow {
@ -23,11 +18,15 @@ struct Test : TopWindow {
SColorPaper_Write(mode & 1 ? Black() : White());
SetUHDMode(mode & 2);
w.DrawRect(x, 0, sz.cx, sz.cy, SColorPaper());
int y = 0;
w.DrawText(x, 0, get_i(mode, "Normal", "Dark", "UHD", "UHD Dark"), StdFont(), LtMagenta());
int y = 200;
w.DrawImage(x + 10, y += 40, TestImg::Test1());
w.DrawImage(x + 10, y += 40, TestImg::Test2());
w.DrawImage(x + 10, y += 40, TestImg::Test3());
x += 100;
w.DrawImage(x + 10, y += 40, TestImg::Test4());
w.DrawImage(x + 10, y += 40, TestImg::Test5());
w.DrawImage(x + 10, y += 40, TestImg::Test6());
x += 200;
}
}
};