// Draw an HSB circle // I used this to render & save a color picker wheel for a Flash 6 app. // - Jim Bumgardner int sz = 300; int margin = 10; int rad = (sz-margin*2)/2; int cx = sz/2; int cy = cx; void setup() { size(sz,sz); noLoop(); colorMode(HSB, 1.0); } void draw() { noStroke(); for (int y = 0; y < sz; ++y) { for (int x = 0; x < sz; ++x) { float dy = y - cy; float dx = x - cx; float dst = sqrt(dy*dy+dx*dx); float ang = atan2(dy,dx); float h = (float) (ang+PI)/(2*PI); float s = (float) 1.0; float b = (float) (dst <= rad? 1 : 0); fill(h,s,b); rect(x,y,1,1); } } }