Anyone have an algorithm to loop through the color spectrum? I cant seem to figure it out myself.
Hmm. To be honest I’d just create this in your graphics program of choice and blit it as an image
Bach
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.util.Random;
import javax.swing.JFrame;
import javax.swing.JPanel;
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author David
*/
public class DrawPaletteShiz {
/**
* @param args the command line arguments
*/
public static void main(String[] args) throws Throwable {
JFrame jf = new JFrame("Frame");
final Dimension size = new Dimension(100,100);
JPanel jp = new JPanel() {
@Override
public void paint(Graphics g) {
float f = new Random().nextFloat();
for (int i = 0; i < size.width; i++) {
for (int j = 0; j < size.height; j++) {
g.setColor(Color.getHSBColor(f, 1.0f-(float)i/size.width, 1.0f-(float)j/size.height));
g.drawLine(i,j,i,j);
}
}
for (int i = 0; i < size.height; i++) {
g.setColor(Color.getHSBColor((float)i/size.height,1.0f,1.0f));
g.drawLine(100,i,130,i);
}
}
};
jf.setResizable(false);
jp.setPreferredSize(new Dimension(size.width+30,size.height));
jf.getContentPane().add(jp);
jf.pack();
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
jf.show();
while (true) {
jp.repaint();
Thread.sleep(10);
}
}
}
have fun brah
Wow thanks for that. I will put it to great use!