Skip to content

T1624 - Rotation and other transforms for patterns.

Wolthera van Hövell requested to merge wolthera/T1624-pattern-rotation into master

As discussed in T1624, and based of the proof of concept here, this patch introduces per-pixel rotation for patterns using the perspective transform worker.

Pattern rotation and scaling has been a long standing feature request, and figuring this out appropriately has been a blocker for svg patterns. Previous attempts were always focusing on getting a new pattern from rotations applied to an old pattern, which caused all sorts of issues in regards to tiling, in retrospect this may have been overengineering out of fear that it'd be too slow otherwise. By using per-pixel transformation we can surprisingly quickly apply anything QTransform can map to a patterned block, furthermore, this uses largely existing functionality that was in Krita already.

image

TODO

Investigate better UI

  • Better rotation slider
  • Investigate which other QTransform options people would like to see exposed.

Implement in all places we use patterns

  • Fill Layer
  • Fill tool
  • Pattern overlay? (only expose scale here)
  • Geometric shapes pattern fill.
  • Brush texture option Should be a different MR
  • Vectors -- maybe a different MR altogether?

Test Plan

Make a fill layer with a pattern. Tweak the new rotation slider. Keep in mind that you will need to create and confirm the fill layer first due to resource rewrite shenenigans.

Formalities Checklist

  • I confirmed this builds.
  • I confirmed Krita ran and the relevant functions work.
  • I tested the relevant unit tests and can confirm they are not broken. (If not possible, don't hesitate to ask for help!)
  • I made sure my commits build individually and have good descriptions as per KDE guidelines.
  • I made sure my code conforms to the standards set in the HACKING file.
  • I can confirm the code is licensed and attributed appropriately, and that unattributed code is mine, as per KDE Licensing Policy.
Edited by Wolthera van Hövell

Merge request reports