Repository navigation
Conversation
Contributor
|
Merged into main with you as the author of all three commits: 2e163b7, 1fb7b0e and 5bccbcb. It ships in 0.2.4. Thank you. Review found things in the mask that I fixed on top, in 2895626, 3cfbb72 and 410bcb2:
Two limits stay, and AGENTS.md says so: a resize that moves a masked picture masks again at each step, a whole pass over its pixels on the main thread; and an animated picture shows its first frame under a mask. Closing, since the commits are in main. |
4 of 6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
[FEATURE REQUEST] Background: a picture's own opacity, and a mask over it
Type
What and why
A background picture can now fade where it paints: by its own opacity, and by a mask that fades it across its box, as CSS's
mask-imagedoes. The window's Background opacity keeps doing what it did — the whole window's ground and picture — while the picture's own opacity fades only the picture, so a picture can sit lightly over the theme's ground.Settings › Appearance › Background gains, after the gradient's rows:
background_image_opacity).background_mask) with an angle in degrees, 0 upward and turning clockwise (background_mask_angle), two to sixteen stops, comma separated (background_mask_stops), whose alpha is the mask, and the mask's own box: a size (background_mask_size) and a place (background_mask_position), as CSS'smask-sizeandmask-position.The picture's opacity applies to every tile. The mask fades a picture that does not repeat, since a repeated picture's tiles would cut the fade; it is drawn by scaling the fourth byte of gpui's straight BGRA pixels, the alpha, through the picture's place in its box, and only inside the mask's box — a pixel outside it stays clear. Masked copies are kept by image, mask and box, four at most, so a frame does not mask again.
validate()refuses an opacity outside 0 to 1, an angle outside 0 to 360 and a stops list that does not read, so a bad settings file stops the start, as any other out-of-range value does.How it was tested
upstream/maina0c01b6after PR3 merged as8ff412c, then69080d7 T176; the branch carries three commits:9b2a0a2(opacity and mask),1afce3f(the mask's size and position) and3e7a84c(the hints).cargo build,cargo fmt --all -- --checkclean,cargo clippy --all-targets -- -D warningsclean.cargo test --lib wallpaper::: 9 passed (the mask's alpha, its box, and a box smaller than its picture leaving the rest clear);settings::tests::a_mask…anda_picture…: 3 passed. The full suite fails on this machine's sandbox in the tests that write a temp folder (they panic atsrc/files/tests.rs:11,fs::create_dir_all) and in the known shell and registry tests, which fail the same way onmain.src/settings/mask.rs(each_stop_is_a_color,the_angle_fades_across_the_box,the_stops_share_the_way_evenly),src/settings/tests.rs::a_mask_and_the_pictures_opacity_keep_their_figures,src/workspace/wallpaper/mask.rs(the_mask_fades_the_pictures_alpha,a_mask_box_leaves_the_picture_outside_it_clear,a_mask_box_keeps_its_place_and_size).100% 100%, placecenterand stopstransparent, transparent, black: the picture fades in from the window's left edge to full at its right, over the theme's ground (target/pr4c/mask.png). With size40% 100%and placeright top, the picture stays inside the window's right 40% and everything outside that box is clear (target/mask-pos/mask-right-top.png).Screenshots
Checklist
PRD.md,AGENTS.md,tasks/acceptance.mdanddocs/en_us|zh_cn/features.mdsay what this does.background_imageand an old settings file still loads.main; PR3 is merged there.