Hello,
Here is a patch that fixes the Windows Icon write function.
Who do I
talk to so that
this patch may eventually find its way into ImageMagick?
This patch is based on ImageMagick 6.2.9-8. But the file
"icon.c"
hasn't changed in
the latest 6.3.0-x release.
http://www.cit.gu.edu.au/~anthony/graphics/imag
ick6/bugs/testing/
This is how I found out that the Windows Icon creation isn't
working properly.
Best regards, Robert
====================
============================================================
=======
RCS file: RCS/icon.c,v
retrieving revision 1.1
diff -r1.1 icon.c
817c817
<
bytes_per_line=4*((image->columns*icon_info.bits_per_pixe
l+31)/32);
---
> bytes_per_line=(((image->columns *
icon_info.bits_per_pixel) + 31) & ~31) >>
3;
819,826d818
< if (image->matte == MagickFalse)
< icon_info.size=40;
< else
< {
< icon_info.size=108;
< icon_info.file_size+=68;
< icon_info.offset_bits+=68;
< }
830a823,826
> icon_info.size=40;
> icon_info.size += (icon_info.number_colors * 4);
> icon_info.size += icon_info.image_size;
> icon_info.size += (((icon_info.width + 31) &
~31) >> 3) * icon_info.height;
// size of matte mask
1019c1015
<
icon_file.directory[scene].size=icon_info.image_size;
---
> icon_file.directory[scene].size=icon_info.size;
1021c1017
< (void) WriteBlobLSBLong(image,icon_info.size);
---
> (void) WriteBlobLSBLong(image,(unsigned long) 40);
1023c1019
< (void) WriteBlobLSBLong(image,(unsigned long)
icon_info.height);
---
> (void) WriteBlobLSBLong(image,(unsigned long)
icon_info.height * 2);
1068,1069c1064,1065
< scanline_pad=(((image->columns+8-1)/8+0x03)
& ~0x03)-(image->columns/8);
< for (y=0; y < (long) image->rows; y++)
---
> scanline_pad=(((image->columns + 31) & ~31)
- image->columns) >> 3;
> for (y=((long) image->rows - 1); y >= 0; y--)
1078,1080c1074,1078
< byte>>=1;
< if ((image->matte == MagickFalse) ||
(p->opacity != OpaqueOpacity))
< byte|=0x80;
---
> byte<<=1;
> if ((image->matte == MagickTrue) &&
(p->opacity == TransparentOpacity))
> {
> byte|=0x01;
> }
1091c1089
< (void) WriteBlobByte(image,(unsigned char)
(byte >> (8-bit)));
---
> (void) WriteBlobByte(image,(unsigned char)
(byte << (8-bit)));
1093c1091
< (void) WriteBlobByte(image,(unsigned char)
(byte >> (8-bit)));
---
> (void) WriteBlobByte(image,(unsigned char)
(0));
1121,1122c1119
< (void)
WriteBlobLSBLong(image,icon_file.directory[scene].size+
< 4*icon_file.directory[scene].colors+40);
---
> (void)
WriteBlobLSBLong(image,icon_file.directory[scene].size);
====================
_______________________________________________
Magick-developers mailing list
Magick-developers imagemagick.org
http://studio.imagemagick.org/mailman/listinfo/m
agick-developers
|