-
Notifications
You must be signed in to change notification settings - Fork 8
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
Clarifications for Sweep gradients needed #361
Comments
Ambiguities arise if the extend mode for the ColorLine is pad and the sector from start angle to end angle of the sweep gradient crosses the 0/360 degree angle, for example 315° and 45°. In that regard, it seems we need to be clearer on the drawing order and the mapping from angle to ColorLine coordinate.
Does "start and end" here refer to 0 degres to 360 degrees starting from the positive horizontal x axis? If it does not and refers to start and end angle, then what happens at the other angles? Using a ColorLine with extend mode pad, and color stop If "from start to end" in the spec means start drawing from 0 degrees (option 1 above) to 360 degrees, and stop offset 0 on the color line is aligned with 315°, and 1 is aligned with 45°, what do we paint at 0 degrees? What coordinate on the Color line doe 0 degrees refer to? Do we start with yellow at 0° fading to blue at 45°, then continue with blue until 360°, or do we start with red, draw almost a full circle, then fade from red to yellow from 315° to 0°? |
For defining where do we start and end drawing from, i.e. what is painted, and what is discarded as overlap, we need to also take into account the definitions of |
To summarize, we have at least the following issues:
We've previously used the CSS and other W3C specs (Compositing) as a reference or blueprint. It helps implementors apply similar concepts or even reuse code. The relevant sections are: I suggest to do the following:
The CSS Images Lvl 4 spec describes this behaviour more intuitively in the following note:
This helps understand how the above changes would make the behaviour more consistent with the other gradient types and the definition of As an additional visualisation: |
For reference, updated test cases in https://github.com/googlefonts/color-fonts/pull/99/files - with example renderings in googlefonts/color-fonts#99 (comment) (to be used with caution, work-in-progress). |
Summary from virtual f2f (please correct me if anything from the meeting is inaccurately reflected):
|
https://docs.microsoft.com/en-us/typography/opentype/spec/colr#sweep-gradients
For context, discussion in: BlackFoundryCom/black-renderer#17
I see two main issues:
It's not painted only from "start to end" but it's painted for all rays of the circle from start to (start + 360) degrees. Start is aligned with color stop offset 0, end is aligned with color stop offset 1.
I suggest to remove that or perhaps this whole paragraph? Do we need the definition of the [0,1] range?
The ColorLine rules for extend modes apply, but they do not talk about the [0,1] range, but the defined interval.
In this paragraph, instead we might want to say that the ColorLine extend modes apply for color stops outside the defined interval. Which means, going down to 0 (= start angle) if the ColorLine's first stop offset is > 0, or going up to 360 / ( endAngle - startAngle). What confused me here is: The [0,1] interval is not what is repeated along the circle, the defined interval of the ColorLine defines that.
We may also need to define what happens if the ColorLine stop points + start and end angles would be overlapping along all directions of rays from the center of the sweep outwards.
CC @justvanrossum
The text was updated successfully, but these errors were encountered: