Показать сообщение отдельно
  #4  
Старый 01.04.2011, 15:35
Janom Janom вне форума
Начинающий
 
Регистрация: 04.02.2011
Адрес: Москва
Сообщения: 148
Версия Delphi: 7
Репутация: 133
По умолчанию

Код:
procedure TForm1.Image1MouseUp(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
var i, j:       Byte;
    aR, aG, aB: Byte;
    bR, bG, bB: Byte;
    NeSilOtlich:Byte;
    x1,x2,y1,y2:integer;
begin
Image2.Picture:=nil;
NeSilOtlich:=15;
aR:=GetRValue(Image1.Canvas.Pixels[x,y]);
aG:=GetGValue(Image1.Canvas.Pixels[x,y]);
aB:=GetBValue(Image1.Canvas.Pixels[x,y]);
x1:=1;
y1:=1;
x2:=x1+8;
y2:=8;
for i:=1 to Image1.Width do
  for j:=1 to Image1.Height do
    begin
      bR:=GetRValue(Image1.Canvas.Pixels[i,j]);
      bG:=GetGValue(Image1.Canvas.Pixels[i,j]);
      bB:=GetBValue(Image1.Canvas.Pixels[i,j]);
      if (abs(aR-bR)<NeSilOtlich)and(abs(aG-bG)<NeSilOtlich)and(abs(aB-bB)<NeSilOtlich) then
        begin
        Image2.Canvas.Brush.Color:=RGB(bR,bG,bB);
        Image2.Canvas.Rectangle(x1,y1,x2,y2);
        if x1+50<image2.Width then x1:=x1+8 else
          Begin x1:=1; y1:=y1+8; y2:=y2+8; end;
        x2:=x1+8;
        end;
    end;
end;
Ответить с цитированием