diff options
| author | Craig Jennings <c@cjennings.net> | 2024-04-07 13:41:34 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2024-04-07 13:41:34 -0500 |
| commit | 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 (patch) | |
| tree | f1190704f78f04a2b0b4c977d20fe96a828377f1 /devdocs/elisp/showing-images.html | |
new repository
Diffstat (limited to 'devdocs/elisp/showing-images.html')
| -rw-r--r-- | devdocs/elisp/showing-images.html | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/devdocs/elisp/showing-images.html b/devdocs/elisp/showing-images.html new file mode 100644 index 00000000..ac9d5191 --- /dev/null +++ b/devdocs/elisp/showing-images.html @@ -0,0 +1,34 @@ + <h4 class="subsection">Showing Images</h4> <p>You can use an image descriptor by setting up the <code>display</code> property yourself, but it is easier to use the functions in this section. </p> <dl> <dt id="insert-image">Function: <strong>insert-image</strong> <em>image &optional string area slice</em> +</dt> <dd> +<p>This function inserts <var>image</var> in the current buffer at point. The value <var>image</var> should be an image descriptor; it could be a value returned by <code>create-image</code>, or the value of a symbol defined with <code>defimage</code>. The argument <var>string</var> specifies the text to put in the buffer to hold the image. If it is omitted or <code>nil</code>, <code>insert-image</code> uses <code>" "</code> by default. </p> <p>The argument <var>area</var> specifies whether to put the image in a margin. If it is <code>left-margin</code>, the image appears in the left margin; <code>right-margin</code> specifies the right margin. If <var>area</var> is <code>nil</code> or omitted, the image is displayed at point within the buffer’s text. </p> <p>The argument <var>slice</var> specifies a slice of the image to insert. If <var>slice</var> is <code>nil</code> or omitted the whole image is inserted. (However, note that images are chopped on display at the window’s right edge, because wrapping images is not supported.) Otherwise, <var>slice</var> is a list <code>(<var>x</var> <var>y</var> <var>width</var> +<var>height</var>)</code> which specifies the <var>x</var> and <var>y</var> positions and <var>width</var> and <var>height</var> of the image area to insert. Integer values are in units of pixels. A floating-point number in the range 0.0–1.0 stands for that fraction of the width or height of the entire image. </p> <p>Internally, this function inserts <var>string</var> in the buffer, and gives it a <code>display</code> property which specifies <var>image</var>. See <a href="display-property">Display Property</a>. </p> +</dd> +</dl> <dl> <dt id="insert-sliced-image">Function: <strong>insert-sliced-image</strong> <em>image &optional string area rows cols</em> +</dt> <dd> +<p>This function inserts <var>image</var> in the current buffer at point, like <code>insert-image</code>, but splits the image into <var>rows</var>x<var>cols</var> equally sized slices. </p> <p>Emacs displays each slice as a separate image, and allows more intuitive scrolling up/down, instead of jumping up/down the entire image when paging through a buffer that displays (large) images. </p> +</dd> +</dl> <dl> <dt id="put-image">Function: <strong>put-image</strong> <em>image pos &optional string area</em> +</dt> <dd> +<p>This function puts image <var>image</var> in front of <var>pos</var> in the current buffer. The argument <var>pos</var> should be an integer or a marker. It specifies the buffer position where the image should appear. The argument <var>string</var> specifies the text that should hold the image as an alternative to the default. </p> <p>The argument <var>image</var> must be an image descriptor, perhaps returned by <code>create-image</code> or stored by <code>defimage</code>. </p> <p>The argument <var>area</var> specifies whether to put the image in a margin. If it is <code>left-margin</code>, the image appears in the left margin; <code>right-margin</code> specifies the right margin. If <var>area</var> is <code>nil</code> or omitted, the image is displayed at point within the buffer’s text. </p> <p>Internally, this function creates an overlay, and gives it a <code>before-string</code> property containing text that has a <code>display</code> property whose value is the image. (Whew!) </p> +</dd> +</dl> <dl> <dt id="remove-images">Function: <strong>remove-images</strong> <em>start end &optional buffer</em> +</dt> <dd> +<p>This function removes images in <var>buffer</var> between positions <var>start</var> and <var>end</var>. If <var>buffer</var> is omitted or <code>nil</code>, images are removed from the current buffer. </p> <p>This removes only images that were put into <var>buffer</var> the way <code>put-image</code> does it, not images that were inserted with <code>insert-image</code> or in other ways. </p> +</dd> +</dl> <dl> <dt id="image-size">Function: <strong>image-size</strong> <em>spec &optional pixels frame</em> +</dt> <dd> + <p>This function returns the size of an image as a pair <code>(<var>width</var> . <var>height</var>)</code>. <var>spec</var> is an image specification. <var>pixels</var> non-<code>nil</code> means return sizes measured in pixels, otherwise return sizes measured in the default character size of <var>frame</var> (see <a href="frame-font">Frame Font</a>). <var>frame</var> is the frame on which the image will be displayed. <var>frame</var> <code>nil</code> or omitted means use the selected frame (see <a href="input-focus">Input Focus</a>). </p> +</dd> +</dl> <dl> <dt id="max-image-size">Variable: <strong>max-image-size</strong> +</dt> <dd> +<p>This variable is used to define the maximum size of image that Emacs will load. Emacs will refuse to load (and display) any image that is larger than this limit. </p> <p>If the value is an integer, it directly specifies the maximum image height and width, measured in pixels. If it is floating point, it specifies the maximum image height and width as a ratio to the frame height and width. If the value is non-numeric, there is no explicit limit on the size of images. </p> <p>The purpose of this variable is to prevent unreasonably large images from accidentally being loaded into Emacs. It only takes effect the first time an image is loaded. Once an image is placed in the image cache, it can always be displayed, even if the value of <code>max-image-size</code> is subsequently changed (see <a href="image-cache">Image Cache</a>). </p> +</dd> +</dl> <p>Images inserted with the insertion functions above also get a local keymap installed in the text properties (or overlays) that span the displayed image. This keymap defines the following commands: </p> <dl compact> <dt><kbd>+</kbd></dt> <dd> +<p>Increase the image size (<code>image-increase-size</code>). A prefix value of ‘<samp>4</samp>’ means to increase the size by 40%. The default is 20%. </p> </dd> <dt><kbd>-</kbd></dt> <dd> +<p>Decrease the image size (<code>image-increase-size</code>). A prefix value of ‘<samp>4</samp>’ means to decrease the size by 40%. The default is 20%. </p> </dd> <dt><kbd>r</kbd></dt> <dd> +<p>Rotate the image by 90 degrees clockwise (<code>image-rotate</code>). A prefix means to rotate by 90 degrees counter-clockwise instead. </p> </dd> <dt><kbd>o</kbd></dt> <dd><p>Save the image to a file (<code>image-save</code>). </p></dd> </dl><div class="_attribution"> + <p class="_attribution-p"> + Copyright © 1990-1996, 1998-2022 Free Software Foundation, Inc. <br>Licensed under the GNU GPL license.<br> + <a href="https://www.gnu.org/software/emacs/manual/html_node/elisp/Showing-Images.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/Showing-Images.html</a> + </p> +</div> |
