GNU bug report logs - #47095
27.1; Feature request: mirror image display

Previous Next

Package: emacs;

Reported by: ynyaaa <at> gmail.com

Date: Fri, 12 Mar 2021 10:35:01 UTC

Severity: wishlist

Found in version 27.1

Fixed in version 29.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 47095 in the body.
You can then email your comments to 47095 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#47095; Package emacs. (Fri, 12 Mar 2021 10:35:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to ynyaaa <at> gmail.com:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 12 Mar 2021 10:35:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: ynyaaa <at> gmail.com
To: bug-gnu-emacs <at> gnu.org
Subject: 27.1; Feature request: mirror image display
Date: Fri, 12 Mar 2021 19:34:29 +0900
Emacs can not display mirror images.
At least horizontal/vertical mirror images are required.
It is ideal to support +45/-45 degrees axis mirroring.


In GNU Emacs 27.1 (build 1, x86_64-w64-mingw32)
 of 2020-08-22 built on CIRROCUMULUS
Repository revision: 86d8d76aa36037184db0b2897c434cdaab1a9ae8
Repository branch: HEAD
Windowing system distributor 'Microsoft Corp.', version 10.0.18363
System Description: Microsoft Windows 10 Pro (v10.0.1909.18363.1379)

Recent messages:

Configured using:
 'configure --without-dbus --host=x86_64-w64-mingw32
 --without-compress-install 'CFLAGS=-O2 -static''

Configured features:
XPM JPEG TIFF GIF PNG RSVG SOUND NOTIFY W32NOTIFY ACL GNUTLS LIBXML2
HARFBUZZ ZLIB TOOLKIT_SCROLL_BARS MODULES THREADS JSON PDUMPER LCMS2 GMP

Important settings:
  value of $LANG: JPN
  locale-coding-system: cp932

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(gnutls network-stream nsm mailalias smtpmail auth-source cl-seq eieio
eieio-core cl-macs eieio-loaddefs json map jka-compr help-fns radix-tree
cl-print debug backtrace find-func ispell misearch multi-isearch mailcap
help-mode pp shadow sort mail-extr emacsbug message rmc puny dired
dired-loaddefs format-spec rfc822 mml easymenu mml-sec password-cache
epa derived epg epg-config gnus-util rmail rmail-loaddefs
text-property-search time-date subr-x seq byte-opt gv bytecomp
byte-compile cconv mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader cl-loaddefs cl-lib sendmail rfc2047
rfc2045 ietf-drums mm-util mail-prsvr mail-utils term/bobcat japan-util
tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type
mwheel dos-w32 ls-lisp disp-table term/w32-win w32-win w32-vars
term/common-win tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode elisp-mode lisp-mode
prog-mode register page tab-bar menu-bar rfn-eshadow isearch timer
select scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame minibuffer cl-generic cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms
cp51932 hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese composite charscript charprop case-table epa-hook
jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice loaddefs
button faces cus-face macroexp files text-properties overlay sha1 md5
base64 format env code-pages mule custom widget hashtable-print-readable
backquote threads w32notify w32 lcms2 multi-tty make-network-process
emacs)

