From d8a5912b7ced20add9d6d9a531cd8fec4cdab73d Mon Sep 17 00:00:00 2001 From: blikblum Date: Sun, 13 Dec 2009 04:40:44 +0000 Subject: [PATCH] * Use the native LCL methods to build bitmap mask in system check images git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1053 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- .../trunk/VirtualTrees.pas | 31 ++----------------- 1 file changed, 2 insertions(+), 29 deletions(-) diff --git a/components/virtualtreeview-new/trunk/VirtualTrees.pas b/components/virtualtreeview-new/trunk/VirtualTrees.pas index e6b4b1707..6b662e2e8 100644 --- a/components/virtualtreeview-new/trunk/VirtualTrees.pas +++ b/components/virtualtreeview-new/trunk/VirtualTrees.pas @@ -5193,31 +5193,6 @@ begin end; end; -{$ifdef Windows} -procedure ClearAlphaChannel(Bitmap: HBitmap; PixelCount: Integer); -var - i: Integer; - DIB: TDIBSection; - P: PCardinal; -begin - P := nil; - if Bitmap <> 0 then - begin - if GetObject(Bitmap, SizeOf(DIB), @DIB) = SizeOf(DIB) then - begin - if DIB.dsBm.bmPlanes * DIB.dsBm.bmBitsPixel = 32 then - P := DIB.dsBm.bmBits; - end; - end; - - if P = nil then - Exit; - for i:= 0 to PixelCount - 1 do - (P + i)^ := (P + i)^ and $00FFFFFF; -end; -{$endif} - - function CalculateScanline(Bits: Pointer; Width, Height, Row: Integer): Pointer; // Helper function to calculate the start address for the given row. @@ -5424,10 +5399,8 @@ begin // Add the 20 system checkbox and radiobutton images. for I := 0 to 19 do AddSystemImage(I); - //todo: there's a bug in LCL that prevents mask creation of loaded bitmaps in windows - //is necessary to remove the alpha opacity - ClearAlphaChannel(BM.Handle, BM.Height*BM.Width); - BM.MaskHandle := CreateBitmapMask(BM.Canvas.Handle, BM.Width, BM.Height, MaskColor); + BM.TransparentColor := MaskColor; + BM.Transparent := True; {$endif} end;