ICC
< back to sketch

int xsize = 300, ysize = 300;
int small_rect_size = 50;

int inc = small_rect_size/2;  // size of 1/4 small_rect
int x, y;    // 1/4 small_rect coordinate
int xx, yy;  // coordinate in 1/4 small_rect
int xc, yc;  // color of point

size(xsize, ysize);
colorMode(RGB, inc);

for (x=0; x< xsize; x=x+inc) {
  for (y=0; y< ysize; y=y+inc) {

    // START draw of 1/4 small_rect...........................................
    for (xx=0; xx< inc; xx++){
      for (yy=0; yy< inc; yy++) {

        // decision of basic color
        if (x%(inc*2)!=0) {
          xc=xx;
        } else {
          xc=inc-xx;
        }

        if (y%(inc*2)!=0) {
          yc=yy;
        } else {
          yc=inc-yy;
        }

        // change of cross hat
        if (xx==yy) {
          xc=yc=0;
        }

        if (xx==inc-yy) {
          xc=yc=255;
        }

        // draw
        stroke(xc, yc, 0);
        point(x+xx,y+yy);
      }
    }
    // END draw of 1/4 small_rect...........................................

  }
}

< back to sketch