title: Calculating anti-aliasing on a grid of points
body: <p>I'm representing an image by a list of integers representing the intensity of each pixel in an image. Each point is either 0 or 1. Given this data, how can I calculate the antialiased values so the final result is smooth?</p>
  
  <p>Example data:</p>
  
  <pre><code>// What I have
  const aliased = [
     0, 0, 0, 0, 0,
     0, 1, 1, 1, 0,
     0, 0, 0, 1, 0,
     0, 0, 1, 0, 0,
     0, 0, 0, 1, 0,
     0, 1, 0, 1, 0,
     0, 0, 1, 0, 0,
     0, 0, 0, 0, 0,
  ];
  
  // What I want to calculate
  const smoothed = [
     0, 0, 0, 0, 0,
     0, 1, 1, 1, 0,
     0, 0, 0, 1, 0,
     0, 0, 1, 0, 0.5, // &lt;- point with intensity of 50%
     0, 0, 0, 1, 0,
     0, 1, 0, 1, 0,
     0, 0, 1, 0, 0,
     0, 0, 0, 0, 0,
  ];
  </code></pre>
  
  <h1>Current input</h1>
  
  <p><a href="https://i.stack.imgur.com/IFRz7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IFRz7.png" alt="enter image description here"></a></p>
  
  <h1>Desired output</h1>
  
  <p><a href="https://i.stack.imgur.com/fnZmm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fnZmm.png" alt="enter image description here"></a></p>