Draw: iml upscaling for UHD improved

git-svn-id: svn://ultimatepp.org/upp/trunk@12260 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2018-09-07 16:23:39 +00:00
parent 26376ecd6c
commit 54a2c7bb33
5 changed files with 157 additions and 632 deletions

File diff suppressed because one or more lines are too long

View file

@ -1,5 +1,4 @@
topic "About Callbacks and Bars";
[2 $$0,0#00000000000000000000000000000000:Default]
[l288;i1120;a17;O9;~~~.1408;2 $$1,0#10431211400427159095818037425705:param]
[a83;*R6 $$2,5#31310162474203024125188417583966:caption]
[b83;*4 $$3,5#07864147445237544204411237157677:title]
@ -21,6 +20,7 @@ topic "About Callbacks and Bars";
[2 $$19,0#53580023442335529039900623488521:gap]
[t4167;C2 $$20,20#70211524482531209251820423858195:class`-nested]
[b50;2 $$21,21#03324558446220344731010354752573:Par]
[2 $$0,0#00000000000000000000000000000000:Default]
[{_}%EN-US
[s2; About Callbacks and Bars&]
[s0; This article discusses callback types and function overloads

View file

@ -199,6 +199,7 @@ Image CachedSetColorKeepAlpha(const Image& img, Color color);
Image CachedSetColorKeepAlphaPaintOnly(const Image& img, Color color);
Image Upscale2x(const Image& src);
Image ImlUpscale2x(const Image& src);
void SetUHDMode(bool b = true);
bool IsUHDMode();

View file

@ -74,6 +74,21 @@ Image Upscale2x(const Image& src)
Size isz = src.GetSize();
Image s = RecreateAlpha(Upscale2x(GetOver(CreateImage(isz, White()), src), White()),
Upscale2x(GetOver(CreateImage(isz, Black()), src), Black()));
struct SFilter : ImageFilter9 { // Improve contours
virtual RGBA operator()(const RGBA **mx) {
RGBA s = mx[1][1];
int l = mx[0][1].a;
int r = mx[2][1].a;
int t = mx[1][0].a;
int b = mx[1][2].a;
int l1 = 110;
int l2 = 230;
return l * r * t * b || s.a > l1 || mx[0][1].a > l2 || mx[2][1].a > l2 || mx[1][0].a > l2 || mx[1][2].a > l2 ? s
: RGBAZero();
}
} ef;
s = Filter(s, ef);
ImageBuffer h(s);
h.SetResolution(IMAGE_RESOLUTION_UHD);
h.SetHotSpot(src.GetHotSpot() * 2);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.9 KiB

After

Width:  |  Height:  |  Size: 9.9 KiB

Before After
Before After