title: C# Anti Aliasing Algorithm
body: <p>I want to write my own Anti Aliasing Algorithm in C#. My picture has only two colors; black and white.</p>
  
  <p>On Wikipedia (<a href="https://en.wikipedia.org/wiki/Spatial_anti-aliasing" rel="nofollow">https://en.wikipedia.org/wiki/Spatial_anti-aliasing</a>) I found the following pseudecode:</p>
  
  <pre><code>Define function PlotAntiAliasedPoint ( number x, number y )
      For roundedx = floor ( x ) to ceil ( x ) do
           For roundedy = floor ( y ) to ceil ( y ) do
                percent_x = 1 - abs ( x - roundedx )
                percent_y = 1 - abs ( y - roundedy )
                percent = percent_x * percent_y
                DrawPixel ( coordinates roundedx, roundedy, color percent (range 0-1) )
  </code></pre>
  
  <p>How do I implement this pseudocode in C#?</p>