kirton
YaBB Newbies
Offline
Posts: 32
point(i,j) doesn't work
Jan 29th , 2006, 8:19am
I'm just learning Processing and trying to make a color picker that changes between H,S,B modes. I have two examples here, the first uses point(i,j) and works. In the second example point(i,j) doesn't work... but... line(i,j,127,127) works... Could someone please help me? NOTE: the second example uses the MyGUI class. /*works*/ void setup(){ size(128,128); noStroke(); colorMode(HSB, 255,255,255); } void draw(){ } void mousePressed(){ for(int i=0; i<128; i++) { for(int j=0; j<128; j++) { stroke(mouseX*2, i*2, j*2); point(i, j); } } } /* end works */ /*doesn't work*/ import mkv.MyGUI.*; MyGUI gui; MyGUICheckBox chkH; MyGUICheckBox chkS; MyGUICheckBox chkB; char hsbVAR; void setup(){ size(151,128); framerate(24); background(133); smooth(); noStroke(); gui = new MyGUI(this); chkH = new MyGUICheckBox(this,140,height/2-20,10,10); chkS = new MyGUICheckBox(this,140,height/2,10,10); chkB = new MyGUICheckBox(this,140,height/2+20,10,10); gui.add(chkH); gui.add(chkS); gui.add(chkB); colorMode(HSB,255,255,255); } void draw(){ } void actionPerformed(ActionEvent e){ checkHSB(e); } void checkHSB(ActionEvent e){ if(e.getSource() == chkH){ chkS.checked(false); chkB.checked(false); hsbVAR = 'H'; } else if(e.getSource() == chkS){ chkH.checked(false); chkB.checked(false); hsbVAR = 'S'; } else if(e.getSource() == chkB){ chkH.checked(false); chkS.checked(false); hsbVAR = 'B'; } drawColor(hsbVAR); } //---------------------- void drawColor(char e){ switch(e){ case 'H': for(int i=0; i<128; i++) { for(int j=0; j<128; j++) { stroke(255,i*2,j*2); point(i,j); //line(i,j,i,j); //line(i,j,127,127); } } break; case 'S': for(int i=0; i<128; i++) { for(int j=0; j<128; j++) { stroke(i*2,255,j*2); point(i,j); //line(i,j,i,j); //line(i,j,127,127); } } break; case 'B': for(int i=0; i<128; i++) { for(int j=0; j<128; j++) { stroke(i*2,j*2,255); point(i,j); //line(i,j,i,j); //line(i,j,127,127); } } break; } } /* end doesn't work */