Subject: 29.0.50; Bounding box of image-crop is unnoticable in certain cases

From: Visuwesh <[email-masked]>
Date: Thu, 22 Sep 2022 19:54:10 +0530

Attached patch is an attempt to make the bounding box of image-crop more
noticeable.
If you're using image-crop in an image that is mostly white, then it is
very hard to notice the bounding box in a light theme.  I looked for a
way to draw a border around the lines in svg but was unable to find
anything so I settled for drawing a rectangle and darkening the inside
of that rectangle.  Alternatively, one can make the rectangle stroke red
since it is probably rare to come across an image that is mostly red.

Before and after can be tested on the attached image named
"vector_addition.png"

>From 5d0b1684b722c165e69fc5f498904d29bed22d88 Mon Sep 17 00:00:00 2001
From: Visuwesh <[email-masked]>
Date: Thu, 22 Sep 2022 19:49:18 +0530
Subject: [PATCH] Make bounding box of 'image-crop' more noticeable

Make the selected region slightly darker to make the bounding-box more
noticable in images which are mostly white.

* lisp/image/image-crop.el (image-crop--crop-image-1): Draw an actual
rectangle and darken the selected area.
---
 lisp/image/image-crop.el | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/lisp/image/image-crop.el b/lisp/image/image-crop.el
index 39c5757636..35b8d3004d 100644
--- a/lisp/image/image-crop.el
+++ b/lisp/image/image-crop.el
@@ -349,18 +349,10 @@ image-crop--crop-image-1
 		((memq (car event) '(mouse-1 drag-mouse-1))
 		 (setq state 'move-unclick
                        prompt (format "Click to move for %s" op)))))))))
-     do (svg-line svg (cl-getf area :left) (cl-getf area :top)
-		  (cl-getf area :right) (cl-getf area :top)
-		  :id "top-line" :stroke-color "white")
-     (svg-line svg (cl-getf area :left) (cl-getf area :bottom)
-	       (cl-getf area :right) (cl-getf area :bottom)
-	       :id "bottom-line" :stroke-color "white")
-     (svg-line svg (cl-getf area :left) (cl-getf area :top)
-	       (cl-getf area :left) (cl-getf area :bottom)
-	       :id "left-line" :stroke-color "white")
-     (svg-line svg (cl-getf area :right) (cl-getf area :top)
-	       (cl-getf area :right) (cl-getf area :bottom)
-	       :id "right-line" :stroke-color "white")
+     do ;;(svg-remove svg "rect")
+        (svg-rectangle svg (cl-getf area :left) (cl-getf area :top)
+                       (image-crop--width area) (image-crop--height area)
+                       :stroke-color "white" :fill-opacity 0.3 :fill "black" :id "rect")
      while (not (member event '(return ?q)))
      finally (return (and (eq event 'return)
 			  area)))))
-- 
2.35.1