GNOME Bugzilla – Bug 344109
implement free angled guides
Last modified: 2018-05-24 11:50:27 UTC
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)
- 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.
- 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.
Created attachment 66874 [details] [review]
Patch implementing Freely oreinted guides
Duplicate of bug #125865 ?
Please change M_PI_2 to G_PI_2, remove the change to app/display/gimpdisplayshell-appearance.c from your patch and revert the incompatible Script-Fu change.
Then, we probably need to use another enum value than ORIENTATION_UNKNOWN and we have to fix XCF saving and the UI. Something to look at after GIMP 2.4, I'd say.
Created attachment 67080 [details] [review]
This patch compiles after the modifications related to the gimp_objectfication of the guides. Does nto address any of the issues above yet, it jsut compiles and works.
I suggest that we postpone this change to GIMP 2.6. It is a nice feature, but it probably requires more changes to properly support free angled guides all over the place and I am afraid that we might introduce new bugs if we push this in for 2.4.
Just for cross-reference, the feature request mentioned above for a rotated view of the image is in bug #55367. The angled guides could solve some of the problems described there, but not all. For example, it would be possible to create rotated rectangular selections (using the path tool along the guides, not the rect select).
Rotated rectangular selections are easily created using the rectangle selection tool and the rotate tool. But that's not really relevant here. We need to come to a decision. My proposal is to bump to 2.6.
You are proposing this since comment 3. As far as I am concerned, the feature is mostly complete, and the suspicions in comment #5 are mostly unfounded - I've tried then hardly, and the only incomplete issue regarding these guides usage within the program is with the image scaling operation.
I won't say that we should rush then into 2.4, but everything that is missing is documented here. It is not much, and it is certainly a lot less fun to work on them knowing they will not be in an stable gimp for 8 months or an year.
In the meantime I had created another enum - GIMP_ORIENTATION_FREE, and a special canvas style intended to be used when they are on a descending angle - so it won't be a continuous line at -45 deg.
I introduced a glitch in the process of gobjectfying the guides as well - they are not showing when they are created now (just on canvas/guides updates), I was looking to fix this before posting another patch.
Created attachment 68100 [details] [review]
We need to draw at some point and you started to work on this well after the tentative feature freeze for 2.4. Let's get this into CVS right after 2.4 is released.
That should have read "We need to draw a line at some point...", of course.
Joao this looks very interesting I must say! But IMHO we should replace the trigonometry hacks with vector math instead. The code will be much more natural and maintainable then.
Will this be put to SVN? By look of things it should have been there already after 2.4 and we are now well into freeze for 2.6
Are you sure you read comment #12? The patch is not ready for SVN yet.
-- GitLab Migration Automatic Message --
This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.
You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gimp/issues/194.