From f7bcf7fa46a634653e50f9e580faf2a53ab50e88 Mon Sep 17 00:00:00 2001 From: Vincent Robinson Date: Sun, 3 Jul 2022 05:52:26 -0700 Subject: FormSpec: 9-slice images, animated_images, and fgimg_middle (#12453) * FormSpec: 9-slice images and animated_images * Add fgimg_middle; clean up code * Address issues, add tests * Fix stupid error; bump formspec version * Re-add image[] elements without a size --- doc/lua_api.txt | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'doc') diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 994a30981..24de70a3b 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -2310,6 +2310,8 @@ Version History * Allow dropdown indexing events * Formspec version 5 (5.5.0): * Added padding[] element +* Formspec version 6 (5.6.0): + * Add nine-slice images, animated_images, and fgimg_middle Elements -------- @@ -2474,20 +2476,25 @@ Elements * `bgcolor` tooltip background color as `ColorString` (optional) * `fontcolor` tooltip font color as `ColorString` (optional) -### `image[,;,;]` +### `image[,;,;;]` -* Show an image +* Show an image. +* `middle` (optional): Makes the image render in 9-sliced mode and defines the middle rect. + * Requires formspec version >= 6. + * See `background9[]` documentation for more information. -### `animated_image[,;,;;;;;]` +### `animated_image[,;,;;;;;;]` * Show an animated image. The image is drawn like a "vertical_frames" tile - animation (See [Tile animation definition]), but uses a frame count/duration - for simplicity + animation (See [Tile animation definition]), but uses a frame count/duration for simplicity * `name`: Element name to send when an event occurs. The event value is the index of the current frame. * `texture name`: The image to use. * `frame count`: The number of frames animating the image. * `frame duration`: Milliseconds between each frame. `0` means the frames don't advance. -* `frame start` (Optional): The index of the frame to start on. Default `1`. +* `frame start` (optional): The index of the frame to start on. Default `1`. +* `middle` (optional): Makes the image render in 9-sliced mode and defines the middle rect. + * Requires formspec version >= 6. + * See `background9[]` documentation for more information. ### `model[,;,;;;;;;;;]` @@ -3101,6 +3108,8 @@ Some types may inherit styles from parent types. * This is deprecated, use states instead. * fgimg_pressed - image when pressed. Defaults to fgimg when not provided. * This is deprecated, use states instead. + * fgimg_middle - Makes the fgimg textures render in 9-sliced mode and defines the middle rect. + See background9[] documentation for more details. * NOTE: The parameters of any given image_button will take precedence over fgimg/fgimg_pressed * sound - a sound to be played when triggered. * scrollbar -- cgit v1.2.3