Minor render issue of titlebar corner over window background #655

Closed
opened 2016-05-12 21:06:06 +00:00 by ocornut · 1 comment
ocornut commented 2016-05-12 21:06:06 +00:00 (Migrated from github.com)

Fixing this now
https://twitter.com/petrih3/status/730723212955398145
@petrihakkinen

is this a known rendering issue?
there is a dark artifact in the upper-left rounded window corner

ciqn2ihxaaabnyo

Opening a thread # because the fix is leading us to a minor breakage in the styling colors which may affect some people. It will documented but I want to also add a link to this place.

Fixing this now https://twitter.com/petrih3/status/730723212955398145 @petrihakkinen > is this a known rendering issue? > there is a dark artifact in the upper-left rounded window corner ![ciqn2ihxaaabnyo](https://cloud.githubusercontent.com/assets/8225057/15230411/c5f928aa-1895-11e6-9d62-6a0220953167.jpg) Opening a thread # because the fix is leading us to a minor breakage in the styling colors which may affect some people. It will documented but I want to also add a link to this place.
ocornut commented 2016-05-12 21:17:19 +00:00 (Migrated from github.com)

Fixed. Frustrating to have to break styling (in a minor way) for this but it wasn't really consistent nor practical to have TitleBg color being drawn over WindowBg color. So fixing the artefact should make styles easier.

Note that it only affected styles where TitleBg/TitleBgActive Alpha was < 1.0f.
It is the case of the default theme and I have fixed it. However having looked at some of the custom themes used by people here it seems like most people are only Alpha=1.0f for both of those colors so hopefully the breakage should be limited to a small subset of users.

API BREAKING CHANGES

2016/05/12 (1.49)

title bar (using TitleBg/TitleBgActive colors) isn't rendered over a window background (WindowBg color) anymore. 
If your TitleBg/TitleBgActive alpha was 1.0f or you are using the default theme it will not affect you. However if your TitleBg/TitleBgActive alpha was <1.0f you need to tweak your custom theme to readjust for the fact that we don't draw a WindowBg background behind the title bar.
This helper function will convert an old TitleBg/TitleBgActive color into a new one with the same visual output, given that color and the WindowBg color.

    ImVec4 ConvertTitleBgCol(const ImVec4& win_bg_col, const ImVec4& title_bg_col)
    {
        float new_a = 1.0f - ((1.0f - win_bg_col.w) * (1.0f - title_bg_col.w)), k = title_bg_col.w / new_a;
        return ImVec4((win_bg_col.x * win_bg_col.w + title_bg_col.x) * k, (win_bg_col.y * win_bg_col.w + title_bg_col.y) * k, (win_bg_col.z * win_bg_col.w + title_bg_col.z) * k, new_a);
    }
Fixed. Frustrating to have to break styling (in a minor way) for this but it wasn't really consistent nor practical to have TitleBg color being drawn over WindowBg color. So fixing the artefact should make styles easier. Note that it only affected styles where TitleBg/TitleBgActive Alpha was < 1.0f. It is the case of the default theme and I have fixed it. However having looked at some of the custom themes used by people here it seems like most people are only Alpha=1.0f for both of those colors so hopefully the breakage should be limited to a small subset of users. ``` API BREAKING CHANGES 2016/05/12 (1.49) title bar (using TitleBg/TitleBgActive colors) isn't rendered over a window background (WindowBg color) anymore. If your TitleBg/TitleBgActive alpha was 1.0f or you are using the default theme it will not affect you. However if your TitleBg/TitleBgActive alpha was <1.0f you need to tweak your custom theme to readjust for the fact that we don't draw a WindowBg background behind the title bar. This helper function will convert an old TitleBg/TitleBgActive color into a new one with the same visual output, given that color and the WindowBg color. ImVec4 ConvertTitleBgCol(const ImVec4& win_bg_col, const ImVec4& title_bg_col) { float new_a = 1.0f - ((1.0f - win_bg_col.w) * (1.0f - title_bg_col.w)), k = title_bg_col.w / new_a; return ImVec4((win_bg_col.x * win_bg_col.w + title_bg_col.x) * k, (win_bg_col.y * win_bg_col.w + title_bg_col.y) * k, (win_bg_col.z * win_bg_col.w + title_bg_col.z) * k, new_a); } ```
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ocornut/imgui#655
No description provided.