-
Notifications
You must be signed in to change notification settings - Fork 8.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement background image over acrylic or solid color #1107
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might also conflict with some work being done in #1092, as a heads up
@@ -312,9 +326,10 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation | |||
} | |||
else if (!_settings.BackgroundImage().empty()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure this will update the background image+acrylic scenario properly - looks like it'll only update the acrylic in that scenario
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it will only update the acrylic in this scenario, however, it is intended to do that. This function is for background color only and whenever acrylic is enabled we don't actually draw the solid background layer, we apply the color as acrylic's tint whether or not background image is set
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the logic is just acrylic or not. It becomes a bit confusing because of this workaround.
// Set the default background as transparent to prevent the
// DX layer from overwriting the background image
_settings.DefaultBackground(ARGB(0, R, G, B));
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I'm more thinking: what happens when you change the background image url for a profile that has a background image+acrylic? Does the image change appropriately?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it changes appropriately, although the code for it is around L251 not here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hrm. Does the alpha for the DX renderer ever need to be non-zero?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to clarify my previous response:
- In all cases, the background is drawn in Xaml space by the brush.
- In every case except a solid-color background (with no other modifications), the DX rendering drawing anything over it is erroneous.
- Even in the solid-color background case, the brush drawing the background (as opposed to the DX renderer) is necessary because the DX renderer doesn't draw to the entire window area.
So I'm not sure there's a good reason to have the DX renderer aware of any sort of background information, since it can't "help".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this specific case (Windows Terminal)1, I'm entirely inclined to agree. The default background doesn't need an alpha. @miniksa nominally owns the DX renderer, so he likely has a stronger opinion here.
[1] dxrenderer can be used by conhost, too, and conhost has a slightly different set of rendering requirements
This is interesting, and I never thought about how a user might want a background image with acrylic on top of it. I expected this: but I never expected this: I'm wondering if it's more reasonable to support the first one ( |
The fact that we can set a gif as our background makes some sense for the second case but I agree that we should have a more robust spec. Also to support the first case you mention we need to have a setting for image alignment too. Edit: Actually, blurring a gif is also a relatively easy task. So I am probably inclined to agree with the image on top of acrylic. Exposing the whole background stack to setting seem way overkill IMO. |
That's because they display blurred background and unblurred background in different part simultaneously though. We only display one version of the image at a time, so you can head toward Photoshop and blur the image in 5 seconds if you really want blurry background |
Sounds great to me. I'd love to accept a pull request that put the background on top of the acrylic! |
27d2c94
to
b09b765
Compare
Roger that, I've updated this PR to enable background on top of the acrylic 😄 |
Wow, I never realized that this got updated. So sorry. Force pushes don't send e-mails to the team! |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
This now puts the background on top of the acrylic, yes? Should we update the title? |
Yes we should 😄 |
This solution, unfortunately, causes the image to shift if padding is set, I propose #1778 to fix that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with this.
This has two approvals and 7 successful checks, so I'm going to merge it. @Summon528 thanks for bearing with us and working on this feature! |
🎉 Handy links: |
Summary of the Pull Request
Implement acrylic over background image. Also make backgroundImageOpacity works with respect to the profile's background color
References
PR Checklist
Detailed Description of the Pull Request / Additional comments
Introduce a new root Element that holds the original container and a background image. The root element's background sits behind
_bgImageLayer
and is responsible for acrylic and solid background.