[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#69602: 29.1; Image :map should adjust with :scale and :rotation
From: |
Eli Zaretskii |
Subject: |
bug#69602: 29.1; Image :map should adjust with :scale and :rotation |
Date: |
Thu, 07 Mar 2024 11:27:53 +0200 |
> From: Joseph Turner <joseph@breatheoutbreathe.in>
> Cc: 69602@debbugs.gnu.org, stephen.berman@gmx.net, juri@linkov.net
> Date: Thu, 07 Mar 2024 00:08:57 -0800
>
>
> Eli Zaretskii <eliz@gnu.org> writes:
>
> >> > Note that the map's coordinates should reflect the displayed image
> >> > after all transforms have been done (rotation, scaling and so on),
> >> > and also note that Emacs (by default) performs auto-scaling of
> >> > images, so to make things match up, you should either specify
> >> > ‘:scale 1.0’ when creating the image, or use the result of
> >> > ‘image-compute-scaling-factor’ to compute the elements of the map.
> >> >
> >> > Can this technique help?
> >>
> >> Thank you for your help!
> >>
> >> When the user runs `image-increase-size', where should third-party code
> >> recompute :map to fit the new image scale?
> >>
> >> There's no `image-after-change-size-hook' nor `image-after-rotate-hook'.
> >
> > I think the idea is to define the value of :map such that it runs
> > image-compute-scaling-factor as part of computing the coordinates of
> > the map.
>
> Sorry, I don't understand.
I hoped :map allows its value to be a form that is evaluated when the
image is being processed, in which case that form could call
image-compute-scaling-factor when it produces the coordinates.
If that doesn't work, then...
> When creating an image, we set its :map property according to the return
> value of `image-compute-scaling-factor'. Once the image is inserted into
> the buffer, the user may run `image-increase-size' or `image-rotate',
> which changes how the image is displayed but not its :map.
>
> Now, we need to rerun `image-compute-scaling-factor' and recompute :map.
> However, there is no hook which runs after the user runs those commands,
> so AFAICT there's no way for our code to know when to recompute :map.
...AFAIU, when an image is rescaled, we call
image-transform-properties to produce the updated image properties.
So I guess you'd like that function to recompute the coordinates in
:map according to the transform?
IOW, I don't understand why you think the problem can only be solved
in C: AFAIK almost all of the machinery that performs image transforms
is implemented in Lisp, and each time an image is rescaled, we
basically re-process the image descriptor anew.
- bug#69602: 29.1; Image :map should adjust with :scale and :rotation, Joseph Turner, 2024/03/07
- bug#69602: 29.1; Image :map should adjust with :scale and :rotation, Eli Zaretskii, 2024/03/07
- bug#69602: 29.1; Image :map should adjust with :scale and :rotation, Joseph Turner, 2024/03/07
- bug#69602: 29.1; Image :map should adjust with :scale and :rotation, Eli Zaretskii, 2024/03/07
- bug#69602: 29.1; Image :map should adjust with :scale and :rotation, Joseph Turner, 2024/03/07
- bug#69602: 29.1; Image :map should adjust with :scale and :rotation,
Eli Zaretskii <=
- bug#69602: 29.1; Image :map should adjust with :scale and :rotation, Joseph Turner, 2024/03/07
- bug#69602: 29.1; Image :map should adjust with :scale and :rotation, Joseph Turner, 2024/03/08
- bug#69602: 29.1; Image :map should adjust with :scale and :rotation, Eli Zaretskii, 2024/03/08
- bug#69602: 29.1; Image :map should adjust with :scale and :rotation, Joseph Turner, 2024/03/08
- bug#69602: 29.1; Image :map should adjust with :scale and :rotation, Eli Zaretskii, 2024/03/08
- bug#69602: 29.1; Image :map should adjust with :scale and :rotation, Joseph Turner, 2024/03/21
- bug#69602: 29.1; Image :map should adjust with :scale and :rotation, Eli Zaretskii, 2024/03/21
- bug#69602: 29.1; Image :map should adjust with :scale and :rotation, Joseph Turner, 2024/03/22
- bug#69602: 29.1; Image :map should adjust with :scale and :rotation, Eli Zaretskii, 2024/03/23
- bug#69602: 29.1; Image :map should adjust with :scale and :rotation, Joseph Turner, 2024/03/23