Bug #1959

RGBACtrl doesn't scale well (no UHD support)

Added by Zbigniew Rebacz about 5 years ago. Updated almost 5 years ago.

Status:ApprovedStart date:05/05/2019
Priority:NormalDue date:
Assignee:Zbigniew Rebacz% Done:

0%

Category:IconDesSpent time:-
Target version:-

Description

Insert color dialog from TheIDE on my full hd monitor is cutted. Probably the problem is related to this method:

void RGBACtrl::Layout()
{
    Size sz = GetSize();
    int ah = IconDesImg::Alpha().GetHeight() + 20;
    int th = text.GetStdHeight(text.GetFont());
    int eh = 4 - 20 - ah - th - 4;
    int rh = min(sz.cx - (sz.cx >> 3), sz.cy - eh);
    ramp.BottomPos(0, rh).HSizePos();
    int y = sz.cy - rh - 4 - ah;
    alpha.TopPos(y, ah).HSizePos(1, 0);
    text.TopPos((y -= 4 + th), th).HSizePos(1, 0);
    cbox.cx = (sz.cx - 3) / 18;
    cbox.cy = minmax(cbox.cx, 4, Zy(16));
    int ch = 14 * cbox.cy;
    cs.x = (sz.cx - 18 * cbox.cx) / 2 + 1;
    cs.y = (y -= ch + 4);
    if(subctrl)
        subctrl->TopPos(0, y - 4).HSizePos(1, 0);
}

// or this one:

void RGBACtrl::Paint(Draw& w)
{
    w.DrawRect(GetSize(), SColorFace);
    if(alpha.IsMask())
        return;
    for(int x = 0; x <= 18; x++)
        w.DrawRect(x * cbox.cx + cs.x, cs.y, 1, cbox.cy * 14, SColorText());
    int i = 0;
    int my = cs.y + 1;
    w.DrawRect(cs.x, cs.y + 14 * cbox.cy, cbox.cx * 18 + 1, 1, SColorText());
    Point pp = Null;
    for(int y = 0; y < 14; y++) {
        w.DrawRect(cs.x, my - 1, cbox.cx * 18 + 1, 1, SColorText());
        int mx = cs.x + 1;
        for(int x = 0; x < 18; x++) {
            Color c = GetColor(i++);
            w.DrawRect(mx, my, cbox.cx - 1, cbox.cy - 1, c);
            if(c == color)
                pp = Point(mx, my);
            mx += cbox.cx;
        }
        my += cbox.cy;
    }
    if(!IsNull(pp)) {
        Size isz = CtrlImg::wheel_cursor().GetSize();
        pp = pp + (cbox - isz) / 2;
        w.DrawImage(pp.x, pp.y, CtrlImg::wheel_cursor(),
                    Grayscale(color) < 120 ? White() : Black());
    }
}

RGBACtrlRenderingProblem.png (84.1 KB) Zbigniew Rebacz, 05/05/2019 09:57 PM

History

#1 Updated by Zbigniew Rebacz about 5 years ago

  • Subject changed from RGBACtrl doesn't scale well to RGBACtrl doesn't scale well (no UHD support)

#2 Updated by Zbigniew Rebacz about 5 years ago

  • Description updated (diff)

#3 Updated by Miroslav Fidler almost 5 years ago

  • Status changed from New to Ready for QA
  • Assignee changed from Miroslav Fidler to Zbigniew Rebacz

#4 Updated by Zbigniew Rebacz almost 5 years ago

  • Status changed from Ready for QA to Approved

Also available in: Atom PDF