From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Alan Third Newsgroups: gmane.emacs.devel Subject: Re: Image transformations Date: Thu, 13 Jun 2019 17:58:04 +0100 Message-ID: <20190613165804.GB11266@breton.holly.idiocy.org> References: <9A21DE14-BB5F-426E-BBB2-19C87930E733@gnu.org> <20190611200233.GA80199@breton.holly.idiocy.org> <83imta95z0.fsf@gnu.org> <20190612220746.GA89208@breton.holly.idiocy.org> <834l4u11dr.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="219136"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mutt/1.12.0 (2019-05-25) Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jun 13 19:37:03 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hbTep-000uqx-AT for ged-emacs-devel@m.gmane.org; Thu, 13 Jun 2019 19:37:03 +0200 Original-Received: from localhost ([::1]:42548 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hbTeo-0001fj-91 for ged-emacs-devel@m.gmane.org; Thu, 13 Jun 2019 13:37:02 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58530) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hbT3h-0004fi-IY for emacs-devel@gnu.org; Thu, 13 Jun 2019 12:58:43 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hbT3f-0008N7-E8 for emacs-devel@gnu.org; Thu, 13 Jun 2019 12:58:41 -0400 Original-Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]:36041) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hbT3D-0005ju-98; Thu, 13 Jun 2019 12:58:13 -0400 Original-Received: by mail-wr1-x433.google.com with SMTP id n4so21611158wrs.3; Thu, 13 Jun 2019 09:58:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=LLDKjHCInWfMSS28rdrnTDTQL264pHZ5jt6di+AiJ0Y=; b=QlkGenflOq3Ls6czYM+cyKnwRyeJkK3MHbyfbTQjVnP6vs6nslb30Irl8WvHseTI3+ KU0kMJW+WqLKqEcKkw1JvzszN3VIHDlt4O7zEv/98SyliyCAcc+4cjlETqIn8GluhXCZ zOQADpn6mIiAdtV9Zaw/IkgfyDunZbbtaYeC9CmLpDvaTq+zTHsm3eKyVjvcjF4n4X31 RLOx9Ciz0EeSDRTYQXJfTkJ4OQv3rT5plI28vLYMX2PhoJF0oFA0xAjgNFrLO+d5Hfmo mlsK7EsqE+Qxd7OEKlcqjVwdxGODfSQsO/mb8JHPiUOpa2Hkrgr2zwg/kYr6EhKjRWHR yVNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=LLDKjHCInWfMSS28rdrnTDTQL264pHZ5jt6di+AiJ0Y=; b=BXqQaDedhn3DBU1AuC66Tjm5Hl6LtKDX8vgqdhbjKKr0Lnr8kUKJ4lkI+oQx8RSwIv zgUmZ7xBrGVgfLOkfG6icQ1f2RP8f5b//Zeyv8vmPisq3Xd07PtWTIxY32RPzEhqepPy 4iPKx07gC3DHj688SjJBUOE6ytEfrwJ1zV/wRUL08EPu7Eo5nAk9Q5okuWB2apiQ1gn9 e6JlXQu6eeoXJWHeQ05wn+jikZV498jkkyVeMLggrXvnhc9o0ZPuZ8zNaa23HeNO9PM+ 8r7yOtUq+h8hLy/+CwCmyclFuE9n2BMeW9/pYSoPX98+bp2trKwtTsy+Z/G1X8q6ePS6 fATw== X-Gm-Message-State: APjAAAW/7VRpr9SLoUrg7YLqZOVnqxXlqUfwimPGVAebKrinZogjcthg xXTMC4BWqui6HcZ5ndtzM5r9p0Yg X-Google-Smtp-Source: APXvYqxssy9L6sftqZe/CwLJvUIN2bv+Z3sZdOURnw93bdh6emQ4+ChXlS0kRpqj0FYiv123GektIw== X-Received: by 2002:adf:f8cf:: with SMTP id f15mr46282013wrq.333.1560445087361; Thu, 13 Jun 2019 09:58:07 -0700 (PDT) Original-Received: from breton.holly.idiocy.org (ip6-2001-08b0-03f8-8129-0518-5a78-4fbd-d772.holly.idiocy.org. [2001:8b0:3f8:8129:518:5a78:4fbd:d772]) by smtp.gmail.com with ESMTPSA id c15sm342339wrx.23.2019.06.13.09.58.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Jun 2019 09:58:06 -0700 (PDT) Content-Disposition: inline In-Reply-To: <834l4u11dr.fsf@gnu.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::433 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:237525 Archived-At: 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 > > Cc: emacs-devel@gnu.org > > > > > > +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