Using unsafe pointers is the fastest way to directly manipulate memory in C # (definitely faster than using marshal's wrapper functions).
Just out of curiosity, what 2D drawing operations are you trying to perform?
I ask because blocking the DirectX surface to process pixel levels will defeat the hardware acceleration benefits you hoped to gain from using DirectX. In addition, the DirectX device will not initialize when used in terminal services (Remote Desktop), so the control will not be suitable for this scenario (this may not matter to you).
DirectX will be a big win when drawing large triangles and transforming images (the texture displayed on the quadrant), but in reality it will not do very well with one-pixel manipulations.
Staying in a .NET environment is one alternative - to support a Bitmap object to act like your surface using LockBits and directly accessing pixels through an insecure pointer in the returned BitmapData object.
Corey Ross Sep 13 '08 at 20:41 2008-09-13 20:41
source share