     }
   }
   
-  // MARK: - Mask
-  
-  public func maskCircle() {
+  // MARK: - Circle
+  
+  private func maskCircle() {
     layer.cornerRadius = ceil(min(bounds.width, bounds.height))/2
   }
   
-  public func maskPolygon(sides: Int = 6) {
+  // MARK: - Polygon
+  
+  private func maskPolygonFromString(mask: String) {
+    let sides = Int(retrieveMaskParameters(mask, maskName: MaskType.Polygon.rawValue))
+    if let unwrappedSides = sides {
+      maskPolygon(unwrappedSides)
+    } else {
+      maskPolygon()
+    }
+  }
+  
+  private func maskPolygon(sides: Int = 6) {
     let polygonPath = maskPolygonBezierPath(sides)
     drawPath(polygonPath)
   }
+
+  private func maskPolygonBezierPath(sides: Int) -> UIBezierPath {
+    let path = UIBezierPath()
+    let center = CGPoint(x: bounds.width / 2.0, y: bounds.height / 2.0)
+    var angle: CGFloat = -CGFloat(M_PI / 2.0)
+    let angleIncrement = CGFloat(M_PI * 2.0 / Double(sides))
+    let radius = bounds.width / 2.0
+    
+    path.moveToPoint(pointFrom(angle, radius: radius, offset: center))
+    for _ in 1...sides - 1 {
+      angle += angleIncrement
+      path.addLineToPoint(pointFrom(angle, radius: radius, offset: center))
+    }
+    path.closePath()
+    return path
+  }
+  
+  // MARK: - Star
+  
+  private func maskStarFromString(mask: String) {
+    let points = Int(retrieveMaskParameters(mask, maskName: MaskType.Star.rawValue))
+    if let unwrappedPoints = points {
+      maskStar(unwrappedPoints)
+    } else {
+      maskStar()
+    }
+  }
   
   // See https://www.weheartswift.com/bezier-paths-gesture-recognizers/
-  public func maskStar(points: Int = 5) {
+  private func maskStar(points: Int = 5) {
     // FIXME: Do not mask the shadow.
     
     // Stars must has at least 3 points.

    } else {
      maskWave()
    }
  }
  
  private func maskWaveBezierPath(waveUp: Bool, waveWidth: CGFloat, waveOffset: CGFloat) -> UIBezierPath {

    path.addLineToPoint(CGPoint(x: path.currentPoint.x, y: originY))    
    return path
  }

  
  // MARK: - Private helper
  
  private func drawPath(path: UIBezierPath) {
    layer.mask?.removeFromSuperlayer()
    
    let maskLayer = CAShapeLayer()
    maskLayer.frame = CGRect(origin: CGPoint.zero, size: bounds.size)
    maskLayer.path = path.CGPath
    layer.mask = maskLayer
  }
  
  private func degree2radian(degree: CGFloat) -> CGFloat {
    let radian = CGFloat(M_PI) * degree / 180
    return radian
  }
  
  private func pointFrom(angle: CGFloat, radius: CGFloat, offset: CGPoint) -> CGPoint {
    return CGPoint(x: radius * cos(angle) + offset.x, y: radius * sin(angle) + offset.y)
  }
  
  private func retrieveMaskParameters(mask: String, maskName: String) -> String {
    var params = mask.stringByReplacingOccurrencesOfString(" ", withString: "")
    params = params.stringByReplacingOccurrencesOfString(maskName, withString: "")
    params = params.stringByReplacingOccurrencesOfString("(", withString: "")
    params = params.stringByReplacingOccurrencesOfString(")", withString: "")
    return params
  }
  
}
