Re: [csswg-drafts] [css-shapes-2][css-borders-4] Add a way to change an element's shape (#6997)

> I understand the motivation for the single path syntax taking its widths from border-width, but I think in practice this is going to be pretty hard to implement.

Is this a limitation of CoreGraphics or a more general issue? To my knowledge, Skia is okay with variable-width strokes (@fserb ?).

> I don't think this will work very well if you apply it to boxes with different aspect ratios; the author would have a hard time matching gradient points with the box corners.

Yeah, this is definitely a special-case "one specific box" sort of thing, which doesn't make me very happy. We need *something* to control this, tho; even if you fall back to the two-path syntax, you'd then need to do a one-off fill image, which is just as wonky.

The only other suggestion I would have is being able to match up the widths/colors with the path *commands* (or rather, between the commands), either with a separate list that has a 1:1 correspondence, or inserting them directly into the shape() syntax. I lean toward the latter; we can just say that contexts that aren't stroking the path would ignore that information (or if they're stroking it but doing a stroke fill some other way, they'd ignore the color info).

That way, you could reproduce a rounded-rect with 8 path commands, as normal, and just place the desired border-width/color before/after each straight-line path; the corner arcs would interpolate. Or, of course, do something else, like in [this example](https://github.com/w3c/csswg-drafts/issues/9072#issuecomment-2266056782) (where the angled corners take the color of one of the sides, rather than being half-colored by each side).

We already might want to put in corner-rounding controls into shape() between commands (rather than always requiring them to be communicated separately, and applying equally to all corners), so I think this fits in quite naturally.

> Using border colors, you'd get:

What's determining the angle/position of the color change there? It can't just be radial lines from the center, as that would mean the three sharp corners would only look right if the border-width ratios happened to match the box's own aspect ratio.

-- 
GitHub Notification of comment by tabatkins
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/6997#issuecomment-2389668268 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Wednesday, 2 October 2024 20:47:01 UTC