implement free angled guides
@jsbueno
Submitted by João Sebastião de Oliveira Bueno Link to original bug (#344109)
Description
Ok, I've got this lying around for over an year now - way past time I pasteed it here.
When I started doing this, I thought on real drawing boards, for technical drawing. One "big" feature they have is the ability of doing 30, 45, 60 degree fined angles with the help of squares. So with Free angled guides one get a ruler at a precise angle to line up things at "any angle" in gimp drawings.
Another motivation I had is that...other drawing programs do not have this, and I love seeing unique features in the GIMP, or any other free-software projects!
And , yes, I had also thought on being able to freely rotatte an image view (there is an old featrue request open for that), and I thought "what would happen to the guides in these situations". Now I know the answer.
The big patch I am attaching here implements working "Free" guides - that is, image guides that can have an arbitrary angle other than horizontal and vertical.
(And yes, I updated the modifications after Bill changed the guides to become gimpobjects today - so the patch is working)
how to use: I had not implemented a UI for these. There is a pdb call for "gimp-image-add-free-guide", and I hacked the image->guides->new guide scm to make use of it ("Free" is listed in the orientations)
Known Issues:
- There is an assertion warning - new after the guides became gimpobjects, should be a trivial fix
- I had naively used "GIMP_ORIENTATION_UNKNOWN" instead of creating a new "GIMP_ORIENTATION_FREE" enum for this. This is the main motive I had benn postponing posting this patch for such a long time
- When rescaling the image and changing its aspect ratio, the behavior is not the one expected (also easy to fix)
- I never looked at app/xcf to even begin figuring out how to save the "angle" property I had added. I guess it will be saved by default now guides are gimpobjects, but probably there are compatibility issues with "non angled" guides stored in exiting xcf's.
Missing Features:
- A UI. I guess cloning the behavior of the move tool towards guides in the rotate tool code would be the most intuitive UI for these. As it is now, it could just become an "easter egg" feature.
- As I listed above: saving! (maybe it is saving now. I had not tested)
Ok...test, enjoy, and please, if you like it, fixing some of the above would not be bad.
--
Version: git master