アットウィキロゴ

じゃヴぁ1030

import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;

class game1030 extends Frame{
PixelGrabber pg;
Color col;
Image img;
int w=500;
int h=500;
int size;
int red,green,blue;
int pix[]=new int[w*h];
int memor[][]=new int[h][w];
int memog[][]=new int[h][w];
int memob[][]=new int[h][w];
double data[]=new double[501];
double[] alpha=new double[25];

double[][] alphar=new double[h][25];
double[][] alphag=new double[h][25];
double[][] alphab=new double[h][25];

double[][] betar=new double[25][25];
double[][] betag=new double[25][25];
double[][] betab=new double[25][25];

int s,num;
int mx,nx,m,n;
int m1,n1,m2,n2;    
int j;
String s1,s2,s3,s4;

game1030(){  

s1="fujiko.jpg";
catchimg(s1);  

fou1();

fou2();

}

public static void main(String[] args) {
game1030 f = new game1030();
f.setSize(700,700);
f.setBackground(Color.blue) ;
f.setVisible(true);
f.addWindowListener(new WindowAdapter(){public void
windowClosing(WindowEvent e){System.exit(0);}});
}

public void paint( Graphics g ) {

g.setColor(Color.blue);
g.fillRect(0,0,700,700);
mx=1;
nx=1;

for (mx=0;mx<500;mx++){
for (nx=0;nx<500;nx++){  
g.setColor(new Color(memor[mx][nx],memog[mx][nx],memob[mx][nx]));  
g.fillRect(nx,mx,1,1);
}
}



}

void catchimg(String s){

img = createImage(w,h);
img = Toolkit.getDefaultToolkit().getImage(s);
pg = new PixelGrabber(img,0,0,w,h,pix,0,w);

try{pg.grabPixels();}catch(InterruptedException ie){}
m=0;
n=0;
for(int i=0;i<w*h;i++){
int p = pix[i];
col=new Color(pix[i]);
red=col.getRed();
green=col.getGreen();
blue=col.getBlue();
memor[m][n]=red;
memog[m][n]=green;
memob[m][n]=blue;
n=n+1;
if (n==w)m=m+1;
if (n==w)n=0;
}

}

public static double seekfou(double[] alpha,int s,int num){
double x,z;
int m;
x=(double)(s*Math.PI/num);
z=alpha[0]/2;
for (m=1;m<100;m++){
z=z+alpha[m]*Math.cos(m*x);
}
return z;
}


public static double seekalpha(int m,int num,double[] data){
int n,nx;
double x1,y1,z;
double delta;
delta=(double)Math.PI/num;
z=0;
for (n=-num+1;n<num;n++){
nx=n;
if (nx<0)nx=-nx;
x1=nx*delta;
y1=data[nx]*Math.cos(m*x1);
z=z+delta*y1;
}
z=z/Math.PI;
return z;
}


void fou1(){

for (mx=0;mx<h;mx++){
num=w;
for (s=0;s<num;s++){  
data[s]=memor[mx][s];
}
for (m=0;m<25;m++){
alpha[m]=seekalpha(m,num,data);
}
for (m=0;m<25;m++){
alphar[mx][m]=alpha[m];
}
}

for (mx=0;mx<h;mx++){
num=w;
for (s=0;s<num;s++){  
data[s]=memog[mx][s];
}
for (m=0;m<25;m++){
alpha[m]=seekalpha(m,num,data);
}
for (m=0;m<25;m++){
alphag[mx][m]=alpha[m];
}
}

for (mx=0;mx<h;mx++){
num=w;
for (s=0;s<num;s++){  
data[s]=memob[mx][s];
}

for (m=0;m<25;m++){
alpha[m]=seekalpha(m,num,data);
}

for (m=0;m<25;m++){
alphab[mx][m]=alpha[m];
}
}

}


void fou2(){

for (mx=0;mx<25;mx++){

num=h;
for (s=0;s<num;s++){  
data[s]=alphar[s][mx];
}

for (m=0;m<25;m++){
alpha[m]=seekalpha(m,num,data);
}

for (m=0;m<25;m++){
betar[mx][m]=alpha[m];
}

}

for (mx=0;mx<25;mx++){

num=h;
for (s=0;s<num;s++){  
data[s]=alphag[s][mx];
}

for (m=0;m<25;m++){
alpha[m]=seekalpha(m,num,data);
}

for (m=0;m<25;m++){
betag[mx][m]=alpha[m];
}

}


for (mx=0;mx<25;mx++){

num=h;
for (s=0;s<num;s++){  
data[s]=alphab[s][mx];
}

for (m=0;m<25;m++){
alpha[m]=seekalpha(m,num,data);
}

for (m=0;m<25;m++){
betab[mx][m]=alpha[m];
}

}

}

  
}
最終更新:2011年03月07日 23:10