-
Notifications
You must be signed in to change notification settings - Fork 543
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
Improve Rectangle
's handling of border and clipping
#1988
Comments
I checked and it has the right size, looking at your screenshot in an image editor, the border radius is about 40 pixels, which is matching the It is, in fact all the other renderers which are wrong as the actual radius is increased with the border size |
…order The current implementation of the software renderer doesn't drawn the background under the border, so if the border is translusent, we don't see the background color. This patch blend the color of the border with the coler of the background. Software renderer part of #1988 (minus clipping)
…order The current implementation of the software renderer doesn't drawn the background under the border, so if the border is translusent, we don't see the background color. This patch blend the color of the border with the coler of the background. Software renderer part of #1988 (minus clipping)
We didn't reach conclusion yet, but i think:
As for the clip, it all depends on whether we want to apply #110. If we want to say that the default border-width is 1px, then the clip shouldn't take the border into account. But in a sense, i think it makes more sense to take the border into account. |
In the light of our target audience and the principle of least surprise, I, too, think that we should pick this option. That's also what you implemented in #2078, right?
Another option here would be to let |
…order The current implementation of the software renderer doesn't drawn the background under the border, so if the border is translusent, we don't see the background color. This patch blend the color of the border with the coler of the background. Software renderer part of #1988 (minus clipping)
Also fix the border radius to be the outer radius of the rectangle Qt renderer part of #1988 (minus clipping)
Don't rely on the pen not being set when drawing the background of a rectangle with transparent border. On my machine with the test case the pen has some other color from previous drawing (or Qt internal?).
Don't rely on the pen not being set when drawing the background of a rectangle with transparent border. On my machine with the test case the pen has some other color from previous drawing (or Qt internal?).
Status in current master: Remaining problems:
|
The
Rectangle
element has aborder-width
andborder-colour
property, as well as aclip
property. How the border of a rectangle is draw in relation to the background of the Rectangle, as well as how the clipping applies in relation to the border is different between different renderers. In this issue we'd like to outline the current differences and discuss what the correct behavior should be, so that we can fix all of the renderers to produce the same output.Suppose the following test-case:
The first rectangle's border and clipping is what we would like to discuss. The second rectangle serves the purpose of visualising the clipping with regards to the border, and the third rectangle shows the effective external bounds of the first rectangle.
The following screenshots show the "current" state as of commit aea216f:
FemtoVG:
![Screenshot 2022-12-14 at 15 31 09](https://user-images.githubusercontent.com/1486/207622811-56c6af55-edff-4cb3-a7ef-a059343bc57c.png)
Skia:
![Screenshot 2022-12-14 at 15 31 32](https://user-images.githubusercontent.com/1486/207622904-3a28b910-d38d-4575-8235-0595ac2c1685.png)
Qt:
![Screenshot 2022-12-14 at 15 31 54](https://user-images.githubusercontent.com/1486/207623000-b7492245-7cd8-45a3-b7ce-177b45a11244.png)
Software renderer:
![Screenshot 2022-12-14 at 15 33 35](https://user-images.githubusercontent.com/1486/207623418-a0b0b27c-458d-4ee6-8d47-8e331f3d884e.png)
It's a known issue that the software renderer doesn't do rounded clipping and that the border radius has the wrong size.
The two choices we're wondering about and are seeking feedback on are:
Border and Background
FemtoVG, Skia, and Qt show a purple area, which shows that in these the background is drawn first and it extends into the area of the border.
The two possibilities that we're thinking of are
Border and Clipping
The green rectangle is sometimes clipped within the blue area, sometimes half-way within the border, and sometimes entirely on the outside.
Should the
clip
property on the rectangle clip children within the the border or within the bounds of the rectangle?The text was updated successfully, but these errors were encountered: