Winamp Modern Skins Tutorial
Winamp Modern Skins Tutorial
Version 08.14.2002
TABLE OF CONTENTS
WINAMP 3: SKINNING TUTORIAL WEBPAGE......1
Winamp3 Skinning Tutorial.....................................................4
Tutorial Status Report ..................................................................................................... 4
Contact Us....................................................................................................................... 5
Skinning FAQ - Frequently Asked Questions ............................6
Frequently Asked Questions ........................................................................................... 6
Skinning FAQ - Answers ................................................................................................ 6
Winamp3 Skinning Glossary....................................................8
Frequently Asked Questions ........................................................................................... 8
Part 0. Intro to Winamp3......................................................10
Why do we need Winamp3? ......................................................................................... 10
Winamp3 Components? ................................................................................................ 10
Part I. Winamp 2 to Winamp3 ...............................................12
OUTLINE ..................................................................................................................... 12
W3 Skinning Tutorial - 2.1 Start Here!...................................13
Simple Tutorial Skin ..................................................................................................... 13
Text Editing Programs .................................................................................................. 14
A graphics program....................................................................................................... 15
Contact Us..................................................................................................................... 16
W3 Skinning Tutorial - 2.2 XML Introduction .........................17
1. So what is XML? ...................................................................................................... 17
2. XML Hierarchy......................................................................................................... 18
3. XML & Winamp ....................................................................................................... 19
W3 Skinning Tutoria l - 2.2 XML Introduction .........................20
1. Winamp3 Skin Directory Hierarchy ......................................................................... 21
2. Simple Tutorial Skin - Graphics Files ...................................................................... 23
3. Simple Tutorial Skin - skin.xml ................................................................................ 23
4. Simple Tutorial Skin - player.xml ............................................................................ 25
W3 Skinning T utorial - 2.4 Container.....................................30
Layout ........................................................................................................................... 30
W3 Skinning Tutorial - 2.5 Group ..........................................32
1. What is a group? ....................................................................................................... 32
2. Simple Tutorial: Using groups .................................................................................. 32
3. Simple Tutorial: Playback Buttons Group Definition (line 19 -64) .......................... 34
4. Simple Tutorial: Song File Information and Visualization Group Definition (line 65 107) ............................................................................................................................... 36
W3 Skinning Tutorial - 2.6 Relative Position ..........................38
1. What is a relative positioning? .................................................................................. 38
2. RelativePos.xml ........................................................................................................ 39
3. Relative Position 1: defining X&Y Coordinates ...................................................... 39
4. Relative Position 2: Specify the Height and Width .................................................. 42
5. Relative Position 3: RelatX & Negative X Coordinate ............................................ 43
6. Relative Position 4: RelatY & Negative Y Coordinate ............................................ 45
2
MISSION STATEMENT:
o The goal of this we b page is to describe the skinning process to someone with
graphics background and little programming experience. By creating this tutorial,
we hope to generate excitement and loyalty for Winamp 3.
Contact Us
Please email Ken Chen if you have any suggestions.
PS:
PSP:
Alpha Channel:
Interlace:
PNG:
XML:
XML Hierarchy:
Root File:
Studio.xnf File:
X&Y Coordinates:
Elements:
Bitmap ID:
Group:
Container:
Component:
Graphics
Short for Photoshop
Short for PaintShop Pro
An alpha channel represents the transparency information on a per -pixel
basis. You can read more here:
http://www.w3.org/pub/WWW/TR/PNG-DataRep.html#DR.Alphachannel
Interlacing produces a "layering effect" so that a grainy version of the
image is sent first, and on subsequent passes is "resolved" into the final
image. This process allows people to get an idea of wha t the image
contains before it is fully loaded.
Short for Portable Network Graphics.
XML
Extensible Mark-up Language. Used as the base for the winamp3
abstraction layer.
The manner in which XML tags may be nested within one ano ther to
form a hierarchical, recursive 'tree' structure, with parent tags enclosing
multiple child tags, which may themselves be parent tags as well. See
XML section for example.
skin.xml, this is where the interaction with xml starts.
the file with all your preferences and last known state.
As pertaining to layout code: position of the element in the layout, X
being distance from the left and Y being Distance from the top.
Winamp3 Terminology
Defining an element within a skin to be used later. Usually linking a
bitmap id to a picture or text or fonts, etc.
The identification given to an element in the elements file and the id
used in layout for said element.
A set of objects tha t can be referred to and manipulated as a whole. It
first must be defined by a <groupdef> tag, then located with a <group>
tag.
A container represents a window. It is an object that holds multiple
related layouts.
In global winamp t erms, a component is an advanced form of plugin,
which can provide nearly any kind of new functionality to the core
system. In skinner's terms, a component is the xml identity which
represents the interface for the actual component (plug -in). Not all
components will necessarily provide an obvious (or any) xml identity
(cnv_dshow.wac, for instance)
Layout:
Gamma:
Gamma controls:
Layer:
MAKI:
M file:
Maki File:
Maki Monkey:
Drawer:
A special kind of group, which shown inside a container. You can define
multiple layouts for a container but only one layout can be visible at a
time. An example is the normal mode and windowshade mode in the
Default skin.
Most common activity for a skinner is to adjust the color of an element
to "just right" to achieve the desired effect. While it is possible to adjust
an element's color using a graphics program, Winamp 3 allows you to
link an element to a gamma control and change them in the preference
menu.
Define a gamma control so the color of that gamma group can be
changed in the preference menu.
A layer is basically an image. Layers can overlay on top of each other. It
is similar to a layer in Adobe Photoshop.
MAKI stands for Make A Killer Interface.
An uncompiled Maki file containing the readable source code
A compiled M file, also known a s a script.
Someone who knows how to write M files well.
A Drawer is an animated layer that is normally hidden but can be shown
when triggered by a user event (often a mouse click).
Winamp3 Components?
Features of Winamp3:
Skin system:
o XML-based format
o freeform
o scripting
o emulation of Winamp 2.x skins
o on-the-fly bilinear filtered scaling of any winamp piece
o animations, realtime transformations
o alpha transparency
o color correction of any skin
Component architecture:
o allows any kind of plugin you can think of
o components become part of the system and extend it
o components can interoperate without even knowing who they are talking to
o component windows and interfaces are skinnable
o components are built with the same C++ library as the main product for
consistency and to enable developers to quickly create powerful addons
o using a dispatchable interface to make interaction of multiple plugin versions
easier
New audio playback system:
o crossfading
o "dsp" plugins can be stacked
o gapless output (even for cd playback)
10
Playlist:
o XML-based format
o ability to queue up files in playlist out of order (hold down alt)
o Media library
Database:
o caching
o queries
o multiple indexes and views on tables
11
12
We're going to show you how to make a simple skin like the one shown below. Download
the "Simple Tutorial Skin" example
(http://download.nullsoft.com/winamp/skin-dev/SimpleTutorial.wal)
When you save the file, make sure that the type of the file is selected to "All Type" and
NOT "Winzip" filetype. You should save the file into your skin subdirectory in your
Winamp3 directory. For most people, that path is "C: \Program Files \Winamp3\Skins".
13
2) However, if you intend to do alot of coding rather a quick editing, we recommend you to use
something like EditPlus. EditPlus will automatically color your HTML and XML code. The coloring
makes it easier for you to see your code and find missing closing tags. Here's what it looks like.
14
You can select the type of coloring by going to "Document" menu => "Change File Type..."
A graphics program
We recommend Adobe Photoshop (www.adobe.com) or Paintshop Pro (www.psp.com). Here're
some tutorials (http://forums.winamp.com/showthread.php?s=&threadid=93803) if you're new to
graphics.
15
Contact Us
Please email Ken Chen if you have any suggestion.
16
1. So what is XML?
XML stands for eXtensible Markup Language (XML). You hear about XML everywhere. We're
going to give you a quick and dirty guide to XML and its relevance to Winamp. XML is just lik e
HTML. If you know HTML, you can pick up XML very quickly. So don't be afraid.
HTML and XML are from the same family of what is called SGML (Standard Generalized Markup
Language). SGML was invented as a text -based language that can be used to mark up dat a that is, add metadata - in a way which is self describing. What does this mean? Basically SGML
is a way for programmers to transfer and display information. The best known application of
SGML is HyperText Markup Language, or HTML. HTML is a universal m arkup language for the
display of information and the linking of different pieces of information. The idea was that any
HTML document (or web page ) would be presentable in any application that was capable
understanding HTML (namely a web browser).
Although HTML has been incredibly successful, it's also limited in its scope: it is only intended for
displaying documents in a browser. It is not particularly useful as a medium to convey information
to other programs. Don't understand? Here let me give you an e xample.
For example, if I want to tell everyone my name, there are many ways I can do this:
a) I can create a text file on a computer that look like this. When I send you this text file, you can
read it or write a program to parse it. By reading "Ken Che n" in the text file, you can guess that
it's my name. But then again, are you sure? It's not really clear, right? Lets look at the next
example.
Ken Chen
b) For the web, I can create an HTML file like this. I can put it on a web site and you can see the
page in your browser. Once again, by just reading "Ken Chen" you're not really sure that it's my
name.
<HTML>
<HEAD><TITLE>Name</TITLE></HEAD>
<BODY>
<P>Ken Chen</P>
17
</BODY>
</HTML>
c) XML is a standard for conveying information. I might create an XML file like this. Looking at this
file, you can see that it looks very much like an HTML file. The style is very similar. The difference
is that in XML, you can design or come up with any tag you want to convey the information you
want. Reading this simple example, you can tell that my first name is Ken and my last name is
Chen.
<Name>
<First>Ken</First>
<Last>Chen</Last>
</Name>
From this simple example you can see why markup language like SGML and XML are called self describing. Looking at the data, you can easily tell that this is information about a <name> and
you can see that there is data called <first> and another data called <last>.
d) You could write a shorter version of the previous XML by using element attributes. l ike so:
<button
id="Previous"
action="PREV"
x="0" y="0"
image="player.button.previous"
downImage="player.button.previous.pressed"
tooltip="Previous"
/>
2. XML Hierarchy
The beauty of XML is that you can design whatever format you want to describe your data. The
key is that you follow the XML hierarchy (we'll describe in the next section. Other than that, make
sure you close the tag when you one. (ie: make sure you have </name> if you open a <name>
tag.
XML has a hierarchy that you need to follow. This is much like the HTML code where you embed
18
a tag within a tag. By doing that, you're creating another level in the hierarchy. Mak e sure you
close your tags correctly. Check out this example.
<Winamp Employee>
<Name>
<First>Ken</First>
<Last>Chen</Last>
</Name>
<Email>[email protected]</Email>
<Location>San Francisco, CA</Location>
</Winamp Employee>
In this example, we have <Name>, <Email> and <Location> as level 1 tags. Within the <Name>
tag, we have two level 2 tags: <First> and <Last>.
XML is basically a way to store data. Now we've shown you what XML is, you may ask: what
does that have to do with Winamp? Well, XML is fully implemented in Winamp. From the skinning
files to the playlist, it's all XML based. I've gone over the basics of XML. I'll go over Winamp XML
elements and dissect apart a simple skin example in the next section.
19
We will begin with a simple skin example. I'll give you the essential parts of the skin. In the next
section, I'll demonstrate important Winamp3 concepts using this skin. The topics that I'll go over
are:
1.
2.
3.
4.
20
a) Skin Hierarchy
Before you start playing with a skin, you hav e to know where everything is. Above is a picture of
the Winamp3 directory. If you open that directory ("C: \Program Files \Winamp3") with Windows
Explorer, it should pretty similar. The section in blue is the "Skin" directory and the directory that
we care about. Within the "Skin" directory, there are sub -directories and files. Each sub -directory
and WAL files are a skin. WAL is Winamp3 skin format. Next section talks about how to
manipulate it.
b) .WAL files
Instead of a directory for a skin, you may see only one file with a .WAL extension. Don't worry.
21
WAL (Winamp Abstraction Layer) is Winamp3 skin format. It is basically a zipped file of the skin
directory. We do this to save space and to make it easier to distribute the skins. To make
changes to that skin, do the following:
1) Rename the .WAL file to .ZIP
2) Open that file with Winzip. If you don't have it, you can get it here. www.winzip.com
3) Unzip the content into a directory.
c) Required File
Lets take a look at what's in a skin directory. We'll use the "Simple Tutorial" as an example. Keep
in mind that other skins may contain other files and directories that are not shown. What we're
showing here is the bare minimum example.
Within the "Simple Tutorial" skin directory, there are three items: 1) Skin.xml file, 2) "Player"
directory, 3) "XML" directory. The only required file for a skin is the Skin.xml file. It is the file that
the Winamp3 skin engine looks for. You can say that it is the entry point for t he skin. From that
file, all the fun starts. =) I will dissect that file later on.
The "Player" directory contains all the graphics file for the skin. The files are in .PNG (Portable
Network Graphics) format. The "XML" directory is usually where all the X ML files are located.
Because our skin is relatively simple, there is only one file in that directory.
d) #include in XML files
One more thing I want to go over is the <include file="xml/player.xml"/ > tag. When the Winamp
skinning engine parses this XM L file and encounters that tag, it grabs the file specified within that
tag and paste whatever code that is inside that file into the current file. So in this example, we're
looking at the skin.xml file. The skinning engine will grab player.xml file in the xml subdirectory
and paste whatever code that is inside player.xml into skin.xml. This process is recursive. This
means that if there's any include file tag inside player.xml, it will get those code also.
22
These are the graphics that I've used in creating Simple Tutorial skin. One thing to notice is that
we like to use PNG file format. Please also use that format too. The graphics files are the parts
that we're going to use for our skin. We will define the m as elements and link them into our XML
code later in order to use them.
The required file for any skin is the Skin.xml file. You can locate this file in your "C: \Program
Files\Winamp3\Skins\Simple Tutorial" directory. The content of that file is posted above. I'll go
over all the parts. I have listed line number on the left and the code on the right. You can open
your version and follow along.
23
a) <?XML> (line 1)
The first line of the Skin.xml file should be the line shown above. The line identifies Skin.xml as
an XML file. It is important to remember that you only that line only once in Skin.xml. If you divide
your xml into several files, do not include that line in other xml files. Subsequent xml files wi ll be
pasted into Skin.xml file by the skin engine.
b) <WinampAbstractionLayer> (line 3)
The WinampAbstractionLayer tag is used to specify which skin version you're following. The
version that "Simple Tutorial" skin is made for is 0.8. This tag is use d to track compatibility. We
will keep compatibility as long as possible. But sometimes when we introduce a new functionality
and change an existing one, compatibility is broken and we will increment the version number.
You will need to update the skin to conform to the new standard. If the skin engine finds your
version number is different than the current version, you will see the warning below. However,
this does not mean that your skin will no longer work. If functionality that has been changed is not
implemented in your skin, you skin will continue to function.
The tags are all pretty self-explanatory. But lets go over them anyways for fun.
24
The first section of your XML should be a comment section that briefly explains the functionalities
of the file. This way it will be easy for others to read and understand your code.
b) Elements definition (line 4-18)
25
This section defines all the elements in your skin. This is the part that links the graphics to a
"bitmap id" that other XML code can refer to. For example, line 11 links a bitmap id, "blueplayer.button.previous", to a graphics component in "player/blue/blue-previous.png" file. That
bitmap id is also linked t o a gamma group called "Buttons". After linking that object to a gamma
group, user can adjust the color variance of that object in the preference menu. Therefore, even if
that object is blue right now, you can change it so that it'll appear to be a differe nt color.
As your skin becomes more complex, you will have many elements defined in your skin. It will be
useful to break the <Elements> definitions into different files. Typically, one would define all the
elements in each component in separate files. Fo r example, elements in the main player will be in
"player-elements.xml" and elements in the playlist will be in "pledit-elements.xml".
c) Playback Buttons Group Definition (line 19-64)
26
Sometime a group of objects naturally belong together or are loc ated next to each other. If you
move one of them, chances are that you'll be moving the rest of them. The playback buttons is an
excellent example. If you want to change the location of those button, rather than moving each
element independently, you can define a group and move the group together. A group is a set of
objects that can be referred to and manipulated as a whole. It is a like a bag to throw your stuff
into. It first must be defined by a <groupdef> tag, then can be located with a <group> tag. In
section 2.5, we're going to dissect it even more.
27
SongInfo group is another group definition just like the Playback Buttons group. As you can see
that the elements defined i nside this group is different from the previous one. In this example,
we're using elements other than buttons. We're using the layer to set the background color of two
areas. A layer is basically an image. Layers can overlay on top of each other. It is sim ilar to a
28
layer in Adobe Photoshop. "Songinfo" and "infoline" are text objects displaying information stored
within Winamp3 runtime variables.
Previous sections are all about defining objects. Now we get to start using them. If you read the
code, you'll see that there is a container object, a layout object and two group objects. Container
is at the top of hierarchy because everything else "lives" in it. Within the container, we have
defined a layout an d, within the layout, we're using the groups we defined earlier.
Container, layout and group are important concept and we will go more in depth in subsequent
sections. Read on....
29
Layout
What is a layout?
A layout is a special kind of group, which shown inside a container. Each layout represents an
appearance for that window. Layouts give you the ability to design different looks for the same
container (or window). However, only one layout can be visible at a time. You must toggle among
layouts you defined. An example is the normal mode and windowshade mode in the Default skin.
The top image is using normal layout and the bottom is using t he windowshade layout.
30
31
1. What is a group?
A group is a set of objects that can be referred to and manipulated as a whole. First must defined
by a <groupdef> tag, then located with a <group> tag. Group is an important c oncept to
understand because a group is such a versatile object.
32
If we change line 113 and 114: change the x&y coordinates of the group objects, their positions
are reversed. This is a simple change and much more convenient than changing the position of
each element independently.
33
34
Line 19-64 is a group definition of the playback buttons. This section contains only the definition
of the group or, in another word, it defines which objects are in th e group. Once the group is
defined, you can use it later as we will see later. Lets go over the elements inside the group.
35
SongInfo group is another group definition just like the Playback Buttons group. As you can see
that the elements defined inside this group is different from the previous one. In this example,
we're using elements other than buttons. We're using the layer to set the background color of two
areas. A layer is basically an image. Layers can overlay on top of each other. It is similar to a
layer in Adobe Photoshop. "Songinfo" and "infoline" are text objects displaying information stored
within Winamp3 runtime variables.
36
37
38
2. RelativePos.xml
Relativepos.xml uses elements from the SimpleTutorial skin. I am using the "blue -vis-layer.png"
and "red-vis-layer.png" in the Player directory.
A. register_autopopup="1"
Before we delve into the code, I want to go over one feature. Take a look at this tag:
When you add this tag to a groupdef, Winamp3 automatically wrap a
container and layout around it and allow you to see the group in a separat e window. This is
particularly useful when you want to test the behavior of that group separate from everything else.
To open that window, right click on the Main Player to bring up the menu. Go to the "Windows"
submenu and you'll see the extra windows rel ativepos.xml has created. Open them up and try
them out.
39
40
41
In group 2, we're defining the height and width of the blus -vis layer that is larger than the image.
When you do that, Winamp will stretch the image to that size. Likewise, if you specify height or
width that is smaller than the image, Winamp will shrink the image to fit to that size.
42
Line 30-39 defines a group wi th a "blue-vis" layer at the coordinate of ( -120,30). Notice that we
have an extra line on line 34: "relatx=1". By setting relatx to 1, you're telling Winamp to start the x coordinate from the right edge of the window. Note that the X -Coordinate should be negative;
otherwise the blue-vis layer will not show up.
This is a convenient feature if you want an element stick to a specific distance relative to the right
edge of the window. Notice that when I resize the window, the blue -vis layer stays fixed distan ce
relative to the right edge of the window.
43
Line 40-49 defines a group with a "blue -vis" layer at the coordinate of (20, -80). Notice theline on
line 44: "relaty=1". By setting relaty to 1, you're telling Winamp to start the y -coordinate from the
bottom edge of the window. Note that the Y -Coordinate should be negative; otherwise the blue vis layer will not show up.
This is a convenient feature if you want an element stick to a specific distance relative to the
bottom edge of the window. Notice that when I resize the window, the blue -vis layer stays fixed
distance relative to the bottom edge of the window.
45
46
Line 50-72 demonstrate the use of relath and relatw. From the beginning of this section we know
that by defining height and width different from the original image size, Winamp3 will
automatically stretch or shrink the image to fit that size constraint. What is powerful (and
awesome) about Winamp3 is that you can also tell Winamp3 to adjust the height and width of an
element with respect to the right and bottom edge of the window. This is accomplished through
"relath" and "relatw".
In our example, we defined a b lue-vis group (lines 52 -60) and a red -vis group that encompasses
the blue-vis group (lines 63 -72). The blue-vis group is defined with no preset x, y, h or w because
we will define them on line 71.
The magic happens on line 71. With relath set to 1 and re latw set to 1, we're telling Winamp3 to
stretch or shrink the blue -vis layer so that it is 50 pixels away from the right and bottom edge of
the window. The blue -vis layer is stretched and the distance is maintained as I expanded the size
of the window.
47
*RPOS5 window with relath=1 and relatw=1; window resized; Blue-vis layer stretched
48