From: Eli Zaretskii <eliz@gnu.org>
To: Alan Third <alan@idiocy.org>
Cc: emacs-devel@gnu.org
Subject: Re: Image transformations
Date: Fri, 14 Jun 2019 10:05:46 +0300 [thread overview]
Message-ID: <83o930y7cl.fsf@gnu.org> (raw)
In-Reply-To: <20190613222626.GA12971@breton.holly.idiocy.org> (message from Alan Third on Thu, 13 Jun 2019 23:26:26 +0100)
> Date: Thu, 13 Jun 2019 23:26:26 +0100
> From: Alan Third <alan@idiocy.org>
> Cc: emacs-devel@gnu.org
>
> > I'm beginning to think we should do this on all platforms, and leave
> > the matrix calculation, if needed, to the terminal-specific back-ends
> > (xterm.c, w32term.c, etc.). It sounds like we gain nothing by
> > spilling XRender-specific stuff in image.c and letting all the other
> > platforms adapt.
>
> I think you have a fundamental misunderstanding of how the
> transformation matrix is being used.
That's always possible, although I stared at that code and stepped
through it in a debugger long enough to assume it's not the case.
> It’s not specific to XRender. Aside from a few short‐circuits the
> only XRender specific code is in image_set_transform, and XRender,
> NS and Cairo all have their own code in there, and use the same
> transformation matrix.
The matrix is defined according to XRender, AFAIU. NS and Cairo need
to transpose/invert/etc. the matrix to use it, and so will the
MS-Windows code, IIUC. The matrix fuses the actual primitive
transformations into a construct which we currently don't seem to
understand well, whose only "documentation" is in a tutorial that is
not part of XRender's official docs. From where I'm standing, this is
a scary situation. I believe both Cairo and MS-Windows have a much
clearer official documentation of the related functionality (didn't
try looking for NS docs, but I'd expect to see good documentation
there as well), so clean code could be relatively easily written for
these platforms using the transformation spec's parameters instead of
the matrix.
> We could even use the same matrix with ImageMagick with a bit of work.
I think this would be a wasted effort. There's no need to make all
the implementations use the same matrix, unless they all assign the
same semantics to the matrix -- which doesn't appear to be the case,
at least not as far as this discussion shows.
> If we were to throw out that shared matrix code and put it into each
> backend we would be simply duplicating the code.
I'm not convinced we will end up with a duplication. Certainly, for
rotations by multiples of 90 deg no matrix multiplication is necessary
(though possible) to construct the transform. And in the Windows case
having the original parameters of the transform will make it much
easier to detect the transforms that cannot be supported on older
platforms than it will be by analyzing the matrix.
What I'm suggesting in practice is to move the entire calculation of
the matrix to image_set_transform, instead of communicating the
individual transformations via the matrix that's calculated piecemeal.
Then each port will be able to either use that matrix or do something
different with the transform parameters. Since image_set_transform is
the only caller of image_set_size, image_set_crop, and
image_set_rotation, I see no inherent reasons to return the result of
those primitive transformations in the form of a matrix.
WDYT?
next prev parent reply other threads:[~2019-06-14 7:05 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 [this message]
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
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=83o930y7cl.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=alan@idiocy.org \
--cc=emacs-devel@gnu.org \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).