请给出代码!

解决方案 »

  1.   

    unit Unit1;interfaceuses
        Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
        Dialogs, ExtDlgs, StdCtrls, ExtCtrls;type
        TForm1 = class(TForm)
            Image1: TImage;
            Image2: TImage;
            Button1: TButton;
            handle: TButton;
            OpenPictureDialog1: TOpenPictureDialog;
            procedure Button1Click(Sender: TObject);
            procedure handleClick(Sender: TObject);
        private
            { Private declarations }
        public
            { Public declarations }
        end;var
        Form1: TForm1;implementation
    uses math;
    {$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
    begin
        Self.OpenPictureDialog1.Filter := '*.bmp|*.bmp';
        if self.OpenPictureDialog1.Execute then
        begin
            Image1.Picture.Bitmap.LoadFromFile(OpenPictureDialog1.FileName);
        end;
    end;procedure TForm1.handleClick(Sender: TObject);
    var
        p: PByteArray;
        x, y: Integer;
        Bmp: TBitmap;
    begin
        Bmp := TBitmap.Create;
        Bmp.Assign(Image1.Picture.Bitmap);
        //24位真彩色
        Bmp.PixelFormat := pf24Bit;
        randomize;
        for y := 0 to Bmp.Height - 1 do
        begin
            p := Bmp.scanline[y];
            for x := 0 to Bmp.Width - 1 do
            begin
                //每个象素点的R、G、B分量进行调节
                begin
                    p[x * 3] := Min(255, p[x * 3] + 20); //不能越界,限制在0~255
                    p[x * 3 + 1] := Min(255, p[x * 3 + 1] + 20);
                    p[x * 3 + 2] := Min(255, p[x * 3 + 2] + 20);
                end
            end;
        end;
        Image2.Picture.Bitmap.Assign(Bmp);
        Bmp.Free;
    end;
    end.