Expand description
A Winamp skin engine. It reads a modern skin (a .wal file: XML, images and MAKI
scripts) or a classic skin (a .wsz file, see classic), runs the scripts, lays the
windows out and hands the host a draw list for each frame. The host owns the screen, the
images, the fonts, the touch input and the player; the engine never draws, reads a file or
plays a sound.
cargo add walkit§Where to start
SkinRuntimeruns one skin: load it, tick it each frame, take its draw list.host::SkinHostis what the host implements for pictures, text measuring and logging.player::Playeris the transport the skin’s buttons and sliders drive;player::FakePlayerplays nothing and is enough for a first look.files::MemoryFilesholds the entries of a skin archive, andfiles::LayeredFilesputs the skin over a base (Winamp’s wasabi folder or a classic base skin).draw::DrawCmdis one command of the draw list: images, fills, text, clips, shapes.inforeads what a skin says about itself (author, version, containers, readme) for a host that shows a skin’s details without loading it.
The guide explains how it works, and its Rust page builds a first host step by step.
§Features
truetype: TrueType text drawn as Windows draws it, for hosts that draw their own letters into a buffer of pixels (adds theskrifacrate). It adds thetruetypemodule.
Re-exports§
pub use runtime::SkinRuntime;
Modules§
- classic
- Classic skins (
.wsz:main.bmp,cbuttons.bmp,titlebar.bmp,text.bmp,numbers.bmpand the rest), drawn as Winamp 5.666 draws them: each window is a generated container with one classic window object whose drawing and touches are the ones Winamp does, pixel for pixel (measured against Winamp 5.666 in a VM). The windows themselves, their docking, raising and the touch routing are the engine’s, as for a modern skin. - draw
- What the renderer draws, in order, in layout pixels: the draw list and the pieces it is made of (rectangles, parts of skin pictures, colors and tints, fonts, regions).
- files
- The files of a skin, looked up by path without regard to case or slash direction, and the ways a host stacks them: a base under a skin (Winamp’s wasabi base under a modern skin, a base skin under a classic one), and the sibling skins of a Skins folder a path may reach into.
- gdi
- Where the glyphs of a text come from, and a TrueType font’s line as Windows lays it out.
- generated
- Pictures Winamp makes instead of reading a file.
<bitmap file="$solid" w h color alpha>is a w x h picture of one color (DeClassified’s playlist middle and frame texture). The bitmap element is given a made-up file name that holds everything needed, so a host’s files can answer it with the picture. - gui
- The GUI objects of a loaded skin: what each kind of object keeps, held in one arena by the
runtime and reached by index. The runtime does the work on them (
runtime), as every object’s behavior reaches into the skin around it. - host
- What the engine asks of its host, and what it tells the host about its windows.
- info
- What a skin says about itself, read from its files: who made it and what is in it, for a host that shows a skin’s details (a skin browser, an about box, a command-line listing).
- listing
- The draw list and a menu as text, one command per line: the lines of the trace (
trace v1), and the form a host that takes the draw list as text reads. Rects areleft,top,width,height, colors#rrggbb, fractions have two decimals. - maki
- MAKI, the compiled script language of a modern skin: values, programs, the parser, the standard library’s table, and what a loaded script keeps. The runtime runs the bytecode.
- packed
- The draw list of a frame as one packed buffer, for a host across a language boundary that
takes a frame in one call and decodes it into draw commands on its side (the Android
binding). Little-endian throughout; strings are interned in a table at the front, so a file
name drawn forty times crosses once. A window’s commands cross only where they changed:
the writer keeps what it sent of each window, and the host keeps what it decoded, so a
frame says for each window which stretches of the frame before to keep and which commands
are new (
FrameWriter). - plan
- What a renderer may keep of each window between frames: the objects that change from frame to frame, kept apart as live runs, and the rest of the window, each with a version that moves when its drawing does.
- player
- The player as a modern skin sees it, and a player that plays nothing.
- runtime
- A loaded modern skin: its resources, its containers, its scripts, and the glue between the
player and the objects. Everything runs on one thread; the app calls
tickregularly anddraw_windowswhen something changed. - text
- A line of text: a fixed string, or a player display such as the time or the song name. With
ticker="1"a string wider than the box scrolls. - truetype
truetype - TrueType text as Winamp draws it, for hosts that draw the letters themselves (behind the
truetypefeature; the engine itself never draws). Winamp draws a skin’s TrueType text in one of two ways, aStyle: - xml
- A forgiving XML reader for skin files.
Constants§
- TRACE_
VERSION - The version of the trace text the engine writes in a scripted run (
trace v1).