Книга: Learning GNU Emacs, 3rd Edition

7.6.3 Drawing with the Mouse Using Artist

7.6.3 Drawing with the Mouse Using Artist

We would be remiss if we didn't introduce you to artist mode, an easy way to create ASCII art using the mouse. (You can also use keyboard commands, but trust us—you won't want to.)

Artist mode is a minor mode related to picture mode, so you use them together. For example, you might draw using artist mode, then edit the picture in picture mode. Or you might choose to use artist mode alone for your creations.

We're going to give you a taste of artist mode; you can perfect your skills in your spare time. When you start artist mode, picture mode starts automatically.

Type: M-x artist-mode


Artist appears on the mode line, as does Picture.

When you start artist mode, pen drawing is selected by default.

Hold down the left mouse button and move around to scribble.


A random scribble.

With the pen, you can draw freestyle. Hold down the middle mouse button and a menu appears, with Drawing, Edit, and Settings submenus. The Drawing menu offers a variety of shapes from which to choose. Now that we've scribbled, let's create some graffiti using the spray can.

Select Spray Can from the Drawing menu, then spray the screen by holding down the left mouse button and moving the mouse.


A random spray.

We aren't going to go deep into artist mode, but we would like to give you a flavor of the basic drawing choices. You can draw rectangles (our personal favorite), ellipses, lines (which strive to be straight), and poly-lines (which strive to be polygon-angular). Figure 7-6 shows a representative sample of shapes. With practice, you can create complex drawings and edit them, either using the mouse or using standard picture mode commands.

Figure 7-6. A representative sample of artist shapes


For rectangles, lines, and ellipses, hold down the left mouse and pull them to the size and, in the case of lines, angle you prefer. (Ellipses are made of straight lines, so use your imagination; this is ASCII art after all.) For poly-lines, draw a line by holding down the left mouse button, then release it. Move the mouse away from that line to the next corner of the polygon and click. Emacs draws a line connecting the two points. Poly-lines allow you to create polygons quickly.

Table 7-8 provides an overview of artist commands. Artist works very well with the mouse and the middle-button mouse menu; if you're mouse-averse, you'll prefer picture mode.

Table 7-8. Artist mode commands

Keystrokes Command name Action
(none) artist-mode Enter artist mode.
C-c C-c artist-mode-off Exit artist mode.
C-f artist-forward-char Move to the right one character (at end of line, keep adding characters to current line).
C-b artist-backward-char Move to the left one character (at beginning of line, does nothing).
C-n artist-next-line Move down a column (at end of buffer, keep adding lines to the buffer).
C-p artist-previous-line Move up a column (at first line of buffer moves to first position in file, then does nothing).
C-c C-a C-o orMouse-2 artist-select-operation Select an operation (press Tab to see a list).
C-c C-a f` Artist menu ? Edit ? Flood-fill artist-select-op-flood-fill Select flood fill as the operation.
C-c C-a C-k Artist menu ? Edit ? Cut artist-select-op-cut-rectangle Draw a rectangle around an area, then cut.
C-c C-a M-w Artist menu ? Edit ? Copy artist-select-op-copy-rectangle Draw a rectangle around an area, then copy.
C-c C-a C-y Artist menu ? Edit ? Paste artist-select-op-paste Paste what you copied wherever you click the mouse.
C-c C-a v Artist menu ? Drawing ? Vaporize artist-select-op-vaporize-line Erase a line you select (literal line; not a line in the file).
C-c C-a C-d Artist menu ? Drawing ? Erase artist-select-op-erase-char Set operation to erase (use the mouse as your eraser).
C-c C-a S Artist menu ? Drawing ? Spray-can artist-select-op-spray-can Set operation to spray can.
C-c C-a e Artist menu ? Drawing ? Ellipse artist-select-op-ellipse Draw ellipses.
C-c C-a p Artist menu ? Drawing ? Poly-line artist-select-op-poly-line Draws poly-lines.
C-c C-a r Artist menu ? Drawing ? Rectangle artist-select-op-rectangle Draw rectangles.
C-c C-a l Artist menu ? Drawing ? Line artist-select-op-line Draw lines.
C-c C-a C-r Artist menu ? Settings ? Rubber banding artist-toggle-rubber-banding If on (the default), show shape while stretching; if not, mark end-points.
C-c C-a C-l Artist menu ? Settings ? Set Line artist-select-line-char Select character to use when drawing lines (- is the default).
C-c C-a C-f Artist menu ? Settings ? Set Fill artist-select-fill-char Select character to fill shapes with (Space is the default).

Оглавление книги


Генерация: 1.219. Запросов К БД/Cache: 3 / 0
поделиться
Вверх Вниз