Memory information:
((conses 16 76064 16835)
 (symbols 48 8874 6)
 (strings 32 24646 2231)
 (string-bytes 1 792768)
 (vectors 16 14199)
 (vector-slots 8 275047 18288)
 (floats 8 28 292)
 (intervals 56 1942 0)
 (buffers 1000 18))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#47095; Package emacs. (Mon, 27 Dec 2021 17:07:01 GMT) Full text and rfc822 format available.

Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Timo Taipalus <timo <at> taipalus.cc>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] Add support for image mirroring (Bug#47095)
Date: Mon, 27 Dec 2021 10:36:43 +0200
[Message part 1 (text/plain, inline)]
It seems image-mode does not have capability for image mirroring, so
here's a patch for it.  Tested NS (macOS) and XRender/Cairo
implementations.  As it is, it has no effect if ImageMagick is
enabled.

I chose 'h' as the action key because 'm' and 'f' were reserved, and
'h' is easy to memorize ("horizontal").
[0001-Add-support-for-image-mirroring-Bug-47095.patch (text/x-diff, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#47095; Package emacs. (Tue, 28 Dec 2021 01:02:02 GMT) Full text and rfc822 format available.

Message #11 received at 47095 <at> debbugs.gnu.org (full text, mbox):

From: Po Lu <luangruo <at> yahoo.com>
To: Timo Taipalus <timo <at> taipalus.cc>
Cc: 47095 <at> debbugs.gnu.org
Subject: Re: bug#47095: 27.1; Feature request: mirror image display
Date: Tue, 28 Dec 2021 09:01:12 +0800
Timo Taipalus <timo <at> taipalus.cc> writes:

> It seems image-mode does not have capability for image mirroring, so
> here's a patch for it.  Tested NS (macOS) and XRender/Cairo
> implementations.  As it is, it has no effect if ImageMagick is
> enabled.

Can you try to make it work on Haiku?  If you can't, no problems there
(I will do that myself), but if you can it would make my life a little
bit easier.

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#47095; Package emacs. (Tue, 28 Dec 2021 09:55:02 GMT) Full text and rfc822 format available.

Message #14 received at 47095 <at> debbugs.gnu.org (full text, mbox):

From: Timo Taipalus <timo <at> taipalus.cc>
To: Po Lu <luangruo <at> yahoo.com>
Cc: 47095 <at> debbugs.gnu.org
Subject: Re: bug#47095: 27.1; Feature request: mirror image display
Date: Tue, 28 Dec 2021 11:54:44 +0200
On 28.12.2021 3:01, Po Lu wrote:
> Timo Taipalus <timo <at> taipalus.cc> writes:
> 
>> It seems image-mode does not have capability for image mirroring, so
>> here's a patch for it.  Tested NS (macOS) and XRender/Cairo
>> implementations.  As it is, it has no effect if ImageMagick is
>> enabled.
> 
> Can you try to make it work on Haiku?  If you can't, no problems there
> (I will do that myself), but if you can it would make my life a little
> bit easier.
> 
> Thanks.

Unfortunately I have no experience with Haiku.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#47095; Package emacs. (Tue, 28 Dec 2021 10:08:02 GMT) Full text and rfc822 format available.

Message #17 received at 47095 <at> debbugs.gnu.org (full text, mbox):

From: Po Lu <luangruo <at> yahoo.com>
To: Timo Taipalus <timo <at> taipalus.cc>
Cc: 47095 <at> debbugs.gnu.org
Subject: Re: bug#47095: 27.1; Feature request: mirror image display
Date: Tue, 28 Dec 2021 18:07:06 +0800
Timo Taipalus <timo <at> taipalus.cc> writes:

> On 28.12.2021 3:01, Po Lu wrote:
>> Timo Taipalus <timo <at> taipalus.cc> writes:
>> 
>>> It seems image-mode does not have capability for image mirroring, so
>>> here's a patch for it.  Tested NS (macOS) and XRender/Cairo
>>> implementations.  As it is, it has no effect if ImageMagick is
>>> enabled.
>> Can you try to make it work on Haiku?  If you can't, no problems
>> there
>> (I will do that myself), but if you can it would make my life a little
>> bit easier.
>> Thanks.
>
> Unfortunately I have no experience with Haiku.

Sure, when this is installed I'll implement it.

Thanks anyway.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#47095; Package emacs. (Tue, 28 Dec 2021 11:23:01 GMT) Full text and rfc822 format available.

Message #20 received at 47095 <at> debbugs.gnu.org (full text, mbox):

From: Alan Third <alan <at> idiocy.org>
To: Timo Taipalus <timo <at> taipalus.cc>
Cc: 47095 <at> debbugs.gnu.org
Subject: Re: bug#47095: [PATCH] Add support for image mirroring (Bug#47095)
Date: Tue, 28 Dec 2021 11:22:11 +0000
On Mon, Dec 27, 2021 at 10:36:43AM +0200, Timo Taipalus wrote:
> It seems image-mode does not have capability for image mirroring, so
> here's a patch for it.  Tested NS (macOS) and XRender/Cairo
> implementations.  As it is, it has no effect if ImageMagick is
> enabled.

I suspect this won't work at all on windows due to the way the
transform is implemented there, but someone should probably check.

> I chose 'h' as the action key because 'm' and 'f' were reserved, and
> 'h' is easy to memorize ("horizontal").

'r' for reverse, maybe?

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?

-- 
Alan Third




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#47095; Package emacs. (Tue, 28 Dec 2021 18:10:01 GMT) Full text and rfc822 format available.

Message #23 received at 47095 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Alan Third <alan <at> idiocy.org>, Timo Taipalus <timo <at> taipalus.cc>
Cc: "47095 <at> debbugs.gnu.org" <47095 <at> debbugs.gnu.org>
Subject: RE: [External] : bug#47095: [PATCH] Add support for image mirroring
 (Bug#47095)
Date: Tue, 28 Dec 2021 18:09:46 +0000
> > I chose 'h' as the action key because 'm' and 'f' were reserved, and
> > 'h' is easy to memorize ("horizontal").
> 
> 'r' for reverse, maybe?

(Sorry, I'm not following this thread.
Please ignore if my comment is OT or
otherwise irrelevant.)

But if this is about mirroring in the
sense of flipping an image horizontally
around its vertical midline, then `h'
makes sense (and it is used in some
image-display programs).  Similarly,
if we have vertical mirroring then it
makes sense to use `v' for that.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#47095; Package emacs. (Wed, 29 Dec 2021 09:11:02 GMT) Full text and rfc822 format available.

Message #26 received at 47095 <at> debbugs.gnu.org (full text, mbox):

From: Timo Taipalus <timo <at> taipalus.cc>
To: Timo Taipalus <timo <at> taipalus.cc>
Cc: 47095 <at> debbugs.gnu.org
Subject: Re: bug#47095: [PATCH] Add support for image mirroring (Bug#47095)
Date: Wed, 29 Dec 2021 11:10:03 +0200
[Message part 1 (text/plain, inline)]
On 28.12.2021 13:22, Alan Third wrote:
> On Mon, Dec 27, 2021 at 10:36:43AM +0200, Timo Taipalus wrote:
>> It seems image-mode does not have capability for image mirroring, so
>> here's a patch for it.  Tested NS (macOS) and XRender/Cairo
>> implementations.  As it is, it has no effect if ImageMagick is
>> enabled.
> 
> I suspect this won't work at all on windows due to the way the
> transform is implemented there, but someone should probably check.
> 
>> I chose 'h' as the action key because 'm' and 'f' were reserved, and
>> 'h' is easy to memorize ("horizontal").
> 
> 'r' for reverse, maybe?
> 
> 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.

Hopefully someone can test this patch on Windows.
[0001-Add-support-for-image-flipping-Bug-47095.patch (text/x-diff, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#47095; Package emacs. (Sun, 02 Jan 2022 14:56:02 GMT) Full text and rfc822 format available.

Message #29 received at 47095 <at> debbugs.gnu.org (full text, mbox):

From: Alan Third <alan <at> idiocy.org>
To: Timo Taipalus <timo <at> taipalus.cc>
Cc: 47095 <at> debbugs.gnu.org
Subject: Re: bug#47095: [PATCH] Add support for image mirroring (Bug#47095)
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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#47095; Package emacs. (Tue, 04 Jan 2022 10:26:01 GMT) Full text and rfc822 format available.

Message #32 received at 47095 <at> debbugs.gnu.org (full text, mbox):

From: Alan Third <alan <at> idiocy.org>
To: Timo Taipalus <timo <at> taipalus.cc>, 47095 <at> debbugs.gnu.org
Subject: Re: bug#47095: [PATCH] Add support for image mirroring (Bug#47095)
Date: Tue, 4 Jan 2022 10:25:36 +0000
On Sun, Jan 02, 2022 at 02:54:52PM +0000, Alan Third wrote:
> On Wed, Dec 29, 2021 at 11:10:03AM +0200, Timo Taipalus wrote:
> > 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.

Oh, I forgot to check, do you have the copyright paperwork on file
with the FSF?
-- 
Alan Third




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#47095; Package emacs. (Wed, 05 Jan 2022 16:15:02 GMT) Full text and rfc822 format available.

Message #35 received at 47095 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Alan Third <alan <at> idiocy.org>
Cc: Timo Taipalus <timo <at> taipalus.cc>, 47095 <at> debbugs.gnu.org
Subject: Re: bug#47095: [PATCH] Add support for image mirroring (Bug#47095)
Date: Wed, 05 Jan 2022 17:14:14 +0100
Alan Third <alan <at> idiocy.org> writes:

>> 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.
>
> Oh, I forgot to check, do you have the copyright paperwork on file
> with the FSF?

I don't see the name in the copyright.list file.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#47095; Package emacs. (Fri, 07 Jan 2022 17:02:02 GMT) Full text and rfc822 format available.

Message #38 received at 47095 <at> debbugs.gnu.org (full text, mbox):

From: Timo Taipalus <timo <at> taipalus.cc>
To: Alan Third <alan <at> idiocy.org>
Cc: 47095 <at> debbugs.gnu.org
Subject: Re: bug#47095: [PATCH] Add support for image mirroring (Bug#47095)
Date: Fri, 07 Jan 2022 19:00:59 +0200
[Message part 1 (text/plain, inline)]
On 2.1.2022 16:54, Alan Third wrote:
> 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.

In my experience the way flipping works now is how image viewers 
generally work. But I
guess neither is the one true way, the way it works now is my 
preference. If many do feel
strongly about it, then it can be changed I guess.

> 
> 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.
> 

I added documentation as requested plus code comments.

The paperwork was sent on 26th Dec to assign <at> gnu.org, so admins please 
check there.
[0001-Add-support-for-image-flipping-Bug-47095_rev_3.patch (text/x-diff, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#47095; Package emacs. (Fri, 24 Jun 2022 12:46:01 GMT) Full text and rfc822 format available.

Message #41 received at 47095 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Timo Taipalus <timo <at> taipalus.cc>
Cc: Alan Third <alan <at> idiocy.org>, 47095 <at> debbugs.gnu.org
Subject: Re: bug#47095: 27.1; Feature request: mirror image display
Date: Fri, 24 Jun 2022 14:45:20 +0200
Timo Taipalus <timo <at> taipalus.cc> writes:

> The paperwork was sent on 26th Dec to assign <at> gnu.org, so admins please
> check there.

The paperwork was finished in February, apparently, but then we forgot
to apply the patch.

So I've now tested the patch, and it seems to work great.  Now pushed to
Emacs 29.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug marked as fixed in version 29.1, send any further explanations to 47095 <at> debbugs.gnu.org and ynyaaa <at> gmail.com Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Fri, 24 Jun 2022 12:46:01 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 23 Jul 2022 11:24:12 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 278 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.