all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Richard Copley <rcopley@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Stefan Monnier <monnier@iro.umontreal.ca>,
	Emacs Development <emacs-devel@gnu.org>
Subject: Re: Image transformations
Date: Fri, 14 Jun 2019 16:55:39 +0100	[thread overview]
Message-ID: <CAPM58ohhdRFhH-uQeB83sjYac_bOU6XxSScic_33WgUAG_uEOA@mail.gmail.com> (raw)
In-Reply-To: <837e9oxm5f.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 4948 bytes --]

On Fri, 14 Jun 2019 at 15:44, Eli Zaretskii <eliz@gnu.org> wrote:

    > From: Richard Copley <rcopley@gmail.com>
    > Date: Fri, 14 Jun 2019 13:49:52 +0100
    > Cc: Stefan Monnier <monnier@iro.umontreal.ca>, Emacs Development <
emacs-devel@gnu.org>
    >
    >       http://winapi.freetechsecrets.com/win32
    >
    >     According to it, GM_ADVANCED is not supported on Windows 9X.
    >
    > Is it important to support such advanced features there?

    I'd like to support there what can be supported.  Which means
    everything except rotations.

OK. (I meant to thank you for the link, in my previous message. It got lost
in
editing. Thanks!) The matrix representation wouldn't cause a problem here.
Since
we would disallow applying a rotation or shear, we would be sure that the
matrix
had no rotation or shear component, and it would not be too hard to derive
the
rectangular transformation from the matrix components.

    >     That might work, and doesn't really
    >     contradict what I say above, but we should first make sure that
all
    >     the toolkits we support interpret the matrix the same.
    >
    > They don't, but the differences are small platform-specific fixups
    > (possibly inverting and/or transposing the matrix, as well as
    > converting the values to the appropriate types). The mathematical
    > fundamentals are the same for all the platforms.

    The mathematical fundamentals are the same, but if we interpret the
    Lisp-level matrix as only some platforms do, Lisp programmers whose
    background is from the rest of the platforms will likely become
    confused and will make mistakes.

OK. We would have the advantage of good documentation, as always.

    IOW, I consider complex platform-specific interfaces generally
    unsuitable for being exposed on the Lisp level.

OK, but I don't think homogeneous coordinates are platform specific,
or any more complex than necessary.

    >     > Thirdly, the homogeneous matrix is compact and uniform, and
makes
    >     > it easy to compose and invert (undo) transformations.
    >
    >     So are/do the attributes.
    >
    > I think you're underestimating the difficulty of that part. Here's a
    > concrete example. Suppose the user wants to apply two
    > transformations,
    >
    > 1. Stretch by factor 2 in the x direction, then rotate clockwise by
    > 45 degrees, then translate to the right by 100 pixels.
    >
    > 2. Stretch by factor 0.5 in the x direction, then rotate clockwise
    > by 90 degrees, then translate left by 100 pixels.
    >
    > Calculating the resulting matrix might be a little tricky to get
    > right, but with some experimentation you'll get there. Calculating
    > the resulting shear, rotation, scale and translation is much more
    > difficult to conceptualize.

    I don't see why.  We have :width and :height for stretching in a
    single direction, and :scale for stretching in both.  Translation is
    impossible anyway, because we can only place images by adjusting
    buffer contents and using various layout features like :align-to.

OK. And :rotation? And :shear, since combining stretches and rotations will
allow arbitrary shearing transformations?

I'm imagining allowing these transformations to be composed in any order,
which would be nice for interactive use (a key for rotating, a key for
stretching horizontally, and so on). If we don't want to support that
then yes, you're right, we can calculate the resulting attributes
from one stretch followed by one rotation (or whatever), easily enough.

    >     Which representation is more compact is
    >     arguable: for example, the matrix representation of a rotation is
much
    >     more wasteful than just a single angle of rotation parameter.
    >
    > I didn't say "more compact".

    You said "compact and uniform".

Not "more compact".

    >     But I think this is a tangent, because my proposal doesn't
preclude
    >     providing a matrix-based API in the future.
    >
    > It will make it difficult to preserve backward compatibility.
Constructing
    > the :crop, :rotate, etc., from the matrix, is hard.

    I don't see why someone will need to deconstruct a matrix, so I don't
    think this problem should bother us.

OK. As long as you don't propose allowing composing the simple
transformations,
including rotations, in any order, then you won't need to do that, indeed.

I'm not writing this just to be a thorn in your side. I worry the model
you're
presenting might lead to difficulties that have already been overcome
elsewhere.
But it's probable I have overestimated how much generality you're proposing
to
support.

I like the idea Yuri described. It's as powerful and easier to use. As far
as I
can see there would still be a homogeneous matrix on the implementation
side,
though, with the accompanying variations for each platform, so perhaps it
doesn't overcome your reservations.

