From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jim Newton Newsgroups: gmane.emacs.help Subject: can someone help me with the image elisp API Date: Mon, 7 Dec 2015 07:25:58 -0800 (PST) Message-ID: <72e35ecc-e4bf-4d32-bc7f-e47c87e758e4@googlegroups.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1449502321 16010 80.91.229.3 (7 Dec 2015 15:32:01 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 7 Dec 2015 15:32:01 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Dec 07 16:31:55 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1a5xk3-0001tA-1O for geh-help-gnu-emacs@m.gmane.org; Mon, 07 Dec 2015 16:30:19 +0100 Original-Received: from localhost ([::1]:55101 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a5xk1-0002eU-Sp for geh-help-gnu-emacs@m.gmane.org; Mon, 07 Dec 2015 10:30:17 -0500 X-Received: by 10.13.238.130 with SMTP id x124mr27961639ywe.53.1449501959136; Mon, 07 Dec 2015 07:25:59 -0800 (PST) X-Received: by 10.50.9.39 with SMTP id w7mr364317iga.3.1449501959109; Mon, 07 Dec 2015 07:25:59 -0800 (PST) Original-Path: usenet.stanford.edu!b51no7025165qgf.0!news-out.google.com!f6ni16597igq.0!nntp.google.com!mv3no10224570igc.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=163.5.55.13; posting-account=p_cn_woAAAAXPGEq7uizWAc60TPLf8y5 Original-NNTP-Posting-Host: 163.5.55.13 User-Agent: G2/1.0 Injection-Date: Mon, 07 Dec 2015 15:25:59 +0000 Original-Xref: usenet.stanford.edu gnu.emacs.help:216035 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:108325 Archived-At: I've opened an image (a .png) file in an emacs buffer. I'd like to be able to click in the image with the RMB (or any good mouse e= vent), and somehow relate the point the user clicked to the=20 coordinates in the image. =10For example, this elisp function gets the x-y position. Suppose it is (= 609 . 41) I want to know if that is in the box within the image coordinates (( 447.32 199.28) ( 449.7426 199.9871)) I need of course to consider that the user might have scrolled or panned or= zoomed within the image before calling the class-graph-from-click function. (defun class-graph-from-click (event) (interactive "e") (let ((position (event-start event))) (posn-x-y position) ;; this is the x-y where the mouse was clicked-down (message "xy=3D%s" (posn-x-y position))))