         }
         
         context.saveGraphicsState()
-
+        
         let path = NSBezierPath()
         
         path.moveToPoint(points[0])
-
+        
         for i in 1...points.count-1 {
             path.lineToPoint(points[i])
         }
-
+        
         if let existingFillColor = fill_?.color {
             existingFillColor.setFill()
             path.fill()
         }
-
+        
         path.closePath()
-
+        
         if let existingStrokeColor = stroke_?.color {
             existingStrokeColor.setStroke()
+            path.lineWidth = lineWidth
             path.stroke()
         }
         

    return NSMakeRect(CGFloat(x), CGFloat(y), CGFloat(w), CGFloat(h))
}

struct BitmapCanvas {
    
    let bitmapImageRep : NSBitmapImageRep
    let context : NSGraphicsContext

        context.restoreGraphicsState()
    }
    
    func polygon(points:[NSPoint], stroke stroke_:ConvertibleToNSColor? = NSColor.blackColor(), lineWidth:CGFloat=1.0, fill fill_:ConvertibleToNSColor? = nil) {
        
        guard points.count >= 3 else {
            assertionFailure("at least 3 points are needed")
