emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Image transformations


From: Alan Third
Subject: Re: Image transformations
Date: Thu, 13 Jun 2019 17:58:04 +0100
User-agent: Mutt/1.12.0 (2019-05-25)

On Thu, Jun 13, 2019 at 08:48:48AM +0300, Eli Zaretskii wrote:
> > Date: Wed, 12 Jun 2019 23:07:46 +0100
> > From: Alan Third <address@hidden>
> > Cc: address@hidden
> > 
> > > > +Cropping is performed after scaling but before rotation.
> > > 
> > > This sounds strange to me; are you sure?  I'd expect cropping to be
> > > done either before everything else or after everything else.  Is this
> > > so because that's how XRender does it?  At the very least, it begs the
> > > question whether the parameters of :crop are measured in units before
> > > or after scaling.
> > 
> > I agree, but this is how our imagemagick code does it and I didn’t
> > want to make my code behave differently, even though I think it makes
> > no sense.
> 
> OK, but what about the question regarding the units of :crop
> parameters -- should they be interpreted as before or after the
> scaling?

After the scaling.

> > > Can you please add the equations used to perform this affine
> > > transformation, i.e. how x' and y' are computed from x and y?  I think
> > > it will go a long way towards clarifying the processing.
> > 
> > I’ll add some further explanations of how to use the affine
> > transformation matrices, but I don’t know that I’ll be able to do a
> > very good job of explaining exactly how they work. I would suggest
> > that if someone is interested they look it up elsewhere, however I
> > also don’t think it’s necessary to fully understand the maths to be
> > able to use them.
> 
> I have shown my interpretation of the equations.  Trouble is, I cannot
> find what XRender does anywhere.  Does someone know where to look for
> that?

I suspect we’d have to dive into the code to see exactly what XRender
is doing, however from my own testing I believe the transform matrix
passed into XRender works exactly as described here:

https://en.wikipedia.org/wiki/Transformation_matrix#Affine_transformations

I can’t find a great explanation of how exactly transformation matrices
work, but there are a lot of explanations available.

> > Luckily we don’t have to worry about the last step as the graphics
> > toolkit will do it for us.
> 
> Unfortunately, I do have to worry about all of the steps, because I
> need to figure out how to map all this to the equivalent Windows APIs.
> Thus my questions, for which I apologize.  I'd prefer that someone
> more knowledgeable about graphics programming did the changes on
> Windows, but no one stepped forward yet.

You shouldn’t really have to fully understand the maths to implement
this, so clearly we’re going wrong somewhere.

Can you point me to the Windows API documentation and perhaps I can
work out how exactly we need to approach this?
-- 
Alan Third



reply via email to

[Prev in Thread] Current Thread [Next in Thread]