Drawing from dictionary pixel by pixel from one image to another with same coordinates
<p>I'm trying to copy from image 1 to image 2 pixel by pixel, and I save the data from the image 1 in dictionary: <code>[UIColor:CGPoint]</code>. </p>

<p>How to draw on CGContext all points pixel by pixel with the exact color for certain pixel on the image 2 at the same CGPoint?</p>

<pre><code>@IBAction func save(sender: UIButton) {
    UIGraphicsBeginImageContext(CGSizeMake(100, 50))
    let context = UIGraphicsGetCurrentContext()
    for (color,point) in dict{
        drawPixel(context!, startPoint: point, color: color.CGColor)
    }
    testIV.image = UIGraphicsGetImageFromCurrentImageContext()
    UIGraphicsEndImageContext()
}

func drawPixel(context:CGContextRef, startPoint:CGPoint, color:CGColorRef){
    dispatch_async(dispatch_get_main_queue(), {
    CGContextSaveGState(context)
    CGContextSetLineCap(context, .Square)
    CGContextBeginPath(context)
    CGContextSetStrokeColorWithColor(context, color)
    CGContextSetLineWidth(context, 1.0)
    CGContextMoveToPoint(context, startPoint.x + 0.5, startPoint.y + 0.5)
    CGContextAddLineToPoint(context, startPoint.x + 0.5, startPoint.y + 0.5)
    CGContextStrokePath(context)
    CGContextRestoreGState(context)
    })
}
</code></pre>

<p>I've tried like this but the image is empty...</p>