调整图片背景亮度?要有例程!
解决方案 »
- lazarus indy10 linux 安装
- 今天认识个朋友开心(散分2)
- 请教:PrintDBGridEh打印中的网格线能不能去掉!在线等!
- 菜鸟,请教高手关于adoquery的问题
- 在FastReport中怎样取得打印次数?在线结分,先谢谢了!
- Delphi工程Project-->Options-->Packages中的疑问。
- 如何实现通用的数据库出错处理程序?
- 请问用几个AdoTable同时插入数据,怎样实现Sql的事务控制?
- 用ServerSocket和ClinetSocket怎样实现QQ那样,程序运行后自动接收信息?
- 大侠来帮小弟的忙啊!!!
- 调整图片背景亮度?
- delphi 的RTTI好用吗?
var
NewBmp: Graphics.TBitmap; // brightness adjusted bitmap
I: Integer; // loops thru pixels in a scanline
J: Integer; // loops thru scanlines
NewValue: Integer; // new R, G or B colour value for a pixel
RowIn: SysUtils.PByteArray; // scanline from Bmp
RowOut: SysUtils.PByteArray; // scanline from NewBmp
begin
Assert(Bmp.PixelFormat = Graphics.pf24bit);
// Create temporary bitmap to contain brightness adjusted bitmap
NewBmp := Graphics.TBitmap.Create;
try
NewBmp.Width := Bmp.Width;
NewBmp.Height := Bmp.Height;
NewBmp.PixelFormat := Graphics.pf24bit;
for J := 0 to Bmp.Height - 1 do
begin
RowIn := Bmp.Scanline[J];
RowOut := NewBmp.Scanline[J];
for I := 0 to 3 * Bmp.Width-1 do
begin
// adjust intensity of color component
// (treat all components the same way)
NewValue := RowIn[i] + Delta;
// force "ceiling" and "floor" values of 255 and 0
if NewValue > 255 then
NewValue := 255
else if NewValue < 0 then
NewValue := 0;
RowOut[i] := Byte(NewValue);
end;
end;
Bmp.Assign(NewBmp);
finally
NewBmp.Free
end;
end;