code: public void fillRoundRect(float x, float y, float width, float height,
  			int cornerRadius, int segs) {
  		if (cornerRadius < 0)
  			throw new IllegalArgumentException("corner radius must be > 0");
  		if (cornerRadius == 0) {
  			fillRect(x, y, width, height);
  			return;
  		}
  
  		int mr = (int) Math.min(width, height) / 2;
  		// make sure that w & h are larger than 2*cornerRadius
  		if (cornerRadius > mr) {
  			cornerRadius = mr;
  		}
  
  		float d = cornerRadius * 2;
  
  		fillRect(x + cornerRadius, y, width - d, cornerRadius);
  		fillRect(x, y + cornerRadius, cornerRadius, height - d);
  		fillRect(x + width - cornerRadius, y + cornerRadius, cornerRadius,
  				height - d);
  		fillRect(x + cornerRadius, y + height - cornerRadius, width - d,
  				cornerRadius);
  		fillRect(x + cornerRadius, y + cornerRadius, width - d, height - d);
  
  		// bottom right - 0, 90
  		fillArc(x + width - d, y + height - d, d, d, segs, 0, 90);
  		// bottom left - 90, 180
  		fillArc(x, y + height - d, d, d, segs, 90, 180);
  		// top right - 270, 360
  		fillArc(x + width - d, y, d, d, segs, 270, 360);
  		// top left - 180, 270
  		fillArc(x, y, d, d, segs, 180, 270);
  	}
docs: Fill a rounded rectangle
  
  @param x
  The x coordinate of the top left corner of the rectangle
  @param y
  The y coordinate of the top left corner of the rectangle
  @param width
  The width of the rectangle
  @param height
  The height of the rectangle
  @param cornerRadius
  The radius of the rounded edges on the corners
  @param segs
  The number of segments to make the corners out of