From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Roland Winkler Newsgroups: gmane.emacs.devel Subject: Track mouse drags over an image (was: Add native image scaling) Date: Sat, 05 Jan 2019 15:30:44 -0600 Message-ID: <8736q6okqj.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 X-Trace: blaine.gmane.org 1546723740 7622 195.159.176.226 (5 Jan 2019 21:29:00 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 5 Jan 2019 21:29:00 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Jan 05 22:28:56 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from listsout.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gftV1-0001ri-Ho for ged-emacs-devel@m.gmane.org; Sat, 05 Jan 2019 22:28:55 +0100 Original-Received: from localhost ([127.0.0.1]:39180 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gftX8-0007rh-9c for ged-emacs-devel@m.gmane.org; Sat, 05 Jan 2019 16:31:06 -0500 Original-Received: from eggsout.gnu.org ([209.51.188.92]:55515 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gftX2-0007rX-9m for emacs-devel@gnu.org; Sat, 05 Jan 2019 16:31:01 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gftWw-00065v-U4 for emacs-devel@gnu.org; Sat, 05 Jan 2019 16:31:00 -0500 Original-Received: from [195.159.176.226] (port=41354 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gftWw-00064W-MZ for emacs-devel@gnu.org; Sat, 05 Jan 2019 16:30:54 -0500 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1gftUm-0001bM-Se for emacs-devel@gnu.org; Sat, 05 Jan 2019 22:28:40 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 19 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:qJuD7Ih+WPEVQ39n3Iy4BMpmvvc= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 195.159.176.226 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:232201 Archived-At: Whenever I see the thread on "add native image scaling" it reminds me of the following (kind of related): For Djvu mode in GNU Elpa I needed code that tracks mouse drags over an image, similar to what mouse-drag-track does for ordinary text. This is useful if one needs to define a rectangular region in an image via mouse events. The way I implemented the tracking in elisp is by converting the coordinates of the mouse events into image coordinates, inverting the bits of the PPM image for the current rectangle and redisplay the modified image (see the function djvu-image-rect). This code runs many times while dragging over the image. I was most surprised that this works sufficiently fast when implemented in elisp to be usable. Still I am wondering: would it make sense to implement such code in a built-in function? (This would be beyond my knowledge of hacking Emacs.) Are there other situations where such a built-in function would be useful? (Or am I possibly missing something better that exists already?) Roland