Skip to content

Anti aliasing - always a boolean#51

Merged
gselzer merged 8 commits intopyapp-kit:mainfrom
gselzer:anti-aliasing
Mar 2, 2026
Merged

Anti aliasing - always a boolean#51
gselzer merged 8 commits intopyapp-kit:mainfrom
gselzer:anti-aliasing

Conversation

@gselzer
Copy link
Copy Markdown
Collaborator

@gselzer gselzer commented Feb 25, 2026

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):

  • Points
  • Line
  • Text

Previously, only Points carried anti-aliasing state - the parameter Points.antialiasing was a float because:

  • VisPy's Markers nodes have a antialias: float
  • pygfx PointsMaterial uses a bool.

This on its own might warrant using a float, but considering that:

  • both vispy and pygfx use a boolean for lines
  • pygfx uses a boolean for Text
  • vispy doesn't have a dedicated antialiasing parameter for text,

I'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).

VisPy uses an int and pygfx uses a boolean. Until someone wants that int
for VisPy let's just use a boolean for simplicity.
@gselzer gselzer self-assigned this Feb 25, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.77%. Comparing base (2d5ea31) to head (4d86c5a).
⚠️ Report is 2 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@gselzer gselzer marked this pull request as ready for review February 26, 2026 15:56
@gselzer
Copy link
Copy Markdown
Collaborator Author

gselzer commented Feb 26, 2026

@tlambert03 any quick opinions here on the anti-aliasing boolean fields? (In-depth review also welcome but probably unnecessary)

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 antialias in Points and Line from float to bool, and add antialias: bool to Text.
  • Update vispy/pygfx adaptors to consume boolean antialiasing (including vispy Markers float mapping and pygfx material aa wiring).
  • Update adaptor tests and add a new examples/antialiasing.py demonstration.

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.

Comment thread tests/adaptors/_vispy/test_line.py Outdated
Comment thread examples/antialiasing.py
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@gselzer gselzer merged commit d821224 into pyapp-kit:main Mar 2, 2026
34 checks passed
@gselzer gselzer deleted the anti-aliasing branch March 2, 2026 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants