From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Chong Yidong Newsgroups: gmane.emacs.devel Subject: Re: image scaling Date: Thu, 21 Feb 2008 23:57:20 -0500 Message-ID: <87lk5dr3kf.fsf@stupidchicken.com> References: <87odaam9oy.fsf@stupidchicken.com> <8563wiaskc.fsf@lola.goethe.zz> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1203656341 26194 80.91.229.12 (22 Feb 2008 04:59:01 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 22 Feb 2008 04:59:01 +0000 (UTC) Cc: Stefan Monnier , emacs-devel@gnu.org To: David Kastrup Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Feb 22 05:59:25 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JSQ0I-0007BN-6G for ged-emacs-devel@m.gmane.org; Fri, 22 Feb 2008 05:59:22 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JSPzm-0001YW-VF for ged-emacs-devel@m.gmane.org; Thu, 21 Feb 2008 23:58:51 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JSPzj-0001YO-Mw for emacs-devel@gnu.org; Thu, 21 Feb 2008 23:58:47 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JSPzf-0001XQ-7B for emacs-devel@gnu.org; Thu, 21 Feb 2008 23:58:47 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JSPzf-0001XN-3x for emacs-devel@gnu.org; Thu, 21 Feb 2008 23:58:43 -0500 Original-Received: from cyd.mit.edu ([18.115.2.24]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JSPzb-00059C-7I; Thu, 21 Feb 2008 23:58:39 -0500 Original-Received: by cyd.mit.edu (Postfix, from userid 1000) id A3A934E3F7; Thu, 21 Feb 2008 23:57:20 -0500 (EST) In-Reply-To: <8563wiaskc.fsf@lola.goethe.zz> (David Kastrup's message of "Thu\, 21 Feb 2008 22\:49\:23 +0100") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1.91 (gnu/linux) X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:89935 Archived-At: David Kastrup writes: >> I think the cleanest (but not necessarily easiest) approach is to add >> a C level function to rescale an image. This C function would act on >> the internal pixmap structures and implement its own image scaling >> algorithm. The trouble with using external library functions is that >> not all of them support rescaling. > > Since lot more people concerned about graphics work on those library > functions than on Emacs' graphics, we should be factoring Emacs' image > code in a manner that will allow us to make use of that functionality if > it is given (and possibly be able to use gdk if it is available). > Really: how pixels are passed one by one through Emacs before reaching > the display is a mess. My main concern with outsourcing particular bits of the Emacs image functionality to external libraries (which may or may not be linked in) is how this will look at the Lisp level. This problem is already present to a small degree; for example, the `image-type-available-p' function checks if a particular image format can be displayed. But it would be a mess if we force users (Lisp coders) to perform a similar test before performing things like image rescaling---or, worse still, having such functionality quietly disappear, by functions not being defined or becoming no-ops. Of course, we could take the approach of writing our own "fallback" code for when the libraries aren't available, but that negates the point of using the libraries in the first place. As for refactoring the Emacs image code, I'm not sure if there's any urgency for such a project. The code isn't elegant, but it's simple enough to understand and work on; and I don't know of any performance problem in the way Emacs handles image pixmaps.