From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: [PATCH v2] Add native image scaling (bug#33587) Date: Fri, 04 Jan 2019 16:31:41 +0200 Message-ID: <837efk335e.fsf@gnu.org> References: <8336qb3upt.fsf@gnu.org> <20190102211241.GA53734@breton.holly.idiocy.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1546612237 30400 195.159.176.226 (4 Jan 2019 14:30:37 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 4 Jan 2019 14:30:37 +0000 (UTC) Cc: emacs-devel@gnu.org To: Alan Third Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jan 04 15:30:33 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from listsout.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gfQUa-0007nW-Gv for ged-emacs-devel@m.gmane.org; Fri, 04 Jan 2019 15:30:32 +0100 Original-Received: from localhost ([127.0.0.1]:35907 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gfQWh-0003UC-6G for ged-emacs-devel@m.gmane.org; Fri, 04 Jan 2019 09:32:43 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:41709) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gfQVx-0003TL-7v for emacs-devel@gnu.org; Fri, 04 Jan 2019 09:31:58 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gfQVs-0003Fd-9T for emacs-devel@gnu.org; Fri, 04 Jan 2019 09:31:57 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:56743) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gfQVs-0003FQ-5d; Fri, 04 Jan 2019 09:31:52 -0500 Original-Received: from [176.228.60.248] (port=4356 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1gfQVr-0007Z1-Pb; Fri, 04 Jan 2019 09:31:52 -0500 In-reply-to: <20190102211241.GA53734@breton.holly.idiocy.org> (message from Alan Third on Wed, 2 Jan 2019 21:12:41 +0000) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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:232164 Archived-At: > Date: Wed, 2 Jan 2019 21:12:41 +0000 > From: Alan Third > Cc: emacs-devel@gnu.org > > I think this is the final version. Thanks. A few minor gotchas. > I would appreciate if someone who knows their way around image > handling would be able to test it. I’m particularly concerned that > I’ve probably broken masks. I can’t find any examples of how to use > them online, and they don’t work at all in NS, so I don’t know if they > get any use. Seconded. > +@item :max-width @var{max-width}, :max-height @var{max-height} > +The @code{:max-width} and @code{:max-height} keywords are used for > +scaling if the size of the image of the image exceeds these values. ^^^^^^^^^^^^^^^^^^^^^^^^^ Redundant repetition. > +If @code{:width} is set it will have precedence over @code{max-width}, ^ A comma is missing there. > +and if @code{:height} is set it will have precedence over ^ Likewise here. > + @code{:max-width} and @code{:max-height} will always preserve > +the aspect ratio. I don't think I understand what that means in practice. Does this allude to the issue described below with using :max-width and :max-height in preference to :with and :height? If so, I suggest to describe that only once. > +If both @code{:width} and @code{:max-height} has been set (but ^^^ "have" > +@code{:height} has not been set), then @code{:max-height} will have > +precedence. The same is the case for the opposite combination: The > +``max'' keyword has precedence. This confused me until I've read the example. having read the example, I suggest to describe this differently: If both @code{:max-width} and @code{:height} are specified, but @code{:width} is not, preserving the aspect ratio might require that width exceeds @code{:max-width}. If this happens, scaling will use a smaller value for the height so as to preserve the aspect ratio while not exceeding @code{:max-width}. Similarly when both @code{:max-height} and @code{:width} are specified, but @code{:height} is not. > +@item :scale @var{scale} > +This should be a number, where values higher than 1 means to increase > +the size, and lower means to decrease the size. For instance, a value > +of 0.25 will make the image a quarter size of what it originally was. I think we should say here explicitly that scale multiplies both height and width, because people might otherwise think the scaling applies to the area of the image. > +@defun image-scaling-p &optional frame > +This function returns @code{t} if @var{frame} supports image scaling. > +@var{frame} @code{nil} or omitted means to use the selected frame > +(@pxref{Input Focus}). > + > +If image scaling is not supported, @code{:width}, @code{:height}, > +@code{:scale}, @code{:max-width} and @code{:max-height} will only be > +usable through ImageMagick, if available (@pxref{ImageMagick Images}). > +@end defun Shouldn't image-scaling-p return non-nil if ImageMagick is available? I think that would allow a simpler Lisp code.