Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- canali c;
- int w = 320;
- int l = 240;
- int counter_r = 0;
- int counter_v = 0;
- int counter_b = 0;
- int ris = 0;
- void setup()
- {
- size(w, l);
- smooth();
- stroke(255);
- frameRate(10000);
- c = new canali(255,255,255);
- background(0);
- fill(255,255,255);
- rect(0,0,310,240);
- }
- void draw()
- {
- checksfondo();
- }
- void checksfondo()
- {
- c.getcolor();
- ris = ((w*l)*70)/100;
- while (c.totcolori > ris)
- {
- fill(0,0,0);
- rect(10,10,20,20);
- }
- }
- public class canali
- {
- public float rosso;
- public float verde;
- public float blu;
- public float totcolori;
- canali(int r,int v,int b)
- {
- rosso = r;
- verde = v;
- blu = b;
- }
- void getcolor()
- {
- for (int x=0;x<w;x++)
- {
- for (int y=0;y<l;y++)
- {
- color grab = get(x,y);
- rosso = red(grab);
- verde = green(grab);
- blu = blue(grab);
- if (rosso > 200)
- {
- counter_r++;
- }
- if (verde > 200)
- {
- counter_v++;
- }
- if (blu > 200)
- {
- counter_b++;
- }
- totcolori = counter_r+counter_v+counter_b;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment