Menu

#58 Preserve aspect ratio when resizing

open
nobody
None
5
2019-12-20
2010-10-06
No

To make the image patch even more useful, I've written this patch to allow the aspect ratio to be preserved when resizing selections. (It doesn't just apply to images.) Simply resize using the right mouse button (button-3) rather than the left mouse button.

This patch should be applied after the enhanced image patch. (Though it'd be easy enough to make the changes to the raw 0.4.5 source directly since it doesn't change any of the image patch related areas.)

Related

Patches: #58

Discussion

  • David Barton

    David Barton - 2010-10-06

    Preserve aspect ratios when resizing selections

     
  • Deepee

    Deepee - 2018-02-26

    Has this patch been applied? I'm using Xournal 0.4.8, and I don't seem to have this functionality.

    Thanks,
    Deepee

     
  • Denis Auroux

    Denis Auroux - 2018-02-26

    No, the patch has not been applied to the official code base. The reason is that in my view, even though this is helpful to many, assigning this feature to button 3 (or any other proposed mechanism such as shift-clicking) is not a good user-interface choice for tablet users, and not particularly intuitive unless one has taken such a habit from extensive use of more advanced graphics editing software (which I do not want to assume of the user).

    You can still apply the patch against the current version of xournal. (might need some adjustment to the line numbers in the code, but otherwise the code itself should still work just the same).

     
    • Deepee

      Deepee - 2018-04-16

      Hi Denis,

      I'm having trouble aligning your patch with the source code in 0.4.8. For instance, I'm looking in xo-paint.c, and I can't find a line with update_cursor_for_resize(pt). Am I missing something?

      Thanks,
      Deepee

       
      • Denis Auroux

        Denis Auroux - 2018-04-16

        Oh, sorry -- the relevant code is now in src/xo-selection.c. So you
        should modify the patch file to say xo-selection.c instead of
        xo-paint.c, and then the line you are looking for is 349 (in the current
        codebase; 348 in the original 0.4.8 release).
        (The other code portion originally from xo-paint.c is also in
        xo-selection.c now, so it should be straightforward after that).

        Sorry for the oversight.
        Denis

         
        • Deepee

          Deepee - 2018-04-17

          Thanks Denis,

          Now I'm having a little trouble compiling the source. Do you know what's going on? I think I have installed all required dependencies.

          deepee@entropy:~/.local/opt/xournal-0.4.8.2016$ ./configure --prefix=/home/deepee/.local
          checking for a BSD-compatible install... /usr/bin/install -c
          checking whether build environment is sane... yes
          checking for a thread-safe mkdir -p... /bin/mkdir -p
          checking for gawk... gawk
          checking whether make sets $(MAKE)... yes
          checking whether make supports nested variables... yes
          checking whether to enable maintainer-specific portions of Makefiles... no
          checking for style of include used by make... GNU
          checking for gcc... gcc
          checking whether the C compiler works... yes
          checking for C compiler default output file name... a.out
          checking for suffix of executables... 
          checking whether we are cross compiling... no
          checking for suffix of object files... o
          checking whether we are using the GNU C compiler... yes
          checking whether gcc accepts -g... yes
          checking for gcc option to accept ISO C89... none needed
          checking whether gcc understands -c and -o together... yes
          checking dependency style of gcc... gcc3
          checking for library containing strerror... none required
          checking for gcc... (cached) gcc
          checking whether we are using the GNU C compiler... (cached) yes
          checking whether gcc accepts -g... (cached) yes
          checking for gcc option to accept ISO C89... (cached) none needed
          checking whether gcc understands -c and -o together... (cached) yes
          checking dependency style of gcc... (cached) gcc3
          checking for ranlib... ranlib
          checking for ar... ar
          checking the archiver (ar) interface... ar
          checking how to run the C preprocessor... gcc -E
          checking for grep that handles long lines and -e... /bin/grep
          checking for egrep... /bin/grep -E
          checking for ANSI C header files... yes
          ./configure: line 5058: syntax error near unexpected token `PACKAGE,'
          ./configure: line 5058: `PKG_CHECK_MODULES(PACKAGE, $pkg_modules)'
          

          Thanks,
          Deepee

           
          • Denis Auroux

            Denis Auroux - 2018-04-17

            Strange... did your ./configure script come from running autogen.sh (or
            similar) ? it should not contain any instance of PKG_CHECK_MODULES, this
            should have been expanded into something else at a previous stage.
            Either it is an issue with your installation of autoconf/automake, or it
            is an issue with xournal's configure.in no longer being current ("works
            for me" on an up to date Fedora, but who knows).

            I'm not sure I know how to debug autoconf/automake issues, so... how
            about getting a clean copy of the configure script that comes packaged
            in xournal-0.4.8.2016.tar.gz, and skipping the autogen.sh stage of the
            process but instead starting directly with the configure command?

            Thanks,
            Denis

             
            • Deepee

              Deepee - 2018-04-17

              Yes, I did run autogen.sh first. I will try starting from a clean configure script and see how it goes.

              Thanks,
              Deepee

               
  • Deepee

    Deepee - 2018-02-26

    Thanks Denis. In the absence of installing the patch, is there any other way to preserve the aspect ratio on resizing?

     
    • Denis Auroux

      Denis Auroux - 2018-02-26

      I'm afraid not. So I should take up this idea again and figure out
      something to do with it.

      Current thinking is that corner resize should 'snap' to preserve aspect
      ratio if the user stays close enough to the correct location, and
      otherwise not preserve; it should be a "one-sided" snap-to-aspect
      feature, so that if e.g. I want to make the selection just a bit wider,
      I can do so by first dragging well outside of the snapping area, then
      return back all the way to the original aspect ratio before snapping
      re-engages. Will try.

      In any case, there is no feature in the current version, so you will
      need to either install this patch or compile/install a new version when
      one becomes available (don't hold your breath).

      Denis

      On 02/26/2018 09:26 AM, Deepee wrote:

      Thanks Denis. In the absence of installing the patch, is there any other
      way to preserve the aspect ratio on resizing?


      [patches:#58] https://sourceforge.net/p/xournal/patches/58/ Preserve
      aspect ratio when resizing

      Status: open
      Group:
      Created: Wed Oct 06, 2010 04:30 PM UTC by David Barton
      Last Updated: Mon Feb 26, 2018 05:12 PM UTC
      Owner: nobody

      To make the image patch even more useful, I've written this patch to
      allow the aspect ratio to be preserved when resizing selections. (It
      doesn't just apply to images.) Simply resize using the right mouse
      button (button-3) rather than the left mouse button.

      This patch should be applied after the enhanced image patch. (Though
      it'd be easy enough to make the changes to the raw 0.4.5 source directly
      since it doesn't change any of the image patch related areas.)


      Sent from sourceforge.net because you indicated interest in
      https://sourceforge.net/p/xournal/patches/58/

      To unsubscribe from further messages, please visit
      https://sourceforge.net/auth/subscriptions/

      --
      Denis Auroux
      UC Berkeley, Department of Mathematics
      817 Evans Hall, Berkeley CA 94720-3840, USA
      auroux@math.berkeley.edu

       

      Related

      Patches: #58

  • Deepee

    Deepee - 2018-02-27

    Thanks Denis. I'm not a tablet user, so I'd be happy with a feature that allows the user to right click on the image and check (or uncheck) "Preserve aspect ratio when resizing".

    Thanks for your work on Xournal, and I will have a go at installing the patch.

    Regards,
    Deepee

     
  • Alon Bar-Lev

    Alon Bar-Lev - 2018-06-01

    we are carrying this patch in Gentoo for long time, can you please address this? Thanks!

     
    • Denis Auroux

      Denis Auroux - 2018-06-01

      Once again, this patch is not going into upstream as is. I for one use
      button 3 as mapping for the selection tools (button 1 for drawing,
      button 2 for erasing), which is the most intuitive setting for tablet
      users with a side button on their pens. With this patch I and other
      users with a similar workflow have to do a counter-intuitive sequence of
      operations to resize freely.

      I plan to be working on a better version of this feature shortly.
      Denis

       
  • Denis Auroux

    Denis Auroux - 2018-06-02

    This feature has been reimplemented differently -- the resizing feature "snaps" to aspect-preserving when resizing by a corner. The selection frame turns red to indicate visually that the aspect ratio is locked.
    This has just been committed to the GIT repository.
    https://sourceforge.net/p/xournal/code/ci/07383c0374c644ca3728c9d1b954ec0fd120bc2d/

    I am aware that if you were using this patch previously, it will now require a little bit more attention to aim the cursor in the correct general area to lock the aspect ratio. Hopefully not too much. But this will also allow tablet and touchscreen users to do aspect-preserving resizes...

    Please test the new feature. Feedback welcome -- does it work for you, is it reasonably intuitive? is the snap too aggressive (engages when you didn't want it to / hard to disengage if engaged by accident) or not enough (too hard to resize with aspect ratio preserved in practice -- for small or for large selection boxes?). (With what type of input: mouse, finger, pen?) (And of course, let me know if you encounter a bug).

    [I am aware that negative resizes can be considered aspect-preserving. This is neither a feature nor a bug.]

    Denis

     
    • Lebowski

      Lebowski - 2019-12-20

      Can't get it working on 0.4.8
      In most tools you use a modifier key to resize while preserving aspect ratio, so for instance press shift and drag to keep ratio, and drag without shift to resize to any size.
      I understand this is inconvenient for tablet users. Do many people use Xournal on tablets?

       

      Last edit: Lebowski 2019-12-20
  • Alon Bar-Lev

    Alon Bar-Lev - 2018-06-03

    thanks!
    we will remove the downstream patch and will report feedback.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.