 
 let width = 320
 let height = 240
-let redPixel = Pixel(r: 255, g: 0, b: 0)
-let pixelData = [Pixel](count: width * height, repeatedValue: redPixel)
-let image = createImage(width, height: height, pixels: pixelData)
+let backgroundColour = Colour(r: 0, g: 0, b: 0)
+let pixels = [Pixel](count: width * height, repeatedValue: backgroundColour)
+var image = Image(width: width, height: height, pixels: pixels)
+let uiImage = uiImageForImage(image)
+let lineColour = Colour(r: 255, g: 255, b: 255)
+drawLine(Point2d(x: 40, y: 40), end: Point2d(x: 280, y: 120), colour: lineColour, image: image)
+let uiImage2 = uiImageForImage(image)
+
+

    let a: UInt8 = 255
}

func createImage(width: Int, height: Int, pixels: [Pixel]) -> UIImage? {
    guard pixels.count == (width * height) else {
        return nil
    }
    let dataProvider = CGDataProviderCreateWithCFData(
        NSData(bytes: pixels, length: pixels.count * sizeof(Pixel))
    )

    let bytesPerPixel = 4
    let bitsPerComponent = 8
    let colourSpace = CGColorSpaceCreateDeviceRGB()
    let bitmapInfo = CGBitmapInfo(rawValue: CGImageAlphaInfo.PremultipliedLast.rawValue)
    if let cgImage = CGImageCreate(width, height, bitsPerComponent, bytesPerPixel * 8, bytesPerPixel * width, colourSpace, bitmapInfo, dataProvider, nil, false, .RenderingIntentDefault) {
        let image = UIImage(CGImage: cgImage)
        UIImagePNGRepresentation(image)
        return image
    } else {
        return nil
    }

import UIKit

struct Point2d<T> {
