*.br2 documentation
Moderators: Hacker, petermad, Stefan2, white
*.br2 documentation
@Ghisler
Is it possible to provide some details about how to use the button bar's cache file (*.br2), it is requested for my new tool Button Bar Editor
Is it possible to provide some details about how to use the button bar's cache file (*.br2), it is requested for my new tool Button Bar Editor
- ghisler(Author)
- Site Admin
- Posts: 50532
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
The format is as follows:
- 4 byte checksum (to check whether it's still in sync with .bar file)
- 4 byte size of next block - if 0, it's an empty icon. Each icon starts with this size field
- 1 byte: if 0, there follows a monochrome+color bitmap, otherwise just one monochrome for black+white icons (double hight)
- sizeof(BITMAPINFOHEADER): BITMAPINFOHEADER structure for the black+white mask, +2 bytes palette
- the actual image data of the mask
- the mask data. bwimagesize:=((headermask.bmWidth+31) and not 31) div 8*headermask.bmheight;
- if not monochrome:
- sizeof(BITMAPINFOHEADER): BITMAPINFOHEADER structure for color image
- the palette (if required according to the header) and bitmap bits follow.
If biBitCount=32, TC uses CreateDIBSection followed by a byte copy to the buffer returned by CreateDIBSection to create the bitmap.
If biBitCount=1, TC uses CreateBitmap followed by SetDIBits.
Otherwise, TC uses CreateCompatibleBitmap followed again by SetDIBits to create the bitmap.
Finally, use CreateIconIndirect to create the icon, and DeleteObject to delete color and mask bitmaps.
Here is the calculation of the palette size and image data size:
ClrBits:=pbih.biPlanes * pbih.biBitCount;
if ClrBits=1 then ClrBits:=1
else if ClrBits<=4 then ClrBits:=4
else if ClrBits<=8 then ClrBits:=8
else if ClrBits<=16 then ClrBits:=16
else if ClrBits<=24 then ClrBits:=24
else ClrBits:=32;
if ClrBits<=8 then palettesize:=1 shl ClrBits
else palettesize:=0;
trueimagesize:=((pbih.biWidth * ClrBits +31) and not 31) div 8*pbih.biHeight;
- 4 byte checksum (to check whether it's still in sync with .bar file)
- 4 byte size of next block - if 0, it's an empty icon. Each icon starts with this size field
- 1 byte: if 0, there follows a monochrome+color bitmap, otherwise just one monochrome for black+white icons (double hight)
- sizeof(BITMAPINFOHEADER): BITMAPINFOHEADER structure for the black+white mask, +2 bytes palette
- the actual image data of the mask
- the mask data. bwimagesize:=((headermask.bmWidth+31) and not 31) div 8*headermask.bmheight;
- if not monochrome:
- sizeof(BITMAPINFOHEADER): BITMAPINFOHEADER structure for color image
- the palette (if required according to the header) and bitmap bits follow.
If biBitCount=32, TC uses CreateDIBSection followed by a byte copy to the buffer returned by CreateDIBSection to create the bitmap.
If biBitCount=1, TC uses CreateBitmap followed by SetDIBits.
Otherwise, TC uses CreateCompatibleBitmap followed again by SetDIBits to create the bitmap.
Finally, use CreateIconIndirect to create the icon, and DeleteObject to delete color and mask bitmaps.
Here is the calculation of the palette size and image data size:
ClrBits:=pbih.biPlanes * pbih.biBitCount;
if ClrBits=1 then ClrBits:=1
else if ClrBits<=4 then ClrBits:=4
else if ClrBits<=8 then ClrBits:=8
else if ClrBits<=16 then ClrBits:=16
else if ClrBits<=24 then ClrBits:=24
else ClrBits:=32;
if ClrBits<=8 then palettesize:=1 shl ClrBits
else palettesize:=0;
trueimagesize:=((pbih.biWidth * ClrBits +31) and not 31) div 8*pbih.biHeight;
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
- ghisler(Author)
- Site Admin
- Posts: 50532
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
So Great!ghisler(Author) wrote:The format is as follows:
- 4 byte checksum (to check whether it's still in sync with .bar file)
- 4 byte size of next block - if 0, it's an empty icon. Each icon starts with this size field
- 1 byte: if 0, there follows a monochrome+color bitmap, otherwise just one monochrome for black+white icons (double hight)
- sizeof(BITMAPINFOHEADER): BITMAPINFOHEADER structure for the black+white mask, +2 bytes palette
- the actual image data of the mask
- the mask data. bwimagesize:=((headermask.bmWidth+31) and not 31) div 8*headermask.bmheight;
- if not monochrome:
- sizeof(BITMAPINFOHEADER): BITMAPINFOHEADER structure for color image
- the palette (if required according to the header) and bitmap bits follow.
If biBitCount=32, TC uses CreateDIBSection followed by a byte copy to the buffer returned by CreateDIBSection to create the bitmap.
If biBitCount=1, TC uses CreateBitmap followed by SetDIBits.
Otherwise, TC uses CreateCompatibleBitmap followed again by SetDIBits to create the bitmap.
Finally, use CreateIconIndirect to create the icon, and DeleteObject to delete color and mask bitmaps.
Here is the calculation of the palette size and image data size:
ClrBits:=pbih.biPlanes * pbih.biBitCount;
if ClrBits=1 then ClrBits:=1
else if ClrBits<=4 then ClrBits:=4
else if ClrBits<=8 then ClrBits:=8
else if ClrBits<=16 then ClrBits:=16
else if ClrBits<=24 then ClrBits:=24
else ClrBits:=32;
if ClrBits<=8 then palettesize:=1 shl ClrBits
else palettesize:=0;
trueimagesize:=((pbih.biWidth * ClrBits +31) and not 31) div 8*pbih.biHeight;
I am also searching the format of *.br2 files
It's so slowly to read the icons of programs of TC's ToolBar one by one directly!