This code was done on magic mushrooms and weed when I was a teenager. I think there's a newer version but I can't be bothered to find it.
import javax.swing.*;
import java.net.*;
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;
import java.awt.image.*;
import java.io.*;
import javax.swing.JPanel;
import javax.sound.sampled.*;
public class Seen extends Thread
{
private int varf;
private Rectangle r;
private JFrame desi;
private JPanel fik = new JPanel();
private Desi parent;
private Graphics2D g2; // This is the back buffer.
private Graphics2D g1; // This is the front image buffer.
private int render[];// = new int[500*500];
private BufferedImage bi;
private BufferedImage bitch;
private PixelGrabber px;
private int fron[];// = new int[234651];
private WritableRaster ras;
private int[] xc=new int[1];
private int[] yc=new int[1];
private String fuerk="";
private int dwi;
private int dhi;
public Seen(Desi p)
{
parent = p;
}
public void dL3D(Graphics2D g,int offx,int offy,int offz,int x1,int y1,int z1,int x2,int y2,int z2,int rotz) {
//public void dL3D(Graphics2D g,int x1,int y1,int z1,int x2,int y2,int z2,int rotz) {
//System.out.println("g2.draw(new Line2D.Double("+(((x1*Math.sin(rotz))-((z1+offz)/2))+offx)+","+((y1-((z1+offz)/2))+offy)+","+((x2-((z2+offz)/2))+offx)+","+((y2-((z2+offz)/2))+offy)+");");
//double cz=Math.cos(0.017453*rotz);
//double sz=Math.sin(0.017453*rotz);
//double tz=Math.tan(0.017453*rotz);
double cz=Math.sin(0.017453*rotz);
double sz=Math.cos(0.017453*rotz);
double tz=Math.tan(0.017453*rotz);
double sx =(x1*cz+y1*sz);
double sy =(y1*cz-x1*sz);
double wid=((x2*cz+y2*sz)-sx)/2;
double hei=((y2*cz-x2*sz)-sy)/2;
double woc = (int)Math.sqrt(z2+offz);
double cow = (int)Math.sqrt(z1+offz);
cow = cow < 1 ? 1 : cow;
woc = woc < 1 ? 1 : woc;
double he=wid*1/woc;
double wi=hei*1/cow;
g.draw(new Line2D.Double(
/*
x1*cz+y1*sz-(z1+offz)/2+offx,
y1*cz-x1*sz-(z1+offz)/2+offy,
x2*cz+y2*sz-(z2+offz)/2+offx,
y2*cz-x2*sz-(z2+offz)/2+offy
*/
sx-wid-wi+offx,
sy-hei-he+offy,
sx-wid+wi+offx,
sy-hei+he+offy
/*
sx+offx,
sy+offy,
sx+wid*2+offx,
sy+hei*2+offy
*/
));
}
public void run() {
desi = new JFrame("MAGIC ---> ----> ---> ----> FOUR BICYCLES OF DOOM!!");
desi.getContentPane().add(fik);
desi.setBackground(Color.black);
desi.setSize(1000, 1000);
desi.setResizable(false);
desi.addWindowListener(new TouchMe(parent));
desi.setVisible(true);
bi = new BufferedImage(desi.getContentPane().getWidth(),desi.getContentPane().getHeight(),BufferedImage.TYPE_INT_RGB);
g2 = bi.createGraphics();
render = new int[desi.getContentPane().getWidth()*desi.getContentPane().getHeight()];
fron = new int[render.length];
//g1 = (Graphics2D)desi.getContentPane().getGraphics();
g1=(Graphics2D)fik.getGraphics();
/*
g1=(Graphics2D)fik.getGraphics();
bi = new BufferedImage(desi.getContentPane().getWidth(),desi.getContentPane().getHeight(),BufferedImage.TYPE_INT_RGB);
g2 = bi.createGraphics();
for (int l = 0;l<1500;l++) {
bi = new BufferedImage(desi.getContentPane().getWidth(),desi.getContentPane().getHeight(),BufferedImage.TYPE_INT_RGB);
g2 = bi.createGraphics();
try { sleep(0); } catch (Exception dontCare) { }
g2.setPaint(new Color(255,0,0));
dL3D(200,200,0+1,-100+1,0+1,0+1,100+1,0+1,0+1,l%360);
g2.setPaint(new Color(0,255,0));
dL3D(200,200,0+1,0+1,-100+1,0+1,0+1,100+1,0+1,l%360);
g2.setPaint(new Color(0,0,255));
dL3D(200,200,0+1,0+1,0+1,-100+1,0+1,0+1,100+1,l%360);
g2.setPaint(new Color(255,0,0));
dL3D(200,200,0,-100,-100,-50,100,-100,-50,l%360);
dL3D(200,200,0,-100,-100,-50,0,100,-50,l%360);
dL3D(200,200,0,100,-100,-50,0,100,-50,l%360);
g2.setPaint(new Color(0,0,255));
dL3D(200,200,0,-100,-100,-50,0,0,50,l%360);
dL3D(200,200,0,100,-100,-50,0,0,50,l%360);
dL3D(200,200,0,0,100,-50,0,0,50,l%360);
g1.drawImage(bi,null,0,0);
}
*/
// bi = new BufferedImage(500,500,BufferedImage.TYPE_INT_RGB);
// g2 = bi.createGraphics();
g2.setBackground(Color.black);
int fux = desi.getContentPane().getWidth()/2,fuy = desi.getContentPane().getHeight()/2,fuz = 0;
ras=bi.getData().createCompatibleWritableRaster();
// for (int l = 0;l<360*5;l+=(int)(Math.random()*4)-2) {
for (int l = 0;l<360*1;l++) {
// try { sleep(100); } catch (Exception dontCare) { }
/*
g2.setPaint(new Color(255,0,0));
dL3D(350,300,0+1,-200+1,0+1,0+1,200+1,0+1,0+1,l%360);
g2.setPaint(new Color(0,255,0));
dL3D(350,300,0+1,0+1,-200+1,0+1,0+1,200+1,0+1,l%360);
g2.setPaint(new Color(0,0,255));
dL3D(350,300,0+1,0+1,0+1,-200+1,0+1,0+1,200+1,l%360);*/
// g2.setPaint(new Color(rC(),rC(),rC()));
//fux=(int)(200+50*Math.cos(0.017453*l%360)+50*Math.tan(0.017453*l%360));
//fuy=(int)(200+50*Math.cos(0.017453*l%360)+50*Math.sin(0.017453*l%360)+10*Math.tan(0.017453*l%360));
//fuz=l/50;
//fux=200;
//fuy=200;
//bi = new BufferedImage(500,500,BufferedImage.TYPE_INT_RGB);
//g2 = bi.createGraphics();
//ras.setPixels(0,0,desi.getContentPane().getWidth(),desi.getContentPane().getHeight(),fron);
//bi.setData(ras);
//try { sleep(50); } catch (Exception dontCare) { }
dL3D(g2,fux,fuy,fuz,-100,-100,-5,100,-100,-5,l%360); g2.setPaint(new Color(255,255,255));
dL3D(g2,fux,fuy,fuz,-100,-100,-5,0 , 100,-5,l%360); g2.setPaint(new Color(255,0,255));
dL3D(g2,fux,fuy,fuz, 100,-100,-5,0 , 100,-5,l%360);
g2.setPaint(new Color(0,0,255));
dL3D(g2,fux,fuy,fuz,-100,-100,-5,0,0,5,l%360); g2.setPaint(new Color(0,255,0));
dL3D(g2,fux,fuy,fuz, 100,-100,-5,0,0,5,l%360); g2.setPaint(new Color(rC(),rC(),rC()));
dL3D(g2,fux,fuy,fuz, 0 , 100,-5,0,0,5,l%360);
/*
dL3D(g2,fux,fuy,0,0,100,0,0,-100,0,l%360);
dL3D(g2,fux,fuy,0,-100,0,0,100,0,0,l%360);
dL3D(g2,fux,fuy,0,0,0,-50,0,0,50,l%360);
g2.setPaint(new Color(0,255,0));
dL3D(g2,fux,fuy,fuz,-100,100,-50,100,100,-50,l%360);
dL3D(g2,fux,fuy,fuz,100,100,-50,100,-100,-50,l%360);
dL3D(g2,fux,fuy,fuz,100,-100,-50,-100,-100,-50,l%360);
dL3D(g2,fux,fuy,fuz,-100,-100,-50,-100,100,-50,l%360);
g2.setPaint(new Color(255,0,0));
dL3D(g2,fux,fuy,fuz,-100,100,50,100,100,50,l%360);
dL3D(g2,fux,fuy,fuz,100,100,50,100,-100,50,l%360);
dL3D(g2,fux,fuy,0,100,-100,50,-100,-100,50,l%360);
dL3D(g2,fux,fuy,0,-100,-100,50,-100,100,50,l%360);
g2.setPaint(new Color(0,0,255));
dL3D(g2,fux,fuy,0,-100,100,50,-100,100,-50,l%360);
dL3D(g2,fux,fuy,0,-100,-100,50,-100,-100,-50,l%360);
dL3D(g2,fux,fuy,0,100,100,50,100,100,-50,l%360);
dL3D(g2,fux,fuy,0,100,-100,50,100,-100,-50,l%360);
*/
g1.drawImage(bi,null,0,0);
}
// int x1 = -10;int y1 = -10;int x2 = 10;int y2 = 10;int z1 = -5;int z2 = -5;
/*
for (int l = 0;l<360;l++) {
//try { sleep(0); } catch (Exception dontCare) { }
bi = new BufferedImage(400,400,BufferedImage.TYPE_INT_RGB);
g2 = bi.createGraphics();
g2.setPaint(new Color((int)(255 * Math.random()),(int)(255 * Math.random()),(int)(255 * Math.random())));
}
*/
/* for (int l = 0;l<1000;l++)
{
try { sleep(1); } catch (Exception dontCare) { break; }
g2.draw(new Rectangle2D.Double(0,0,(int)(400 * Math.random()),(int)(400 * Math.random())));
}
*/
//g1.drawImage(bi,null,0,0);
float t,r,b,l;
while (true) {
t=(float)Math.random();r=(float)Math.random();
b=(float)Math.random();l=(float)Math.random();
for (varf=1;varf<200;++varf) {plasFra(0,0,desi.getContentPane().getWidth(),desi.getContentPane().getHeight(),t,r,b,l);
try { sleep(200); } catch (Exception dontCare) { break; }
g1.drawImage(bi,null,0,0);
}
try { sleep(2000); } catch (Exception dontCare) { break; }
}
fuckingHell();
//bi = new BufferedImage(50,50,BufferedImage.TYPE_INT_RGB);
//g2 = bi.createGraphics();
}
private int width(){return desi.getContentPane().getWidth();}
private int height(){return desi.getContentPane().getHeight();}
private void fuckingHell() {
MediaTracker ananusfortheshit;
Image shitness;
long shitheed=System.currentTimeMillis();
int tonj=0;
bitch=new BufferedImage(desi.getContentPane().getWidth()*2,desi.getContentPane().getHeight()*2,BufferedImage.TYPE_INT_RGB);
ras=bitch.getData().createCompatibleWritableRaster();
for (int shitzaku=0;shitzaku<1000;++shitzaku) {
//System.out.println("Enter cuntal expression:");
//do {
// try { px = new PixelGrabber(bi, 0, 0, 499,499, render, 0, Integer.parseInt((new BufferedReader(new InputStreamReader(System.in))).readLine()));
px = new PixelGrabber(bi, 0, 0, 499,499, render, 0, shitzaku);
try {
px.grabPixels(); } catch (Exception ex) { }
for (int x = 0;x<render.length;x++) {
//g2.setPaint((new Color((render[x] >> 16) & 255,(render[x] >> 8) & 255,render[x] & 255)));
//def
fron[x]=render[x];
//323 16 4 16
// fron[x]=(render[x]&255)/(255/16)+(((render[x]
>>8)&255)/(255/4)<<3)+(((render[x]
>>16)&255)/(255/16)<<5);
//Greenscale
// fron[x]=((((render[x]<<8)
>>8)/(16777215/16))<<29)
>>24;
//Deathscale
// fron[x]=((render[x]<<8)
>>8)/65535;
//tonj=((render[x]<<8)
>>8)/65535;
// fron[x]=((tonj*255/16)<<5)+((tonj*255/4)<<3)+(tonj*255/16);
//System.out.println("x: "+x%50+" y: "+(x/50));
// g2.draw(new Line2D.Double(x%500,(x/500),1+x%500,1+(x/500)));
//xc[0]=x%500;
//yc[0]=x/500;
//g2.draw(new Polygon(xc,yc,1));
//desi.setTitle(100*x/480000+"%");
}
ras.setPixels(0,0,desi.getContentPane().getWidth()/3,desi.getContentPane().getHeight()/3,fron);
//ras.setPixels(0,0,200,200,fron);
bitch.setData(ras);
//try { this.sleep(200); }
//catch (Exception ex) {}
//System.out.println();
//System.out.println("Done."+shitzaku);
shitness = Toolkit.getDefaultToolkit().getImage("poster.jpg");
ananusfortheshit = new MediaTracker(desi);
ananusfortheshit.addImage(shitness,0);
try { ananusfortheshit.waitForID(0); }
catch (Exception ex) { }
bitch.createGraphics().drawImage(shitness,75,200,fik);
g1.drawImage(bitch,null,0,0);
//}
//while (true);
}
System.out.println("Frames per second: "+1000/((System.currentTimeMillis()-shitheed)/1000));
System.out.println("Seconds: "+((System.currentTimeMillis()-shitheed)/1000));
System.out.println("Frames: "+1000);
//g2.drawImage(bitch,null,0,0);
//g1.drawImage(bi,null,0,0);
try { this.sleep(5000); }
catch (Exception ex) { }
fuckingHell();
/*
for (int adc = AudioSystem.getMixerInfo().length -1;adc > -1;--adc) {
System.out.println("Device "+adc+": "+AudioSystem.getMixerInfo()[adc].getName()+"\nTarget lines:");
for (int ldc = AudioSystem.getMixer(AudioSystem.getMixerInfo()[adc]).getTargetLineInfo().length -1;ldc > -1;--ldc) {
System.out.println("Target "+ldc+": "+AudioSystem.getMixer(AudioSystem.getMixerInfo()[adc]).getTargetLineInfo()[ldc]);
}
}*/
}
public void bye()
{
if (desi != null)
{
desi.dispose();
}
}
private void plasFra(float x,float y,float wid,float hei,float t,float r,float b,float l) {
float top,right,left,bottom,middle,wi=wid/2,he=hei/2;
if(hei>2||wid>2){
top=(t+r)/2;right=(r+b)/2;bottom=(b+l)/2;left=(l+t)/2;
//middle=(t+b+r+l)/4;
middle=(float)(wi+he);middle=middle/(float)(width()+height())*varf;
middle=((float)Math.random()-0.5F)*middle;middle+=(t+r+b+l)/4;middle=middle>1?1F:middle;middle=middle<0?0F:middle;
plasFra(x,y,wi,he,t,top,middle,left);
plasFra(x+wi,y,wi,he,top,r,right,middle);
plasFra(x+wi,y+he,wi,he,middle,right,b,bottom);
plasFra(x,y+he,wi,he,left,middle,bottom,l);
}
else{
//putPix(x,y,lsd((t+r+b+l)/4));
float cl=(t+r+b+l)/4;
//System.out.println(""+cl);
g2.setColor(csd(cl));
g2.drawRect((int)x,(int)y,1,1);
}
}
private int lsd(float i){return (int)((i<0.5?i:1.0-i)*255)<<16
+(int)((i<0.3?0.3-i:i<0.8?i-0.3:1.3-i)*255)<<8
+(int)((i>=0.5?i-0.5:0.5-i)*255);}
private Color csd(float i){return new Color((i<0.5f?i:1.0f-i)*2,
(i<0.3?0.3f-i:i<0.8?i-0.3f:1.3f-i)*2,
(i>=0.5?i-0.5f:0.5f-i)*2);}
private int rC() { return (int)(255*Math.random()); }
}