bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#69602: 29.1; Image :map should adjust with :scale and :rotation


From: Joseph Turner
Subject: bug#69602: 29.1; Image :map should adjust with :scale and :rotation
Date: Thu, 07 Mar 2024 23:02:24 -0800

Joseph Turner <joseph@breatheoutbreathe.in> writes:

> The attached patch adds two hooks in `image.el' which allow packages to
> recompute an image's map after it's rescaled or rotated.

In this new attached patch, rescaling image maps is handled within
image.el.  No new hooks are added.  This change should be backwards
compatible, except that :unscaled-map is now a reserved image property.

If we decide to install this patch, I'll work on modifying image maps
inside of `image-rotate', as well as update the manual and NEWS.

Test it out!

(with-current-buffer (get-buffer-create "*image-properties-test*")
  (let* ((svg-string "<?xml version=\"1.0\" encoding=\"UTF-8\" 
standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n 
\"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\";>\n<!-- Generated by 
graphviz version 2.43.0 (0)\n -->\n<!-- Title: orggraphview Pages: 1 -->\n<svg 
width=\"128pt\" height=\"128pt\"\n viewBox=\"0.00 0.00 127.59 127.59\" 
xmlns=\"http://www.w3.org/2000/svg\"; 
xmlns:xlink=\"http://www.w3.org/1999/xlink\";>\n<g id=\"graph0\" class=\"graph\" 
transform=\"scale(1 1) rotate(0) translate(4 
123.59)\">\n<title>orggraphview</title>\n<polygon fill=\"white\" 
stroke=\"transparent\" points=\"-4,4 -4,-123.59 123.59,-123.59 123.59,4 
-4,4\"/>\n<!-- a -->\n<g id=\"node1\" class=\"node\">\n<title>a</title>\n<g 
id=\"a_node1\"><a xlink:href=\"1\" xlink:title=\"Hover me!\">\n<ellipse 
fill=\"none\" stroke=\"black\" cx=\"59.79\" cy=\"-59.79\" rx=\"59.59\" 
ry=\"59.59\"/>\n<text text-anchor=\"middle\" x=\"59.79\" y=\"-56.09\" 
font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">Hover 
me!</text>\n</a>\n</g>\n</g>\n</g>\n</svg>\n")
         (map '(((circle (85 . 85) . 80) "1" (help-echo "Surprise!"))))
         (image (create-image svg-string 'svg t :map map)))
    (erase-buffer)
    (insert-image image)
    (goto-char (point-min))
    (pop-to-buffer (current-buffer))))

Thank you!

Joseph

Attachment: 0001-Recalculate-map-when-image-scale-changes.patch
Description: Text Data


reply via email to

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