Flag Of Malawi


  // Malawi (adopted 29 July 2010) - Jim Bumgardner
  
  // Reference: http://en.wikipedia.org/wiki/Flag_of_Malawi
  // Note: Took RGB sample and ray shape bezier curves from the SVG file found here
  // http://en.wikipedia.org/wiki/File:Flag_of_Malawi.svg
  
  int kHeight = 332; // The only number that needs changing
  
  size(kHeight*3/2, kHeight);
  
  float stripeHeight = height/3.0;
  float circWidth = height*4/15.0;
  
  noStroke();
  smooth();
  
  color whiteColor = color( #FFFFFF );
  color redColor   = color( #DE0220 );
  color greenColor = color( #009C45 );
  color blackColor = color( #000000 );
  
  // Draw each stripe
  fill(redColor);
  rect(0,0, width, stripeHeight);
  
  fill(blackColor);
  rect(0,stripeHeight, width, stripeHeight);
  
  fill(greenColor);
  rect(0,height-stripeHeight, width, stripeHeight);
  
  // Draw white disc
  fill(whiteColor);
  ellipse(width/2, height/2, circWidth, circWidth);
  
  // Draw rays
  int nbrRays = 45;
  for (int i = 0; i < nbrRays; ++i) {
    pushMatrix();
      translate(width/2, height/2);
      scale(height/600.0);
      rotate(i*TWO_PI/nbrRays);
      beginShape();
        vertex(-1,98);
        vertex(1,98);
        bezierVertex(1,98,7.3,165,0,165);
        bezierVertex(-7.3,165,-1,98,-1,98);
      endShape();
    popMatrix();
  }