Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- uses
- GdiPlus;
- type
- TOpacity = 0..100;
- procedure GDIPAlphaBlend(const FileName: string; Destination: TCanvas;
- const X, Y: Integer; const Opacity: TOpacity = 100);
- var
- GPImage: IGPImage;
- GPGraphics: IGPGraphics;
- GPColorMatrix: TGPColorMatrix;
- GPImageAttributes: IGPImageAttributes;
- begin
- GPImage := TGPImage.Create(FileName);
- GPColorMatrix.SetToIdentity;
- GPColorMatrix.M[3, 3] := Opacity / 100;
- GPImageAttributes := TGPImageAttributes.Create;
- GPImageAttributes.SetColorMatrix(GPColorMatrix);
- GPGraphics := TGPGraphics.Create(Destination.Handle);
- GPGraphics.DrawImage(GPImage, X, Y, GPImage.Width, GPImage.Height, 0, 0,
- GPImage.Width, GPImage.Height, UnitPixel, GPImageAttributes);
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement