title: How to remove opacity but keep the alpha channel of UIImage?
body: <p>I have a layer where I want the user to draw a 'mask' for cutting out images. It is semi-opaque so that they can see beneath what they are selecting.</p>
  
  <p>How can I process this so that the drawing data has an alpha of 1.0, but retain the alpha channel (for masking)?</p>
  
  <p>TL:DR - I'd like the black area to be a solid, single colour.</p>
  
  <ul>
  <li>Here is the desired before and after (the white background should be transparent in both):
  <img src="https://i.stack.imgur.com/VgMK8.jpg" alt="Desired Before &amp; After"></li>
  </ul>
  
  <p>something like this:</p>
  
  <pre><code>for (pixel in image) {
    if (pixel.alpha != 0.0) {
      fill solid black
    }
  }
  </code></pre>