Skip to content

Instantly share code, notes, and snippets.

@amurzina
Created November 8, 2017 04:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amurzina/1365eb4fa1a8ee02df961a204c60bd16 to your computer and use it in GitHub Desktop.
Save amurzina/1365eb4fa1a8ee02df961a204c60bd16 to your computer and use it in GitHub Desktop.
Examine the format of * .ani file, look in the file. After the `BitmapInfoHeader` header, there is a block with the image data of each frame. The header shows that the number of bits per pixel is `BitCount = 32`. To store the image of each frame, a mask with cursor pixels (XOR mask) and a one-bit transparency mask (AND mask) are used.
```
XOR mask: (IconDirEntry.Width * IconDirEntry.Height * BitCount) / 8 = 32 * 32 * 32/8 = 4096 bytes
AND mask: (IconDirEntry.Width * IconDirEntry.Height) / 8 = 32 * 32/8 = 128 bytes
```
For 32-bit images, an AND mask is not required, but recommended. It is necessary to pay attention to this mask. Get 1024 bits from this mask from each frame, and convert to 32x32 pixels image (where "1" is white, and "0" is a black pixel). Notice that there is a symbol in this image. Compose a flag.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment