all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Jim Newton <jimka.issy@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: can someone help me with the image elisp API
Date: Mon, 7 Dec 2015 07:25:58 -0800 (PST)	[thread overview]
Message-ID: <72e35ecc-e4bf-4d32-bc7f-e47c87e758e4@googlegroups.com> (raw)

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 event),
and somehow relate the point the user clicked to the 
coordinates in the image.

\x10For 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=%s" (posn-x-y position))))







             reply	other threads:[~2015-12-07 15:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-07 15:25 Jim Newton [this message]
2015-12-08  7:23 ` can someone help me with the image elisp API Alexis
2015-12-08  9:30 ` Andy Moreton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=72e35ecc-e4bf-4d32-bc7f-e47c87e758e4@googlegroups.com \
    --to=jimka.issy@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.