Skip to content

SweepGradientBrush implementation - #11977

Draft
miloush wants to merge 6 commits into
dotnet:mainfrom
miloush:SweepGradientBrush
Draft

miloush wants to merge 6 commits into
dotnet:mainfrom
miloush:SweepGradientBrush

Conversation

@miloush

@miloush miloush commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Implements SweepGradientBrush, see API proposal #11962

Description

This is a new brush required by COLRv1 fonts.

Testing

Tested locally, but I don't want to finalize this without DRT against Direct2D reference.

The angle follows WPF convention of being clock-wise, which is the opposite of OpenType. Some degenerate cases also lean towards consistency with other WPF brushes rather than OpenType spec. The code building geometry from fonts is expected to create the brush as appropriate.

Microsoft Reviewers: Open in CodeFlow

@dotnet-policy-service dotnet-policy-service Bot added PR metadata: Label to tag PRs, to facilitate with triage Community Contribution A label for all community Contributions draft labels Sep 28, 2026
DUCE.CopyBytes((byte*)&data.StartAngle, (byte*)&tempStartAngle, 8);
data.hStartAngleAnimations = hStartAngleAnimations;
double tempEndAngle = EndAngle;
DUCE.CopyBytes((byte*)&data.EndAngle, (byte*)&tempEndAngle, 8);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You wouldn't want to use CopyBytes in 2016+ code over a simple assignment.

I understand which file it came from, so just saying 😀

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I tried to match the existing code as much as possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Community Contribution A label for all community Contributions draft PR metadata: Label to tag PRs, to facilitate with triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants