From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Track mouse drags over an image Date: Fri, 11 Jan 2019 11:23:34 -0500 Message-ID: References: <8336qb3upt.fsf@gnu.org> <20190102211241.GA53734@breton.holly.idiocy.org> <8736q6okqj.fsf_-_@gnu.org> <87y37rn678.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1547223777 5034 195.159.176.226 (11 Jan 2019 16:22:57 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 11 Jan 2019 16:22:57 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jan 11 17:22:53 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ghza8-0001D7-JS for ged-emacs-devel@m.gmane.org; Fri, 11 Jan 2019 17:22:52 +0100 Original-Received: from localhost ([127.0.0.1]:37586 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ghzcF-0003at-HA for ged-emacs-devel@m.gmane.org; Fri, 11 Jan 2019 11:25:03 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:50993) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ghzb1-0002na-4g for emacs-devel@gnu.org; Fri, 11 Jan 2019 11:23:48 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ghzaz-00077O-QH for emacs-devel@gnu.org; Fri, 11 Jan 2019 11:23:46 -0500 Original-Received: from [195.159.176.226] (port=37985 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ghzax-000744-Pf for emacs-devel@gnu.org; Fri, 11 Jan 2019 11:23:43 -0500 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1ghzYn-0007b3-5V for emacs-devel@gnu.org; Fri, 11 Jan 2019 17:21:29 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 29 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:d0Ub397V2QvZBTKYCqD+d8IwgQ4= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] 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:232309 Archived-At: > My question was indeed different: is there any possible use for such a > feature in other elisp packages that could justify such efforts? > Djvu-mode uses this for making annotations. Could something like that > be useful for other packages, too (packages I do not know about)? I think I wanted to use such a drag in doc-view-mode to let the user "zoom to the selected area", but never got to it (in part because of the tedium of writing that code to do the highlighting of the rectangle while tracking mouse movements). I'd expect pdf-tools to want this as well (and there's a chance it's already implemented there also). >> E.g. make it work for any image rather than only for PPM images of >> "depth" 255. Images are pretty far from my area of expertise, tho, so >> someone else should look into this. > PPM (or PGM) images of "depth" 255 allow most easily to highlight the > dragged region as they represent each pixel by three (or one) byte that > can easily be addressed and inverted in elisp. I do not know how to do > the same thing with, say, PBM images that otherwise could probably be > more efficient. I think there's a chance that the end result can be obtained quite differently (e.g. first convert the source image into a pixmap and then use some existing toolkit functionality to do the image manipulation, just like we recently added code to the image resizing). Stefan