Skip to content

Reinoldrojas/grid brush offset setting

Adds horizontal and vertical offset settings for the grid brush as requested here.

some notes:

  • an offset that is a multiple of the corresponding grid height/width is equivalent to setting an offset of 0
  • Since the farthest offset you can have from the grid is gridhHeight/2 ( any more than that and you are now more inline with the cell one block over) offsets that are greater than gridHeight/2 will wrap back around to the other end of the original cell. This also makes the brush outline a more accurate representation of which cell you are drawing on. You'll never be more than half a cell away from the cell that is drawn.
  • The range of possible offsets is -250 to +250. This gives a combined total possible offset of 500, half of the maximum grid height/width of 999. While this allows for any possible offset for any size grid this does cause the bars to be kinda hard to use with a mouse. Should this be shortened ((to maybe +/-100) to make it easier to use?

Test Plan

Generally open the brush editor on a grid brush and try different vertical/horizontal offsets. Cases that I think are good to try:

  1. set offsets to -1 and confirm the grid is offset by 1
  2. set offsets to the same value as grid height/width and confirm grids overlap
  3. set offsets to half of grid height/width and confirm this is farthest offset for the grid ( half an ellipse away)
  4. set gridwidth to 20. Set horizontal offset to 11 and draw a stroke. Set horizontal offset to -9 and draw stroke. These two should be on the same grid. This should work generally so that gridwidth = abs(offset1) + abs(offset2) and gridWidth > offset1 + offset2

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.

Merge request reports