procedure TMainForm.brightClick(Sender: TObject);
var
p: pRGBTripleArray;
x, y, ScanlineBytes: Integer;
Bmp: TBitmap;
Gray: integer;
// e1, e2, e3: integer;
begin
Bmp := TBitmap.Create;
Bmp.Assign(Image1.Picture.Bitmap);
p := Bmp.scanline[0]; //这里是scanline的优化算法 ,scanline只需执行2次
ScanlineBytes := Integer(bmp.Scanline[1]) - Integer(p);
///////ScanlineBytes是一个负值
for y := 0 to Bmp.Height - 1 do
begin
for x := 0 to Bmp.Width - 1 do
begin
p[x].rgbtRed := p[x].rgbtRed +10;
p[x].rgbtGreen := p[x].rgbtGreen+10;
p[x].rgbtBlue := p[x].rgbtBlue +10;
end;
INC(Integer(p), ScanlineBytes); //其实是减小操作
end;
Image1.Picture.Bitmap.Assign(Bmp);
Bmp.Free;
end;
//hsl调节的例子就不贴了