[Top][All Lists]

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

Re: image-transform.el and image-mode.el rewrite

From: Wolfgang Jenkner
Subject: Re: image-transform.el and image-mode.el rewrite
Date: Fri, 19 Jul 2013 13:52:16 +0200
User-agent: Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.3.50 (gnu/linux)

On Fri, Jul 19 2013, Vitalie Spinu wrote:

> +;; these are 3, virtuly unchenged, objects from old image-mode.el
> +;; fixme: see the author


> +           ;; on GNU Emacs (i686-pc-linux-gnu, X toolkit, Xaw
> +           ;; scroll bars) of 2013-07-16, image width is slightly
> +           ;; truncated, ~6px, so the below mambo math for .5px
> +           ;; adjustment is pretty useless.

The rotation stuff is written in such a a way that fit-width
(resp. fit-height) produces a rotated image whose bounding-box, with the
roundings applied by ImageMagick, viz.

> +;;      geometry.x = (ssize_t) floor(min.x-0.5);
> +;;      geometry.y = (ssize_t) floor(min.y-0.5);
> +;;      geometry.width=(size_t) ceil(max.x-geometry.x+0.5);
> +;;      geometry.height=(size_t) ceil(max.y-geometry.y+0.5);

has _exactly_ the desired pixel width (resp. height), and there's an
assertion in image-mode which tests this.

So, except for this

> +(defvar image--right-angle-fudge 0.0001
> +  "Snap distance to a multiple of a right angle.
> +There's no deep theory behind the default value, it should just
> +be somewhat larger than ImageMagick's MagickEpsilon.")

everything is exact math without fudge factors.

In particular, thing's won't be quite correct if you do

> +              ;; VS[16-07-2013]: returning (w . h) is unnecessary, it
> +              ;; distorts the image and processing becomes very slow


reply via email to

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