emacs-devel
[Top][All Lists]

## Re: Drawing in images?

 From: MON KEY Subject: Re: Drawing in images? Date: Mon, 28 Sep 2009 20:31:13 -0400

```While examining dragbox2.el it occurred to me that an alternative way to
set a crop would be to use emacs window... er actually 5 windows!

68.
_________________________________________________________________
|                             !                     |             |
| window1                     !                     |    window4  |
|                             !                     |             |
|                             !                     |             |
|                            \|/                    |             |
|---------------------------------------------------|             |
|           |                /!\                    |             |
|           |                 !                     |             |
|           |          Y-axis !                     |             |
|           |                 !                     |             |
|           |                 !                     |             |
|           |                 !                     |             |
|           |                 !                     |             |
|           |                 !                     |             |
|           |        window5  !                     |             |
|~~~~~~~~~~>|<~~~~~~~~~~~~~~~~+~~~~~~~~~~~~~~~~~~~~>|<~~~~~~~~~~~~|
|           |                 !       X-axis        |             |
|           |                 !                     |             |
|           |                 !                     |             |
|           |                 !                     |             |
|           |                 !                     |             |
|           |                 !                     |             |
|           |                 !                     |             |
|           |                 !                     |             |
|           |                 !                     |             |
|           |                \!/                    |             |
|           |-----------------------------------------------------|
|           |                /!\                          window3 |
|           |                 !                                   |
|           |                 !                                   |
|           |                 !                                   |
|   window2 |                 !                                   |
|___________|_________________|___________________________________|
68^

* Assume that the image to be cropped/bounded is in window5.

* Assume that all windows have a ~1-3 pixel border.

* Assume that window1, window2, window3, window4 can _only_ be
expanded contracted
on the axis indicated.

* Assume that window 5 is the only window that can be
expanded/contracted on both axis.

* Assume use of a library such as Drew Adams' DoReMi or equivalent.

* Assume Y-axis -> Up/Down expansion/contraction

* Assume X-axis -> Left/Right expansion/contraction

Window1 can expand/contract only along the Y-axis
Window2 can expand/contract only along the X-axis
Window3 can expand/contract only along the y-axis
Window4 can expand/contract only along the X-axis

Window5 can expand/contract along both the X-axis and Y-axis.
Window5 can recenter/reset the image along both the X-axis and Y-axis.

Shouldn't `posn-object-width-height', `posn-window', `posn-area' etc.
get one reasonably accurate pixel coardinates for a crop?

If so, doesn't this give us visual feedback without need of external calls, SVG
overlays, GTK wonkery etc.?

Also, a novel idea for doing image rotation using artist.el
as influenced by Unpaper's "Virtual Bar":
(URL `http://unpaper.berlios.de/img/deskew-detail1.png')
(URL `http://unpaper.berlios.de/img/deskew-detail2.png')

Which skews an image against a "Virtual Line" by calculating the skew against
some baseline (x-axis, y-axis, both) i.e. the radian as the virtual line's
deviation from "square".

Emacs window (preferably in a dedicated frame)
+--------------------------------------------------------60.
|                                                         |
|    +-----------------------------------------------+    |
|    |                     .                         |    |
|    |                    /                          |    |
|    |                   /                           |    |
|    |                  /                            |    |
|    |                 /                             |    |
|    |                /                              |    |
|    |               /                               |    |
|    |              /                                |    |
|    |             / <-Virtual Line                  |    |
|    |            /                                  |    |
|    |           /                                   |    |
|    |          /                                    |    |
|    |         /                                     |    |
|    |        /                                      |    |
|    |       /                                       |    |
|    |      /                                        |    |
|    |     /                                         |    |
|    |    /                                          |    |
|    |   /                                           |    |
|    |  .                                            |    |
|    |                                               |    |
|    |                                               |    |
|    |                                               |    |
|    |                                               |    |
|    |                                               |    |
|    |                                               |    |
|  Y |                                               |    |
|    |       A Skewed Image (needs rotating)         |    |
|    +-----------------------------------------------+    |
|      X                                                  |
+--------------------------------------------------------60.

s_P

```