emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Track mouse drags over an image (was: Add native image scaling)


From: Roland Winkler
Subject: Track mouse drags over an image (was: Add native image scaling)
Date: Sat, 05 Jan 2019 15:30:44 -0600
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux)

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]