         block()
         CGContextRestoreGState(self)
     }
+}
 
+// MARK: Colors
+
+public extension CGContext {
 #if os(OSX)
     func withColor(color:NSColor, block:() -> Void) {
         with {

            return nsimage
        }
    }
}
#endif

public extension CGContextRef {

    func strokeCross(rect:CGRect) {
        let linePoints = [


// TODO: This code is mostly experimental, use at your own risk - see TODO.markdown

public extension CGContext {

    class func bitmapContext(size:CGSize) -> CGContext! {
        let colorspace = CGColorSpaceCreateDeviceRGB()    
        var bitmapInfo = CGBitmapInfo(CGImageAlphaInfo.PremultipliedFirst.toRaw())
        return CGBitmapContextCreate(nil, UInt(size.width), UInt(size.height), 8, UInt(size.width) * 4, colorspace, bitmapInfo)
