What is an animated cursor?

Please read the following topic because it contains useful information about how AniTuner creates animated cursors.

How are stored animated cursors?

The .ani file format is used for reading and storing Windows Animated Cursors (animated mouse pointer). A .ani file is a structured format (Microsoft RIFF) that contains information about the animation (author & title, steps, length & order of each step...) followed by several frames stored in the icon format.

Like movies and cartoons, several icon frames such as    are displayed one by one and this leads to the final animated cursor:  .

Each frame/step in an animated cursor is displayed during a short time (delay or length): this is the frame timing.

This time is measured in jiffies; 1 jiffy=1/60th of a second~16,66ms.

What are icons and why do they look transparent?

An icon is a picture that consists of a bitmapped image combined with a mask to create transparent areas in the picture.

In AniTuner the most important bitmap called "Color bitmap" contains the non-transparent image (what we want to show) and the rest of the bitmap (the background) is filled with a given color named the transparent color; on this example the transparent color is fuchsia:

The second bitmap is called the "Mask bitmap": this bitmap contains only two colors: black and white. The black region corresponds to the transparent part of the color bitmap and the white region to the non-transparent part:

The color bitmap is then combined with the mask bitmap to render transparency. We take a pixel in the color bitmap: if the corresponding one in the mask is black, then we know that the resulting pixel should be transparent. Otherwise if the corresponding one in the mask is white, then the colored pixel is displayed. This gives the following result:

When creating a cursor frame (icon format), AniTuner takes the color bitmap and replaces all pixels corresponding to the transparent color with black. On the contrary remaining pixels are replaced by white. You get the "mask bitmap" that will be used to create the icon transparency.

So be sure to always select a transparent color that is not used in your image. Generally fuchsia or teal are good choices for the transparent color.

How can I use animated cursors with Windows?

If your .ani files are correctly associated, you can preview them using Windows Explorer: just hit an animated cursor file and select the File Properties shell menu command. Windows will then display the animated cursor on the Properties tab.

Animated cursor may also be used to customize the Windows mouse pointers too: the mouse applet in the Windows control panel lets you change the cursors used during different operations (wait, no selection, etc...). Select the "Pointers" tab in the mouse applet and then highlight the pointer you want to replace. Click on the "Browse" button and finally select the animated cursor you want.

For programmers only

If you are interested in the animated cursor format itself, then visit the useful site www.wotsit.org by Paul Oliver, and look for ANI.
Otherwise you can read the following extract of a post by R. James Houghtaling regarding the ANI format:

<< This is a paraphrase of the format. It is essetially just a RIFF file with extensions... (view this monospaced)
This info basically comes from the MMDK (Multimedia DevKit). I don't have it in front of me, so I'm going backwards from a VB program I wrote to decode .ANI files.

"RIFF" {Length of File}
"ACON"
"LIST" {Length of List}
"INAM" {Length of Title} {Data}
"IART" {Length of Author} {Data}
"fram"
"icon" {Length of Icon} {Data} ; 1st in list
...
"icon" {Length of Icon} {Data} ; Last in list (1 to cFrames)
"anih" {Length of ANI header (36 bytes)} {Data} ; (see ANI Header TypeDef )
"rate" {Length of rate block} {Data} ; ea. rate is a long (length is 1 to cSteps)
"seq " {Length of sequence block} {Data} ; ea. seq is a long (length is 1 to cSteps)

-END-

- Any of the blocks ("ACON", "anih", "rate", or "seq ") can appear in any order. I've never seen "rate" or "seq " appear before "anih", though. You need the cSteps value from "anih" to read "rate" and "seq". The order I usually see the frames is: "RIFF", "ACON", "LIST", "INAM", "IART", "anih", "rate", "seq ", "LIST", "ICON". You can see the "LIST" tag is repeated and the "ICON" tag is repeated once for every embedded icon. The data pulled from the "ICON" tag is always in the standard 766-byte .ico file format (for the 16-color animated cursors only).

- All {Length of...} are 4byte DWORDs.

- ANI Header TypeDef:

struct tagANIHeader {
DWORD cbSizeOf; // Num bytes in AniHeader (36 bytes)
DWORD cFrames; // Number of unique Icons in this cursor
DWORD cSteps; // Number of Blits before the animation cycles
DWORD cx, cy; // reserved, must be zero.
DWORD cBitCount, cPlanes; // reserved, must be zero.
DWORD JifRate; // Default Jiffies (1/60th of a second) if rate chunk not present.
DWORD flags; // Animation Flag (see AF_ constants)
} ANIHeader;

#define AF_ICON =3D 0x0001L // Windows format icon/cursor animation


R. James Houghtaling >>

Opening an animation file

Browse for animated cursors