unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#58004: 29.0.50; Bounding box of image-crop is unnoticable in certain cases
@ 2022-09-22 14:24 Visuwesh
  2022-09-23  7:34 ` Visuwesh
  0 siblings, 1 reply; 4+ messages in thread
From: Visuwesh @ 2022-09-22 14:24 UTC (permalink / raw)
  To: 58004

[-- Attachment #1: Type: text/plain, Size: 593 bytes --]

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"


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Make-bounding-box-of-image-crop-more-noticeable.patch --]
[-- Type: text/x-diff, Size: 1942 bytes --]

From 5d0b1684b722c165e69fc5f498904d29bed22d88 Mon Sep 17 00:00:00 2001
From: Visuwesh <visuweshm@gmail.com>
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


[-- Attachment #3: vector_addition.png --]
[-- Type: image/png, Size: 37241 bytes --]

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* bug#58004: 29.0.50; Bounding box of image-crop is unnoticable in certain cases
  2022-09-22 14:24 bug#58004: 29.0.50; Bounding box of image-crop is unnoticable in certain cases Visuwesh
@ 2022-09-23  7:34 ` Visuwesh
  2022-09-23 16:11   ` Lars Ingebrigtsen
  0 siblings, 1 reply; 4+ messages in thread
From: Visuwesh @ 2022-09-23  7:34 UTC (permalink / raw)
  To: 58004

[-- Attachment #1: Type: text/plain, Size: 383 bytes --]

[வியாழன் செப்டம்பர் 22, 2022] Visuwesh wrote:

> Attached patch is an attempt to make the bounding box of image-crop more
> noticeable.

Revised patch attached.  I decided to make the stroke colour red since
white was not exactly noticeable, and decreased the size of stroke width
since darkening makes the bounding box noticeable enough.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Make-bounding-box-of-image-crop-more-noticeable.patch --]
[-- Type: text/x-diff, Size: 1888 bytes --]

From e2e5935e6ee26464f0a8473c7ead7f7dce5b4aae Mon Sep 17 00:00:00 2001
From: Visuwesh <visuweshm@gmail.com>
Date: Thu, 22 Sep 2022 19:49:18 +0530
Subject: [PATCH] Make bounding box of 'image-crop' more noticeable

* lisp/image/image-crop.el (image-crop--crop-image-1): Darken the
selected region to make the bounding-box more noticable in images
which are mostly white.  (bug#58004)
---
 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..1058f11102 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-rectangle svg (cl-getf area :left) (cl-getf area :top)
+                       (image-crop--width area) (image-crop--height area)
+                       :stroke-color "red" :stroke-width 2
+                       :fill-opacity 0.3 :fill "black" :id "rect")
      while (not (member event '(return ?q)))
      finally (return (and (eq event 'return)
 			  area)))))
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* bug#58004: 29.0.50; Bounding box of image-crop is unnoticable in certain cases
  2022-09-23  7:34 ` Visuwesh
@ 2022-09-23 16:11   ` Lars Ingebrigtsen
  2022-09-23 16:29     ` Visuwesh
  0 siblings, 1 reply; 4+ messages in thread
From: Lars Ingebrigtsen @ 2022-09-23 16:11 UTC (permalink / raw)
  To: Visuwesh; +Cc: 58004

Visuwesh <visuweshm@gmail.com> writes:

> Revised patch attached.  I decided to make the stroke colour red since
> white was not exactly noticeable, and decreased the size of stroke width
> since darkening makes the bounding box noticeable enough.

Looks very nice; pushed to Emacs 29.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#58004: 29.0.50; Bounding box of image-crop is unnoticable in certain cases
  2022-09-23 16:11   ` Lars Ingebrigtsen
@ 2022-09-23 16:29     ` Visuwesh
  0 siblings, 0 replies; 4+ messages in thread
From: Visuwesh @ 2022-09-23 16:29 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 58004

[வெள்ளி செப்டம்பர் 23, 2022] Lars Ingebrigtsen wrote:

> Looks very nice; pushed to Emacs 29.

Thanks!

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-09-23 16:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-22 14:24 bug#58004: 29.0.50; Bounding box of image-crop is unnoticable in certain cases Visuwesh
2022-09-23  7:34 ` Visuwesh
2022-09-23 16:11   ` Lars Ingebrigtsen
2022-09-23 16:29     ` Visuwesh

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).