GraphiteEditor / Graphite

2D vector & raster editor that melds traditional layers & tools with a modern node-based, non-destructive, procedural workflow.
https://graphite.rs
Apache License 2.0
7.3k stars 386 forks source link

Dot grid #1709

Closed adamgerhant closed 1 month ago

adamgerhant commented 3 months ago

Superseded by #1743. This PR wasn't actually merged into master.


Closes #1704

Adds a dot type grid option. Snapping and spacing is the same as the rectangular grid.

Changes:

dots

adamgerhant commented 3 months ago

Closes #1703

Changes:

Note: blocked by #1710 since initial color is not correct.

color_select

adamgerhant commented 3 months ago

Thank you for the input. I will be taking a break from this PR for the next few days while I work on my GSoC proposal. Once that's done I'll continue working on it

adamgerhant commented 2 months ago

I believe all changes should have been made. I removed the Dot grid type, and instead added a Boolean field that tracks whether the grid should be displayed with dots. This also makes it easy to add a dot grid for the Isometric type, if there are plans for that. Just remove the condition for displaying the checkbox, create the display function, and use it accordingly.

I removed the prefixed color methods and used concatenation and remove_prefix accordingly. Currently this PR is blocked by the Color bug, since it starts at #999999 instead of #cccccc. An easy fix could be to replace the hex constant with a Color.

Keavon commented 2 months ago

!build

github-actions[bot] commented 2 months ago
📦 Build Complete for ad78699271b5818cad9136cd91cbedd3b9709dd7
https://725c1a4f.graphite.pages.dev
adamgerhant commented 2 months ago

Performance is very poor for the dot grid. I suppose this is because x_count+y_count lines need to drawn for the rectangle grid, but x_count*y_count circles need to be drawn for the dot grid. Additionally, the .arc call to draw circles is pretty slow. I think the best way to fix this would be to replace the lines with dashed lines, but then the dots will be rectangular. Another method could be to only redraw the circles when the viewport is resized or the color is changed.

Keavon commented 2 months ago

Square 1px pixel grid aligned (no antialiasing) dots would already be the desired appearance. Just be aware that a dotted line might drift if the ratio is a non-integer fraction between the document space and viewport space, so some cleverness might be required to enable the avoidance of antialiasing by staying perfectly grid aligned. Maybe several lines per row/column with different screenspace pixel spacing intervals as the error accumulates between the non-integer fraction ratio and the ratio you need to maintain screenspace grid alignment.

Keavon commented 2 months ago

I'm putting this back to draft status till you have time again to deal with the performance suggestions in my previous comment. But don't focus on this till your other PR is done, since that's the much higher priority feature. Thanks :)

Keavon commented 1 month ago

!build

github-actions[bot] commented 1 month ago
📦 Build Complete for 40312d63d26d868c832e7a3e0d5fa1ee4260acd9
https://6cf8ab59.graphite.pages.dev