Anti aliasing - always a boolean#51
Conversation
VisPy uses an int and pygfx uses a boolean. Until someone wants that int for VisPy let's just use a boolean for simplicity.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #51 +/- ##
==========================================
+ Coverage 87.73% 87.77% +0.03%
==========================================
Files 62 62
Lines 2838 2846 +8
==========================================
+ Hits 2490 2498 +8
Misses 348 348 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@tlambert03 any quick opinions here on the anti-aliasing boolean fields? (In-depth review also welcome but probably unnecessary) |
There was a problem hiding this comment.
Pull request overview
Unifies the antialias API across Points, Line, and Text nodes by making it a boolean in the model layer, and wires the new behavior through both vispy and pygfx adaptors with corresponding test updates.
Changes:
- Change
antialiasinPointsandLinefromfloattobool, and addantialias: booltoText. - Update vispy/pygfx adaptors to consume boolean antialiasing (including vispy Markers float mapping and pygfx material
aawiring). - Update adaptor tests and add a new
examples/antialiasing.pydemonstration.
Reviewed changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/adaptors/_vispy/test_text.py | Adds antialias to Text fixture construction. |
| tests/adaptors/_vispy/test_points.py | Updates points AA tests to boolean model + vispy float mapping. |
| tests/adaptors/_vispy/test_line.py | Refactors line tests and adds AA coverage (vispy backend). |
| tests/adaptors/_pygfx/test_text.py | Adds AA test for pygfx text material. |
| tests/adaptors/_pygfx/test_points.py | Updates points AA tests to boolean model. |
| tests/adaptors/_pygfx/test_line.py | Refactors line tests and adds AA coverage (pygfx backend). |
| src/scenex/model/_nodes/text.py | Introduces Text.antialias: bool. |
| src/scenex/model/_nodes/points.py | Changes Points.antialias to boolean with updated description. |
| src/scenex/model/_nodes/line.py | Changes Line.antialias to boolean. |
| src/scenex/adaptors/_vispy/_text.py | Adds _snx_set_antialias as a no-op (vispy text AA not tunable). |
| src/scenex/adaptors/_vispy/_points.py | Maps boolean AA to vispy Markers float (1.0/0.0). |
| src/scenex/adaptors/_vispy/_line.py | Passes and updates line AA as boolean. |
| src/scenex/adaptors/_pygfx/_text.py | Wires Text.antialias to TextMaterial.aa and updates setter. |
| src/scenex/adaptors/_pygfx/_points.py | Wires Points.antialias directly to material aa and updates setter. |
| src/scenex/adaptors/_pygfx/_line.py | Wires Line.antialias directly to material aa and updates setter. |
| src/scenex/adaptors/_base.py | Updates adaptor protocol signatures to boolean antialias where applicable. |
| examples/basic_points.py | Removes explicit backend selection in the example. |
| examples/basic_line.py | Fixes a comment (“mesh intersection” → “line intersection”). |
| examples/antialiasing.py | Adds a new AA toggle demonstration example. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This PR fleshes out the anti-aliasing field applicable to a few different node types (it'll be a draft until they're all done):
PointsLineTextPreviously, only
Points carried anti-aliasing state - the parameterPoints.antialiasingwas afloatbecause:Markersnodes have aantialias: floatPointsMaterialuses abool.This on its own might warrant using a
float, but considering that:TextI'm thinking it's best to be uniform with
bools across the field for now. (Note that I started looking into this because I really wanted antialiased text in pygfx).