package pic2;
import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
class pro extends Frame{
PixelGrabber pg;
Color col;
Image img;
int w;
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 mx,nx;
int num;
String s1,s2;
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;
}
int flesh(int mx,int nx,int x){
int h1,f1;
f1=0;
h1=0;
if(memor[mx][nx]>241-x)h1=h1+1;
if(memor[mx][nx]<241+x)h1=h1+1;
if(memog[mx][nx]>187-x)h1=h1+1;
if(memog[mx][nx]<187+x)h1=h1+1;
if(memob[mx][nx]>147-x)h1=h1+1;
if(memob[mx][nx]<147+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++){
f[mx][nx]=flesh(mx,nx,50);
}
}
System.out.println(h);
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);
}
}
}
}