I've been using the following sub in my control that I'm creating to let me modify the pixels in a bitmap faster:
Protected Sub LockForMemory()
idata = ime.LockBits(New Rectangle(0, 0, ime.Width, ime.Height), ImageLockMode.WriteOnly, ime.PixelFormat)
ipoint = idata.Scan0
ibytes = Math.Abs(idata.Stride) * ime.Height
ReDim irgbvalues(ibytes - 1)
System.Runtime.InteropServices.Marshal.Copy(ipoint, irgbvalues, 0, ibytes)
End Sub
All of that works, later when I go to retrieve the actual image after manipulation, it works fine as well. The problem is setting those actual pixels.
What is this array of? I know that it's filled with Integers
but what does each indice represent? At first I thought it was setup like this:
Array-> [R of Pixel 0,0][G of Pixel 0,0][B of Pixel 0,0][R of Pixel 2,0][G of Pixel 2,0][B of Pixel 2,0]
This doesn't seem to work right, however.