B.1. Overview
上一页 | 附录 B. MPlayer skin format | 下一页

## B.1. Overview

### B.1.1. Skin components

Skins are quite free-format (unlike the fixed-format skins of Winamp/XMMS, for example), so it is up to you to create something great.

Currently there are four windows to be decorated: the main window, the video window, the playbar, and the skin menu.

- The main window is where you can control MPlayer. The playbar shows up in fullscreen mode when moving the mouse to the bottom of the screen. The background of the windows is an image. Various items can (and must) be placed in the window: buttons, potmeters (sliders) and labels. For every item, you must specify its position and size.

  A button has three states (pressed, released, disabled), thus its image must be divided into three parts placed below each other. See the button item for details.

  A potmeter (mainly used for the seek bar and volume/balance control) can have any number of phases by dividing its image into different parts. See hpotmeter for details.

  Labels are a bit special: The characters needed to draw them are taken from an image file, and the characters in the image are described by a font description file. The latter is a plain text file which specifies the x,y position and size of each character in the image (the image file and its font description file form a font together). See dlabel and slabel for details.

  ### 注意

  All images can have full transparency as described in the section about image formats. If the X server doesn't support the XShape extension, the parts marked transparent will be black. If you'd like to use this feature, the width of the main window's background image must be dividable by 8.

- The video window is where the video appears. It can display a specified image if there is no movie loaded (it is quite boring to have an empty window :-)) Note: transparency is not allowed here.

- The skin menu is just a way to control MPlayer by means of menu entries (which can be activated by a middle mouse button click). Two images are required for the menu: one of them is the base image that shows the menu in its normal state, the other one is used to display the selected entries. When you pop up the menu, the first image is shown. If you move the mouse over the menu entries, the currently selected entry is copied from the second image over the menu entry below the mouse pointer (the second image is never shown as a whole).

  A menu entry is defined by its position and size in the image (see the section about the skin menu for details).

There is an important thing not mentioned yet: For buttons, potmeters and menu entries to work, MPlayer must know what to do if they are clicked. This is done by messages (events). For these items you must define the messages to be generated when they are clicked.

### B.1.2. Image formats

Images must be PNGs—either truecolor (24 or 32 bpp) or 8 bpp with a RGBA color palette.

In the main window and in the playbar (see below) you can use images with `transparency': Regions filled with the color #FF00FF (magenta) are fully transparent when viewed by MPlayer. This means that you can even have shaped windows if your X server has the XShape extension.

### B.1.3. Files

You need the following files to build a skin:

- The configuration file named skin tells MPlayer how to put different parts of the skin together and what to do if you click somewhere in the window.

- The background image for the main window.

- Images for the items in the main window (including one or more font description files needed to draw labels).

- The image to be displayed in the video window (optional).

- Two images for the skin menu (they are needed only if you want to create a menu).

With the exception of the skin configuration file, you can name the other files whatever you want (but note that font description files must have a `.fnt` extension).

上一页 | 上一级 | 下一页
附录 B. MPlayer skin format | 起始页 | B.2. The skin file