From: Eli Zaretskii <eliz@gnu.org>
To: emacs-devel@gnu.org,mituharu@math.s.chiba-u.ac.jp
Subject: Re: Scale transformation of images
Date: Sun, 16 Jun 2019 10:54:09 +0300 [thread overview]
Message-ID: <0D0F17C4-E0E1-46B0-A838-12DB00C9984C@gnu.org> (raw)
In-Reply-To: <febb95415944134cdb5fecddea42da18.squirrel@weber.math.s.chiba-u.ac.jp>
On June 16, 2019 9:45:56 AM GMT+03:00, mituharu@math.s.chiba-u.ac.jp 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. This is because
> > image_set_size does this:
> >
> > double xscale = img->width / (double) width;
> >
> > and similarly for yscale. Shouldn't we divide width by img->width
> > instead?
>
> No. Documentation of cairo_pattern_set_matrix and its example
> would help you understand what's happening:
> https://www.cairographics.org/manual/cairo-cairo-pattern-t.html
>
> Important: Please note that the direction of this
> transformation matrix is from user space to pattern space. 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.
>
> For example, if you want to make a pattern appear twice as
> large as it does by default the correct code to use is:
>
> 1 cairo_matrix_init_scale (&matrix, 0.5, 0.5);
> 2 cairo_pattern_set_matrix (pattern, &matrix);
>
> Meanwhile, using values of 2.0 rather than 0.5 in the code
> above would cause the pattern to appear at half of its default
> size.
Thanks. So you are saying that in the equations presented by Richard in https://lists.gnu.org/archive/html/emacs-devel/2019-06/msg00361.html the matrix Fij is the inverse of the matrix computed in image_set_transform, is that right?
next prev parent reply other threads:[~2019-06-16 7:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-16 6:16 Scale transformation of images Eli Zaretskii
2019-06-16 6:45 ` mituharu
2019-06-16 7:54 ` Eli Zaretskii [this message]
2019-06-16 8:10 ` mituharu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0D0F17C4-E0E1-46B0-A838-12DB00C9984C@gnu.org \
--to=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=mituharu@math.s.chiba-u.ac.jp \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).