unit project2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TForm1 = class(TForm)
image1: TImage;
image2: TImage;
Intensitas: TLabel;
edit1: TEdit;
Sepia: TButton;
Exit: TButton;
procedure SepiaClick(Sender: TObject);
procedure ExitClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.SepiaClick(Sender: TObject);
var
color:longint;
r,g,b,rr,gg:byte;
h,w, depth:integer;
begin
// Menentukan nilai intensitasnya
depth := StrToInt(Edit1.Text);
// assign gambar ke image2 dari image1
image2.Picture.Bitmap := image1.Picture.Bitmap;
for h := 0 to image2.Picture.Bitmap.height do
begin
for w := 0 to image2.Picture.Bitmap.width do
begin
// membuat tampilan dengan warna sephia
color:=colortorgb(image2.Picture.Bitmap.Canvas.pixels[w,h]);
r:=getrvalue(color);
g:=getgvalue(color);
b:=getbvalue(color);
rr:=r+(depth*2);
gg:=g+depth;
if rr <= ((depth*2)-1) then
rr:=255;
if gg <= (depth-1) then
gg:=255;
image2.Picture.Bitmap.canvas.Pixels[w,h]:=RGB(rr,gg,b);
end;
end;
end;
procedure TForm1.ExitClick(Sender: TObject);
begin
Application.Terminate;
end;
end.




