
13.08.2008, 16:06
|
Продвинутый
|
|
Регистрация: 13.02.2006
Адрес: Магнитогорск
Сообщения: 669
Репутация: 14745
|
|
Код:
procedure TForm1.replacecolor(p: integer); //ниже p - серый
var
x, y:integer;
r, g, b:byte;
begin
for y := 0 to image1.height - 1 do
for x := 0 to image1.width - 1 do begin
r := getRValue(Image1.canvas.pixels[x, y]);
g := getGValue(Image1.canvas.pixels[x, y]);
b := getBValue(Image1.canvas.pixels[x, y]);
if (r = g) and (g = b) {and (b = r)} and (r < p) then Image1.canvas.Pixels[x, y] := rgb(255, 255, 255);
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
replacecolor(200);
end;
|