Skip to main content

Crate walkit

Crate walkit 

Source
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

  • SkinRuntime runs one skin: load it, tick it each frame, take its draw list.
  • host::SkinHost is what the host implements for pictures, text measuring and logging.
  • player::Player is the transport the skin’s buttons and sliders drive; player::FakePlayer plays nothing and is enough for a first look.
  • files::MemoryFiles holds the entries of a skin archive, and files::LayeredFiles puts the skin over a base (Winamp’s wasabi folder or a classic base skin).
  • draw::DrawCmd is one command of the draw list: images, fills, text, clips, shapes.
  • info reads 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 the skrifa crate). It adds the truetype module.

Re-exports§

pub use runtime::SkinRuntime;

Modules§

classic
Classic skins (.wsz: main.bmp, cbuttons.bmp, titlebar.bmp, text.bmp, numbers.bmp and 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 are left,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 tick regularly and draw_windows when 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.
truetypetruetype
TrueType text as Winamp draws it, for hosts that draw the letters themselves (behind the truetype feature; the engine itself never draws). Winamp draws a skin’s TrueType text in one of two ways, a Style:
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).