<div dir="ltr"><div><div>Wich DIB types ? Are you referring to BI_BITFIELDS compression ?<br><br></div>I just looked at windows codecs code and there this code to handle color masks:<br><br>    /* if this is a BITMAPINFOHEADER with BI_BITFIELDS compression, we need to<br>
        read the extra fields */<br>    if (This->bih.bV5Size == sizeof(BITMAPINFOHEADER) &&<br>        This->bih.bV5Compression == BI_BITFIELDS)<br>    {<br>        This->palette_offset += 12;<br>    }<br>
<br></div>For the rest it's the same thing:<br><div><br>        /* In a packed DIB, the image follows the palette. */<br>        ULONG palette_count, palette_size;<br>        if (This->bih.bV5ClrUsed)<br>            palette_count = This->bih.bV5ClrUsed;<br>
        else if (This->bih.bV5BitCount <= 8)<br>            palette_count = 1 << This->bih.bV5BitCount;<br>        else<br>            palette_count = 0;<br>        if (This->bih.bV5Size == sizeof(BITMAPCOREHEADER))<br>
            palette_size = sizeof(RGBTRIPLE) * palette_count;<br>        else<br>            palette_size = sizeof(RGBQUAD) * palette_count;<br>        This->image_offset = This->palette_offset + palette_size;<br><br>
</div><div>Albeit windows codecs support also BITMAPCOREHEADER2, BITMAPV4HEADER, BITMAPV5HEADER the same way as BITMAPINFOHEADER.<br><br></div><div>Is there still anything wrong ?<br><br></div><div>Christian<br></div></div>
<div class="gmail_extra"><br><br><div class="gmail_quote">2013/4/22 Alexandre Julliard <span dir="ltr"><<a href="mailto:julliard@winehq.org" target="_blank">julliard@winehq.org</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">Christian Costa <<a href="mailto:titan.costa@gmail.com">titan.costa@gmail.com</a>> writes:<br>
<br>
> +    if (header_size == sizeof(BITMAPINFOHEADER))<br>
> +    {<br>
> +        BITMAPINFOHEADER *header = (BITMAPINFOHEADER*)*data;<br>
> +        ULONG count = header->biClrUsed;<br>
> +<br>
> +        if (!count && header->biBitCount <= 8)<br>
> +            count = 1 << header->biBitCount;<br>
> +<br>
> +        offset = sizeof(BITMAPFILEHEADER) + header_size + sizeof(RGBQUAD) * count;<br>
<br>
</div>This isn't correct for all DIB types.<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Alexandre Julliard<br>
<a href="mailto:julliard@winehq.org">julliard@winehq.org</a><br>
</font></span></blockquote></div><br></div>