Repository navigation
RML Images
Librocket within FSO supports two types of image tags.
The <img> element is used to include still images in the document.
<img src="ops-panel-large-l.png"></img>The <ani> element is used for animated images and can load APNG, EFF, or ANI files. The animation plays in a loop. SCPUI usually creates these from Lua:
local ani_el = document:CreateElement("ani")
ani_el:SetAttribute("src", "static.png")
wrapper_el:AppendChild(ani_el)If an animation is given to <img> instead, it shows a single frame and does not play.
These attributes apply to both types of images.
The filename of the image or animation. Use a bare file name; FSO searches its data paths for it (see Documents).
The extension is ignored. FSO strips it and loads the file through its normal image loading, so src="foo.png" finds foo.dds, foo.png or any other image format FSO supports, whichever it finds first, just as FSO does for its own graphics.
Two special forms load an image that isn't a file:
-
data:image/bmpman,Nshows FSO texture handleN. Get this URL from Lua withui.linkTexture(texture); SCPUI uses it for the briefing map and loading bar, which are drawn to textures at runtime. -
data:image/png;base64,…shows a PNG given as base64 text.
local url = ui.linkTexture(my_texture)
img_el:SetAttribute("src", url)The width to force the element to, in pixels. If this is unspecified, it will default to the width of the image.
The height to force the element to, in pixels. If this is unspecified, it will default to the height of the image.
Shows only part of the image: four comma-separated pixel values left, top, right, bottom. Without width/height, the element is sized to that region.
<img src="buttons.png" coords="0, 0, 64, 32"></img>The RCSS width and height properties override the attributes. If only one of them is set, the other is scaled to keep the image's aspect ratio.
For images, the RCSS size includes padding and borders: padding and borders take space out of the image rather than adding to the outside of it.
Known issue: on an
<img>or<ani>left at the defaultdisplay: inline,min-heightandmax-heighthave no effect, and the height is limited bymin-widthandmax-widthinstead. Give the imagedisplay: blockordisplay: inline-blockif you need min/max height, or set an explicitheight.