I’m currently writing a C# implementation of a little program which I have written in Java.
I had used BufferedImage.getRGB(int startX, int startY, int w, int h, int[] rgbArray, int offset, int scansize) function in my Java app. But I couldn’t exactly find a version of this in C# and I am not sure how to write it manually.
There’s not a direct equivalent in the .NET Framework to this method. However, if your image is a System.Drawing.Bitmap, you can call the LockBits method, and this will return a BitmapData structure that contains the address of the first scanline. You can then use it to create what should be an API-compatible wrapper. I’m assuming you’re using C# 3.5 or greater, so I’m using an extension method – if you’re using an older flavor, change this to a regular method by dropping the ‘this’ from the Bitmap argument:
This wrapper can now be called like this:
Hope this helps, and welcome to .NET!