title: What is a good way to rotate a pixel array?
body: <p>Does the .NET framework provide a good way to rotate a pixel array?  To be more clear, I am not just looking for a way to rotate an image.  Instead I want to rotate the underlying pixel array that the image is/will be based on in such a way that I have access to the modified array.  I would rather not implement a rotation algorithm or wrap another library if the .NET framework already provides a good way to do this.  I need to be able to support any rotations, not merely 90/180/270/etc. rotations, which would be simple to implement.</p>
  
  <p>I have thought about using one of the image classes that supports this type of rotation and accessing the modified array from it afterward.  I am not sure if this is a good idea in the first place and also not sure which image class would be the best choice for this.  So far I haven't had much luck finding a class or combination of classes that supports the rotations I need and enables access to the pixel array.</p>
  
  <p><strong>Update:</strong></p>
  
  <p>I'm starting to think I either asked the wrong question or asked the right question poorly.  If I understand what Cosmin meant about using the Matrix class correctly, I don't think this will work for what I am actually trying to do.  I'll try to do a better job of explaining my problem.</p>
  
  <p>Basically, I have a 2D array of data and I want to rotate it.  What I mean by this is that I want the values of the elements to be rotated to the appropriate elements based on the rotation.</p>
  
  <p>For example:</p>
  
  <pre><code>-----------
  |A|A|A|A|A|
  -----------
  |B|B|B|B|B|
  -----------
  |C|C|C|C|C|
  -----------
  </code></pre>
  
  <p>If I were to rotate this array around the center element by 90 degrees counterclockwise, I should end up with something like this:</p>
  
  <pre><code>-----------
  | |A|B|C| |
  -----------
  | |A|B|C| |
  -----------
  | |A|B|C| |
  -----------
  </code></pre>
  
  <p>Unfortunately, I have to support any rotation, not just 90 degree rotations, which means a more complicated rotation algorithm is needed, since the rotated element indexes won't always be integers and may overlap as well.  This seems like a problem that has probably been solved in the field of computer graphics, which led to me ask the question the way I did.</p>