Skip to content

Draft: Free transform bounding box rotation

Stuffins requested to merge stuffins/krita:stuffins/bounds-rotate into master

This is my attempt so far at implementing this feature request. Here's a video example of it working in krita.

I wrapped SC * S with a boundsRotation and its inverse, and solve for a new SC * S any time that rotation changes to keep the final transform the same. This doesn't always have a solution and when m11 of the desired matrix nears 0 the other values will blow up (e.g. scale x ~0% and scale y >10000%), but it seems usable despite that?

There's no recalculating the extents of the image along the new axes, so it just fits around the original bounding box and isn't as tight as it could be.

altModifierActive is never true in setTransformFunction, so it's using shift for now instead. But I'd like to use alt so shift can snap, and not be ambiguous with snapping normal rotation.

I haven't touched or tested transform masks or animation, but I'd like to think normalizing boundsRotation to 0 could make those work without needing to persist that field or make it animateable.

Is this a good approach?

Merge request reports