how to access the mask bits of an icon? lazarus / 39-Graphics ---------------------------------------------------------------------- march · 2011-02-26 09:25 I have a 32x32 16-color icon: Aicon := TIcon.Create; Aicon.LoadFromLazarusResource('arrow'); The image pixels are available from: Aicon.Canvas.Colors[X,Y] The transparent pixels are just black here, which I think is normal. Now I need to see the mask pixels to identify the transparent areas. Aicon.Masked is true. Aicon.MaskHandle : HBitmap is available. Can I use that somehow to find a mask[x,y] array? FPC 2.2.4  Lazarus 0.9.28.2  WinXP (portable code) ---------------------------------------------------------------------- circular · 2011-02-26 17:37 Maybe if you create another TBitmap and assign the mask handle to the bitmap handle. ---------------------------------------------------------------------- march · 2011-02-27 01:54 Yes, with the following: MaskBitmap := TBitmap.Create; MaskBitmap.Handle := Aicon.MaskHandle; then only the non-transparent pixels have: MaskBitmap.Canvas.Pixels[X,Y] = clBlack It would be nice to see direct access to mask bits with a TIcon property. Maybe that will be a future addition, but for now this method does the job.