package hair;
import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
class pro extends Frame{
PixelGrabber pg;
Color col;
Image img;
int w,mx,nx;
int h;
int memor=new int[h][w];
int memog=new int[h][w];
int memob=new int[h][w];
int f=new int[1000][1000];
int r1,g1,b1;
public static void main(String[] args) {
pro f = new pro();
f.setSize(600,600);
f.setBackground(Color.blue) ;
f.setVisible(true);
f.addWindowListener(new WindowAdapter(){public void
windowClosing(WindowEvent e){System.exit(0);}});
}
pro() {
String str;
str="k.jpg";
w=400;
h=400;
catchimg sub=new catchimg();
sub.w=w;
sub.h=h;
sub.makedata(str);
memor=sub.memor;
memog=sub.memog;
memob=sub.memob;
r1=memor[100][100];
g1=memor[100][100];
b1=memor[100][100];
for (mx=0;mx<h;mx++){
for (nx=0;nx<w;nx++){
f[mx][nx]=flesh(mx,nx,100);
}
}
}
int flesh(int mx,int nx,int x){
int h1,f1;
f1=0;
h1=0;
if(memor[mx][nx]>r1-x)h1=h1+1;
if(memor[mx][nx]<r1+x)h1=h1+1;
if(memog[mx][nx]>g1-x)h1=h1+1;
if(memog[mx][nx]<g1+x)h1=h1+1;
if(memob[mx][nx]>b1-x)h1=h1+1;
if(memob[mx][nx]<b1+x)h1=h1+1;
if(h1==6)f1=100;
return f1;
}
public void paint( Graphics g ) {
int i,z,pp,mx,nx,h1;
g.setColor(Color.white);
g.fillRect(0,0,600,600);
for (mx=0;mx<h;mx++){
for (nx=0;nx<w;nx++){
g.setColor(new Color(memor[mx][nx],memog[mx][nx],memob[mx][nx]));
if(f[mx][nx]>50)g.fillRect(nx+100,mx+100,1,1);
}
}
g.setColor(Color.red);
g.fillRect(100+100,100+100,10,10);
}
}