Image ToolButton::GetImage() const { UPP::Image m = img; if(IsDarkColorFace() && !nodarkadjust) m = MakeImage(m, AdjustForDarkBk); m = CachedRescale(m, min(m.GetSize(), maxiconsize)); return m; }
Image DPI(const Image& img, int expected) { if(img.GetSize().cy <= expected && IsUHDMode()) { Image m = CachedRescale(img, 2 * img.GetSize(), FILTER_LANCZOS3); ImageBuffer h(m); h.SetResolution(IMAGE_RESOLUTION_UHD); return h; } return img; }
virtual void Paint(Draw& w, const Rect& r, const Value& q, Color ink, Color paper, dword style) const { w.DrawRect(r, paper); Image m = q; if(!IsNull(m)) { Size sz = GetFitSize(m.GetSize(), r.Size()); Point p = r.CenterPos(sz); w.DrawImage(p.x, p.y, CachedRescale(m, sz)); } }
Image DPI(const Image& img) { if(IsUHDMode()) { if(img.GetResolution() == IMAGE_RESOLUTION_STANDARD) { Image m = CachedRescale(img, 2 * img.GetSize(), FILTER_LANCZOS3); ImageBuffer h(m); h.SetResolution(IMAGE_RESOLUTION_UHD); return h; } } else { if(img.GetResolution() == IMAGE_RESOLUTION_UHD) { Image m = CachedRescale(img, img.GetSize() - 2, FILTER_LANCZOS3); ImageBuffer h(m); h.SetResolution(IMAGE_RESOLUTION_UHD); return h; } } return img; }
Image CachedRescale(const Image& m, Size sz, int filter) { return CachedRescale(m, sz, m.GetSize(), filter); }