[-- Attachment #2: Type: text/html, Size: 5984 bytes --]

  reply	other threads:[~2019-06-14 15:55 UTC|newest]

Thread overview: 84+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-11  5:10 Image transformations Eli Zaretskii
2019-06-11 20:02 ` Alan Third
2019-06-12 15:30   ` Eli Zaretskii
2019-06-12 22:07     ` Alan Third
2019-06-12 22:15       ` Alan Third
2019-06-13  4:16       ` Alp Aker
2019-06-13  5:41         ` Eli Zaretskii
2019-06-13  9:19           ` Alp Aker
2019-06-13 13:05             ` Eli Zaretskii
2019-06-13 15:57               ` Alp Aker
2019-06-13 16:20                 ` Eli Zaretskii
2019-06-13 19:00                   ` Richard Copley
2019-06-13 19:29                     ` Eli Zaretskii
2019-06-14 10:45                     ` Alp Aker
2019-06-14 10:55                       ` Richard Copley
2019-06-14 11:45                         ` YAMAMOTO Mitsuharu
2019-06-14 11:59                         ` Alp Aker
2019-06-13 16:12           ` Alan Third
2019-06-13 17:05             ` Eli Zaretskii
2019-06-13 19:35               ` Richard Copley
2019-06-13  5:48       ` Eli Zaretskii
2019-06-13 16:58         ` Alan Third
2019-06-13 17:11           ` Eli Zaretskii
2019-06-13 19:27             ` Alan Third
2019-06-13 19:39               ` Alan Third
2019-06-13 19:47               ` Eli Zaretskii
2019-06-13 22:26                 ` Alan Third
2019-06-14  7:05                   ` Eli Zaretskii
2019-06-14  9:57                     ` Stefan Monnier
2019-06-14 10:57                       ` Eli Zaretskii
2019-06-14 11:21                         ` Richard Copley
2019-06-14 12:06                           ` Eli Zaretskii
2019-06-14 12:49                             ` Richard Copley
2019-06-14 14:16                               ` Yuri Khan
2019-06-14 14:43                               ` Eli Zaretskii
2019-06-14 15:55                                 ` Richard Copley [this message]
2019-06-15 11:00                                   ` Alan Third
2019-06-15 11:34                                     ` Eli Zaretskii
2019-06-15 10:42                     ` Alan Third
2019-06-15 11:31                       ` Eli Zaretskii
2019-06-16 15:22                         ` Alan Third
2019-06-16 16:34                           ` Eli Zaretskii
2019-06-17 21:13                             ` Alan Third
2019-06-19 17:56                               ` Eli Zaretskii
2019-06-24 17:54                               ` Eli Zaretskii
2019-06-24 19:50                                 ` Stefan Monnier
2019-06-25  2:33                                   ` Eli Zaretskii
2019-06-25  3:28                                     ` Stefan Monnier
2019-06-25  4:34                                       ` Eli Zaretskii
2019-06-25 14:43                                         ` Stefan Monnier
2019-06-25 15:35                                           ` Eli Zaretskii
2019-06-26  0:28                                             ` YAMAMOTO Mitsuharu
2019-06-26 15:34                                               ` Eli Zaretskii
2019-06-27  3:37                                                 ` YAMAMOTO Mitsuharu
2019-06-27 13:13                                                   ` Eli Zaretskii
2019-06-25 18:33                                 ` Alan Third
2019-06-25 18:57                                   ` Eli Zaretskii
2019-06-27 13:59                                     ` Eli Zaretskii
2019-06-28 18:36                                       ` Alan Third
2019-06-28 19:50                                         ` Eli Zaretskii
2019-06-29 11:55                                           ` Eli Zaretskii
2019-06-29 19:51                                             ` Alan Third
2019-06-29 19:49                                           ` Alan Third
2019-06-29 19:53                                             ` Lars Ingebrigtsen
2019-06-30 14:38                                               ` Alan Third
2019-06-30 15:24                                                 ` Lars Ingebrigtsen
2019-07-25 19:40                                                   ` Lars Ingebrigtsen
2019-07-26  6:10                                                     ` Eli Zaretskii
2019-07-26  6:46                                                       ` Lars Ingebrigtsen
2019-07-26  8:06                                                         ` Eli Zaretskii
2019-07-26  8:23                                                           ` Lars Ingebrigtsen
2019-07-26  8:24                                                             ` Lars Ingebrigtsen
2019-07-26  8:33                                                               ` Eli Zaretskii
2019-07-26  8:58                                                                 ` Lars Ingebrigtsen
2019-07-26  9:13                                                                   ` Eli Zaretskii
2019-07-26 10:23                                                                     ` Lars Ingebrigtsen
2019-07-26 14:08                                                                   ` Stefan Monnier
2019-07-26  8:32                                                             ` Eli Zaretskii
2019-06-29 21:05                                             ` Stefan Monnier
2019-06-30 15:12                                             ` Eli Zaretskii
2019-06-30 19:10                                               ` Alan Third
2019-07-01 14:55                                                 ` Eli Zaretskii
2019-06-18 11:01                       ` Tak Kunihiro
2019-06-13 17:41           ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAPM58ohhdRFhH-uQeB83sjYac_bOU6XxSScic_33WgUAG_uEOA@mail.gmail.com \
    --to=rcopley@gmail.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.