Complete _ColorMatrix filter and ShapeStyle support - #985
Conversation
| /// component. You can use the matrix for tasks like creating a color | ||
| /// transformation ``GraphicsContext/Filter`` for a ``GraphicsContext`` using | ||
| /// the ``GraphicsContext/Filter/colorMatrix(_:)`` method. | ||
| @available(OpenSwiftUI_v3_0, *) |
There was a problem hiding this comment.
This availability annotation leaves the existing _ColorMatrix.init(_ m: ColorMatrix) declaration with only _ColorMatrix's OpenSwiftUI_v2_0 availability while its parameter type is now OpenSwiftUI_v3_0. Builds that honor the package availability macros can reject that declaration as referencing ColorMatrix before it is available.
Severity: medium
🤖 Was this useful? React with 👍 or 👎
| guard levels.lowerBound != levels.upperBound else { | ||
| break | ||
| } | ||
| shape.stylePack[name, levels.lowerBound] = .init(.vibrantMatrix(self)) |
There was a problem hiding this comment.
The new _ColorMatrix ShapeStyle implementation is not exercised by the added tests, which cover matrix construction, filters, and protobuf but not the .prepareText or .resolveStyle paths. A regression in the foregroundKeyColor result or the .vibrantMatrix pack write would pass this PR's coverage.
Severity: medium
🤖 Was this useful? React with 👍 or 👎
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #985 +/- ##
==========================================
- Coverage 26.84% 26.74% -0.11%
==========================================
Files 732 733 +1
Lines 54056 54303 +247
==========================================
+ Hits 14514 14522 +8
- Misses 39542 39781 +239 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Summary
_ColorMatrixconstruction from colors and supportedGraphicsFiltercases, including premultiplied handling.ShapeStylebehavior, and full 20-element protobuf encoding and decoding.Motivation
_ColorMatrixstill had incomplete color, filter, and shape-style behavior, while protobuf serialization covered only part of the matrix. This prevented callers from consistently converting supported graphics filters and preserving complete matrix values.Testing
ColorMatrixDualTestspass against the SwiftUI 6.5 compatibility runtime.