title: How to change hue of UIIMAGE having transparent area?
body: <p>I am currently using following code for hue change:</p>
  
  <pre><code>  CGSize imageSize = [imageView.image size];
    CGRect imageExtent = CGRectMake(0,0,imageSize.width,imageSize.height);
  
    // Create a context containing the image.
    UIGraphicsBeginImageContext(imageSize);
    CGContextRef context = UIGraphicsGetCurrentContext();
    [imageView.image drawAtPoint:CGPointMake(0, 0)];
  
    // Draw the hue on top of the image.
    CGContextSetBlendMode(context, kCGBlendModeHue);
    [color set];
  
    UIBezierPath *imagePath = [UIBezierPath bezierPathWithRect:imageExtent];
    [imagePath fill];
  
    // Retrieve the new image.
    UIImage *result = UIGraphicsGetImageFromCurrentImageContext();
    imageView.image= result;
  
    UIGraphicsEndImageContext();
  </code></pre>
  
  <p>This code is working fine, only issue is it also sets the colour of transparent portions. Can I avoid applying the hue to that transparent area of the UIImage?</p>
  
  <p>Attached following two images for reference:</p>
  
  <p><img src="https://i.stack.imgur.com/LmU5b.png" alt="enter image description here">   <img src="https://i.stack.imgur.com/vsvXh.png" alt="enter image description here"></p>
  
  <p>Thanks in advance?</p>
  
  <p>Output 
  <img src="https://i.stack.imgur.com/knCsO.png" alt="enter image description here"></p>