This is very strange. I've got it working now:
ICO header:
2 reserved. should always be 0
2 type. 1 for icon (.ICO), 2 for cursor (.CUR) file
2 count; number of images in the file
'DIRECTORY:
1 width, should be 0 if 256 pixels
1 height, should be 0 if 256 pixels
1 colour count, should be 0 if more than 256 colours
1 reserved, should be 0
2 colour planes, should be 0 or 1
2 bits per pixel (should be 32)
4 size in bytes of the bitmap data
4 offset, bitmap data address in the file
'THEN ICO DATA HEADER:
4 HEADER SIZE
4 PIXMAP WIDTH
4 Pixmap Height
2 Color planes (must be 1)
2 the number of bits per pixel, which is the color depth of the image. Typical values are 1, 4, 8, 16, 24 and 32.
4 the compression method being used. (0-uncompressed)
4 the image size. This is the size of the raw bitmap data . should not be confused with the file size.
4 the horizontal resolution of the image. (pixel per meter, signed integer, usually 2835)
4 the vertical resolution of the image. (pixel per meter, signed integer, usually 2835)
4 the number of colors in the color palette, or 0 to default to 24 or 32 bits.
4 the number of important colors used, or 0 when every color is important; generally ignored.
RAW DATA:
The raw data is a long list of pixles (stored from 0,Height to width,0) in format BGRA
After this RAW data, a 1-bit bitmap is also RAW saved. If you save it as a back of bytes with the value 0, it will get the Alpha channel instead.
Hope it help if anybody else is interested.
Thanks to everyone.
That works! (The mumber before every field is to inform about the bytes of the data, 1=Byte, 2=16bits int, 4=32bits int, etc.)
ICO header:
2 reserved. should always be 0
2 type. 1 for icon (.ICO), 2 for cursor (.CUR) file
2 count; number of images in the file
'DIRECTORY:
1 width, should be 0 if 256 pixels
1 height, should be 0 if 256 pixels
1 colour count, should be 0 if more than 256 colours
1 reserved, should be 0
2 colour planes, should be 0 or 1
2 bits per pixel (should be 32)
4 size in bytes of the bitmap data
4 offset, bitmap data address in the file
'THEN ICO DATA HEADER:
4 HEADER SIZE
4 PIXMAP WIDTH
4 Pixmap Height
2 Color planes (must be 1)
2 the number of bits per pixel, which is the color depth of the image. Typical values are 1, 4, 8, 16, 24 and 32.
4 the compression method being used. (0-uncompressed)
4 the image size. This is the size of the raw bitmap data . should not be confused with the file size.
4 the horizontal resolution of the image. (pixel per meter, signed integer, usually 2835)
4 the vertical resolution of the image. (pixel per meter, signed integer, usually 2835)
4 the number of colors in the color palette, or 0 to default to 24 or 32 bits.
4 the number of important colors used, or 0 when every color is important; generally ignored.
RAW DATA:
The raw data is a long list of pixles (stored from 0,Height to width,0) in format BGRA
After this RAW data, a 1-bit bitmap is also RAW saved. If you save it as a back of bytes with the value 0, it will get the Alpha channel instead.
Hope it help if anybody else is interested.
Thanks to everyone.
That works! (The mumber before every field is to inform about the bytes of the data, 1=Byte, 2=16bits int, 4=32bits int, etc.)