Hello,

  My code loads a PNG image from resource, modifies it, and then paints 
on canvas:

var
   png: TPortableNetworkGraphic;
   img: TLazIntfImage;
   bmp: TBitmap;
begin
     // load from resource
     png:=TPortableNetworkGraphic.Create;
     png.LoadFromLazarusResource('a_png_image');
     // prepare for modify
     img:=png.CreateIntfImage;
     png.Free;
     // modyfy

     ...... changing colors, setting alpha, ...

     // prepare for draw
     bmp:=TBitmap.Create;
     bmp.LoadFromIntfImage(img);
     img.Free;
     // paint
     ......


  If image in resources has no alpha channel (img.HasTransparency 
returns False in these cases), then in resulting image i get black 
colour where i set colTransparent (in "modyfy" code block). How to 
insert alpha channel (or maybe mask, [transparency==mask in recent 
graphics changes?]) in existing image?


-- 
   Valdas Jankūnas
_______________________________________________
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to