Subject: Re: bug#47095: [PATCH] Add support for image mirroring (Bug#47095)

From: Alan Third <[email-masked]>
Date: Sun, 2 Jan 2022 14:54:52 +0000

On Wed, Dec 29, 2021 at 11:10:03AM +0200, Timo Taipalus wrote:
> On 28.12.2021 13:22, Alan Third wrote:
> > Is it possible to do the mirroring before the rotation instead of as
> > part of it? I feel like it would make the code a little clearer,
> > although I suspect you're doing it in the rotation to reduce the
> > number of calculations? Would it be possible to have both horizontal
> > and vertical mirroring?
> 
> As said elsewhere, "r" is reserved for rotation. :)
> 
> I added an elisp function to do a vertical flip. Also I renamed the
> procedure flipping because that's what GIMP calls it. Attached is a
> revised patch to replace the previous one.
> 
> As for the C code, I agree it adds some complexity to the transform
> function, but this is probably the fastest way to achieve it.
> 
> Flipping before rotation would lead to strange results when the image
> has been rotated 90/270 degrees. Then the flip commands seem reversed
> – horizontal flip actually flips vertically and vice versa. This is
> because the transform function always rotates the initial image,
> which is what would be flipped.

That's actually what I'd expect to happen, tbh. :)

There's a bit of a problem with Emacs image manipulation, IMO, in that
the transform order is baked in, so we end up with strange situations
like when you set max-width, then rotate 90 degrees so now max-width
affects the height of the image instead of the width.

So whatever, I don't feel very strongly about it.

One more thing: do you feel up to adding a note in the manual about
this new property? It should go in doc/lispref/display.texi. Look for
rotation.

> Hopefully someone can test this patch on Windows.

Indeed. If nobody tests it in a week or so we can try just pushing it
to master and hope someone reports a bug if it doesn't work.
-- 
Alan Third