在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
type TARGBRect = packed record Blue, Green, Red, Alpha: Byte; end; var I, x, y: Integer; bmp: TGpBitmap; bg: TGpGraphics; Data: TBitmapData; P: PInteger; begin DoubleBuffered := True; bmp := TGpBitmap.Create('0.bmp'); try Data := bmp.LockBits(GpRect(0, 0, W, H), [imRead, imWrite], pf32bppARGB); P := Data.Scan0; for y := 1 to Data.Height do for x := 1 to Data.Width do begin // 计算不透明度 with TARGBRect(P^) do Alpha := Max(Red, Max(Green, Blue)); //Alpha := (Red + Green + Blue) div 3; //Alpha := (306 * Red + 601 * Green + 117 * Blue) div 1024; Inc(P); end; bmp.UnlockBits(Data); bg := TGpGraphics.Create(form1.Canvas.Handle); bg.DrawImage(bmp, 0, 0, bmp.wideh, bmp.Height); end; finally bg.Free; bmp.Free; end; end;
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论