icon-rendering....on Buttonbar
Moderators: Hacker, petermad, Stefan2, white
- ghisler(Author)
- Site Admin
- Posts: 50394
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
- ghisler(Author)
- Site Admin
- Posts: 50394
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Nice to hear that! Yes, it was quite time-consuming to find the reason of the problem...
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
- ghisler(Author)
- Site Admin
- Posts: 50394
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
It was a problem with reading the icons from cache. In Tc 7.0 beta 2, I used the following code to load the monochrome (mask) bitmap:
In beta 3, this was changed to:
Code: Select all
iconinfo.hbmMask:=CreateBitmap(pbih.biWidth,
pbih.biHeight,
pbih.biPlanes,
pbih.biBitCount,nil);
SetDIBits(dc,iconinfo.hbmMask,0, pbih.biHeight,
pchar(pbmi)+sizeof(tBITMAPINFOHEADER)+ pbih.biClrUsed*sizeof(tRGBQUAD),
pbmi^, DIB_RGB_COLORS);
Code: Select all
//Convert mono bits from dword-alligned bottom-up to word-aligned top-down!
bytewidth2:=((pbih.biWidth+15) and not 15) div 8; {word-alligned!}
monobitsize:=bytewidth2*pbih.biHeight;
getmem(monobits,monobitsize);
ptr0:=pchar(pbmi)+sizeof(tBITMAPINFOHEADER)+ pbih.biClrUsed*sizeof(tRGBQUAD);
for j:=0 to pbih.biHeight-1 do
move(ptr0[j*bytewidth],monobits[(pbih.biHeight-j-1)*bytewidth2],bytewidth2);
iconinfo.hbmMask:=CreateBitmap(pbih.biWidth,
pbih.biHeight,
pbih.biPlanes,
pbih.biBitCount,monobits);
freemem(monobits,monobitsize);
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com