Changing the color of a pixel 
<p>i am able to read a particular pixel at given CGPoint but i have been looking to change the color of a pixel and it would be highly appreciated if anyone can help me out with a code snippet.</p>

<p>My Code is:</p>

<pre><code>unsigned char* data = CGBitmapContextGetData (cgctx);       

if (data != NULL) {    
  offset = 4*((w*round(point.y))+round(point.x));    
  alpha =  data[offset];     
  red = data[offset+1];          
  green = data[offset+2];        
  blue = data[offset+3];     
  color = [UIColor colorWithRed:(red/255.0f) 
                   green:(green/255.0f) blue:(blue/255.0f) 
                   alpha:(alpha/255.0f)];       
}
</code></pre>
