I've been creating bitmaps using setpixel. This is too slow. After searching the net for days, about the only thing I've learned is that the fastest way is to convert a bitmap into a byte array and alter the array instead, then convert the array back into a bitmap.
The easiest way I've found to change a bitmap into an array is:
Dim bmBytes As Byte() = DirectCast(TypeDescriptor.
pTemp, GetType(Byte())), Byte())
I figured I would just study the array and learn how to alter it myself, but bmBytes is a different length from one bitmap to another despite the images having the same dimensions and bpp. What's going on here? And they don't even appear long enough, 70,000-90,000 for a 320x240, which is about 1 byte per pixel. How is a pixel assigned a 32bpp color from 1 byte???
So I'm stuck. I should point out that I'm not loading a previous image and then altering, but instead creating bitmaps from scratch based on other values. So, I don't even need to extract an array first, unless I need the header from a new bitmap? I also HAVE to assign colors using RGB values.
This article is the closest I've found regarding my need, but it involves CImage and I can't figure out how to reference the class. I'm using VB.NET4