How to create transparent bitmap? lazarus / 39-Graphics ---------------------------------------------------------------------- haword · 2007-05-22 09:47 example: var  bmp: TBitmap; begin   bmp:=TBitmap.Create;   bmp.PixelFormat:= pf24bit;   bmp.Height:=16;   bmp.Width:=16;   bmp.TransparentColor:=clBlack;   bmp.Transparent:=true;   bmp.Canvas.Brush.Color:=clBlack;   bmp.Canvas.FillRect(bmp.Canvas.ClipRect);   SpeedButton1.Glyph.TransparentColor:=clBlack;   SpeedButton1.Glyph.Transparent:=true;   SpeedButton1.Glyph.Assign(bmp);   SpeedButton1.Glyph.SaveToFile('test.bmp');   SpeedButton2.Glyph.LoadFromFile('test.bmp');   bmp.Free; SpeedButton1 show black box, SpeedButton2 show empty, how to create transparent bitmap and show this to SpeedButton1? ---------------------------------------------------------------------- Marc · 2007-05-22 09:52 at this moment is is not possible to draw transparent yet. This will be added in the near future ---------------------------------------------------------------------- theo · 2007-05-22 10:44 You could do it with OpBitmap like this: var bmp:TBitmap;  opb:TCanvasOPBitmap; begin bmp:=TBitmap.create; opb:=TCanvasOPBitmap.create; opb.width:=16; opb.height:=16; opb.Canvas.Brush.color:=clRed; opb.Canvas.FillRect(Rect(0,0,16,16)); opb.Canvas.Brush.color:=clBlack; opb.Canvas.FillRect(Rect(1,1,15,15)); opb.TransparentColor:=opb.Pixels[8,8]; AssignOpBitmapToBitmap(opb,bmp); opb.free; SpeedButton1.Glyph.Assign(Bmp); bmp.free; ---------------------------------------------------------------------- haword · 2007-05-22 11:08 Quote from: "theo"You could do it with OpBitmap like this: var bmp:TBitmap;  opb:TCanvasOPBitmap; begin bmp:=TBitmap.create; opb:=TCanvasOPBitmap.create; opb.width:=16; opb.height:=16; opb.Canvas.Brush.color:=clRed; opb.Canvas.FillRect(Rect(0,0,16,16)); opb.Canvas.Brush.color:=clBlack; opb.Canvas.FillRect(Rect(1,1,15,15)); opb.TransparentColor:=opb.Pixels[8,8]; AssignOpBitmapToBitmap(opb,bmp); opb.free; SpeedButton1.Glyph.Assign(Bmp); bmp.free; Hi Theo! Thanks. I and did earlier. But wished to make a transparency without usage TCanvasOPBitmap. Use only internal resources Lzarus. ---------------------------------------------------------------------- Marc · 2007-05-22 16:18 What is a OPBitmap ? ---------------------------------------------------------------------- theo · 2007-05-22 19:11 Quote from: "Marc"What is a OPBitmap ? OPBitmap itself is sort of a VCL compatibility layer. You can reuse code working with scanline accesss, pixelformat conversions etc the way you're used to from the VCL. http://www.theo.ch/lazarus/opbitmap1_5.zip