From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Scale transformation of images Date: Sun, 16 Jun 2019 10:54:09 +0300 Message-ID: <0D0F17C4-E0E1-46B0-A838-12DB00C9984C@gnu.org> References: <8475F4F0-00E8-44A9-BD60-6D3894E86EB0@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="176799"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: K-9 Mail for Android To: emacs-devel@gnu.org,mituharu@math.s.chiba-u.ac.jp Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jun 16 09:54:51 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 1hcQ03-000js5-16 for ged-emacs-devel@m.gmane.org; Sun, 16 Jun 2019 09:54:51 +0200 Original-Received: from localhost ([::1]:37990 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hcQ02-0005To-3G for ged-emacs-devel@m.gmane.org; Sun, 16 Jun 2019 03:54:50 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52911) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hcPzS-0005TW-O5 for emacs-devel@gnu.org; Sun, 16 Jun 2019 03:54:15 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:52519) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hcPzR-0002dR-Pb; Sun, 16 Jun 2019 03:54:13 -0400 Original-Received: from [176.12.186.179] (port=50647 helo=[10.165.107.76]) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1hcPzR-0002xC-49; Sun, 16 Jun 2019 03:54:13 -0400 In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] 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:237716 Archived-At: On June 16, 2019 9:45:56 AM GMT+03:00, mituharu@math=2Es=2Echiba-u=2Eac=2Ej= p wrote: > > If I insert an image into a buffer with insert-image, and then > position > > point on the image and press '-' to make it smaller, the scale > factors I > > see in the transform matrix are greater than 1=2E This is because > > image_set_size does this: > > > > double xscale =3D img->width / (double) width; > > > > and similarly for yscale=2E Shouldn't we divide width by img->width > > instead? >=20 > No=2E Documentation of cairo_pattern_set_matrix and its example > would help you understand what's happening: > https://www=2Ecairographics=2Eorg/manual/cairo-cairo-pattern-t=2Ehtml >=20 > Important: Please note that the direction of this > transformation matrix is from user space to pattern space=2E This > means that if you imagine the flow from a pattern to user > space (and on to device space), then coordinates in that flow > will be transformed by the inverse of the pattern matrix=2E >=20 > For example, if you want to make a pattern appear twice as > large as it does by default the correct code to use is: >=20 > 1 cairo_matrix_init_scale (&matrix, 0=2E5, 0=2E5); > 2 cairo_pattern_set_matrix (pattern, &matrix); >=20 > Meanwhile, using values of 2=2E0 rather than 0=2E5 in the code > above would cause the pattern to appear at half of its default > size=2E Thanks=2E So you are saying that in the equations presented by Richard in= https://lists=2Egnu=2Eorg/archive/html/emacs-devel/2019-06/msg00361=2Ehtml= the matrix Fij is the inverse of the matrix computed in image_set_transfor= m, is that right?