Skip to content

PAINTROID-451: feat: Add Advanced Options (Antialiasing and Smoothing) - #171

Open
this-is-varunxyz wants to merge 13 commits into
Catrobat:developfrom
this-is-varunxyz:feat/advanced-options
Open

PAINTROID-451: feat: Add Advanced Options (Antialiasing and Smoothing)#171
this-is-varunxyz wants to merge 13 commits into
Catrobat:developfrom
this-is-varunxyz:feat/advanced-options

Conversation

@this-is-varunxyz

@this-is-varunxyz this-is-varunxyz commented Jul 7, 2026

Copy link
Copy Markdown
Member

This PR introduces the "Advanced Options" dialog to the workspace overflow menu, allowing users to toggle Antialiasing and Smoothing for drawing tools.

Jira Ticket: PAINTROID-451

New Features and Enhancements

  • Advanced Options UI: Built the AdvancedSettingsDialog accessible via the Top App Bar overflow menu to toggle features, following the ToolOptions state data patterns.
  • State Management: Integrated AdvancedSettingsStateData using Riverpod and Freezed to securely manage the global state of the antialiasing and smoothing toggles.
  • Dynamic Antialiasing Engine: - Intercepted PaintProvider and updated GraphicFactory.copyPaintWith() to conditionally apply isAntiAlias to the global Paint object.
    • Propagated the global antialiasing state to the broader toolset, including Watercolor, Shapes (ShapeDrawingUtils), Line, Spray, and Clipboard tools.
    • Replicated the legacy Native Android 1-pixel edge case (automatically disabling AA if strokeWidth <= 1.0).
  • Real-Time Catmull-Rom Smoothing: Ported the custom legacy spline algorithms (AdvancedSettingsAlgorithms) from Native Kotlin into the Flutter BrushTool.
    • Implemented the speed threshold rule (distance/time) to only activate smoothing on fast strokes.
    • Engineered a Hardware Density Filter (distFromLast < 5.0) in onDrag to safely drop microscopic sub-pixel touch events while keeping the visual rendering loop instant.

Refactorings and Serialization Fixes

  • Paint Serialization: Updated PaintConverter.dart and bumped SerializerVersion.PAINT_VERSION to ensure the user's Anti-aliasing preference is saved cleanly in .catrobat files while maintaining backwards compatibility.
  • Cubic Serialization: Created a custom CubicToAction wrapper inside PathWithActionHistory and updated PathActionConverter.dart to support JSON serialization for 6-coordinate cubic Bezier splines.
  • Memory Architecture Fix: Added a reset() method to PathWithActionHistory to support on-the-fly path reconstruction without triggering "ghost path" artifacts.
  • Test Alignment: Updated Unit and Integration tests ( advanced_settings_state_data_test) to gracefully handle the new distance filters and default true states.

Checklist

Your checklist for this pull request

Please review the contributing guidelines and wiki pages of this repository.

  • Include the name of the Jira ticket in the PR’s title
  • Add the link to the ticket in Jira in the description of the PR
  • Include a summary of the changes plus the relevant context
  • Choose the proper base branch (develop)
  • Confirm that the changes follow the project’s coding guidelines (Wiki)
  • Verify that the changes generate no compiler or linter warnings
  • Perform a self-review of the changes
  • Verify to commit no other files than the intentionally changed ones
  • Include reasonable and readable tests verifying the added or changed behavior
  • Confirm that new and existing tests pass locally
  • Check that the commits’ message style matches the project’s guideline
  • Verify that your changes do not have any conflicts with the base branch
  • After the PR, verify that all CI checks have passed
  • Add new information to the Wiki

@this-is-varunxyz
this-is-varunxyz marked this pull request as ready for review August 23, 2026 22:40
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.

1 participant