title: How to gamma correct all visual elements in Swift
body: <p>I want to present visual stimuli in the screen with lineal values for the luminance. A value of 0.5 must have half the luminance than a value of 1.0.</p>
  
  <p>First I have measured the value gamma of the screen using a colorimeter.</p>
  
  <p>Then I compute the stimuli in a metal view. I compute the value of color(r, g, b, alpha) for each point.
  In the last line of the kernel I use the value of gamma measured  to “correct” the value of luminance when writing the texture:</p>
  
  <pre><code>output.write(pow(color, 1 / gamma), gid);
  </code></pre>
  
  <p>If I want to draw some simple things, as labels or texts, outside the metal view, I can modify the color using the same idea: </p>
  
  <pre><code>color = pow(color, 1 / gamma)
  </code></pre>
  
  <p>Both cases work fine, but I can’t blend the text over the metal view if the value of alpha is different of one because I am not in lineal space anymore.</p>
  
  <p>Is threre a way to make a transformation of color of all the elements on the screen after all the blending of views have been done?   </p>