After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 344109 - implement free angled guides
implement free angled guides
Product: GIMP
Classification: Other
Component: General
git master
Other All
: Normal enhancement
: Future
Assigned To: GIMP Bugs
Depends on:
Reported: 2006-06-07 05:38 UTC by Joao S. O. Bueno
Modified: 2018-05-24 11:50 UTC
See Also:
GNOME target: ---
GNOME version: ---

Patch implementing Freely oreinted guides (31.85 KB, patch)
2006-06-07 05:39 UTC, Joao S. O. Bueno
none Details | Review
updated patch (32.31 KB, patch)
2006-06-10 08:10 UTC, Joao S. O. Bueno
none Details | Review
updated patch (36.65 KB, patch)
2006-06-28 04:10 UTC, Joao S. O. Bueno
needs-work Details | Review

Description Joao S. O. Bueno 2006-06-07 05:38:12 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)

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.

Comment 1 Joao S. O. Bueno 2006-06-07 05:39:42 UTC
Created attachment 66874 [details] [review]
Patch implementing Freely oreinted guides
Comment 2 Sven Neumann 2006-06-07 06:06:37 UTC
Duplicate of bug #125865 ?
Comment 3 Sven Neumann 2006-06-07 06:40:39 UTC
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.
Comment 4 Joao S. O. Bueno 2006-06-10 08:10:32 UTC
Created attachment 67080 [details] [review]
updated patch

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.
Comment 5 Sven Neumann 2006-06-23 10:59:10 UTC
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.
Comment 6 Raphaël Quinet 2006-06-23 14:58:59 UTC
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).
Comment 7 Sven Neumann 2006-06-27 18:20:32 UTC
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.
Comment 8 Joao S. O. Bueno 2006-06-28 03:57:21 UTC
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.
Comment 9 Joao S. O. Bueno 2006-06-28 04:10:04 UTC
Created attachment 68100 [details] [review]
updated patch
Comment 10 Sven Neumann 2006-06-28 06:36:53 UTC
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.
Comment 11 Sven Neumann 2006-06-29 17:36:37 UTC
That should have read "We need to draw a line at some point...", of course.
Comment 12 Martin Nordholts 2008-03-29 21:11:19 UTC
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.
Comment 13 Alexia Death 2008-08-08 19:19:58 UTC
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
Comment 14 Martin Nordholts 2008-08-09 04:04:46 UTC
Are you sure you read comment #12? The patch is not ready for SVN yet.
Comment 15 GNOME Infrastructure Team 2018-05-24 11:50:27 UTC
-- 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: