3. Called it, passing in a bitmap that I know has data. I know that the bitmap has data because I am using in another function called directly after this one.
The problem is that the charPixels array is always full of zeros.
Secondly can you please explain to me what the safe way of unlocking the bits is. I fear that if I just do it in the finally, if the bits aren't actually locked at that point I will get an exception.
,>what the safe way of unlocking the bits is
Ensuring if the bits are locked they will be unlocked even if there is an error and that they are not unlocked if the program never is able to lock in the first place
> check out gdiBitmapData values in a debugger
its Stride and Scan0 members
I tried to inspect Scan0, but it caused an 'internal compiler error' (not in front of the computer so those words are not exact). I will tell you the stride when I get home from work.
you can create something like finally, but there isn't anything that is immediately like it. You don't need it, though: creating it is probably a design fubar, indicating a copy from another language?
Ignore the strange line of code; that is commented out on my PC.
I am confused clearly 1280 is a positive number.
Are you saying that stride might not always be the same number even for images of identical format and size?
Clearly the number you've typed in your post and said was the Stride is positive, but that doesn't mean you're right. You never said where you got it from. Did you actually print out Stride in the code? Or are you just "calculating" it from a width of 426?
If I create and save a default 24-bit bitmap, the "height" member is stored as positive, which means that the pixels are store in a bottom-up manner, which means that the Stride is negative. So you are saying that your height member is stored as negative, indicating a positive stride?
If you could post a link to a complete (but minimal) program that demonstrates the problem, I'm sure someone can help you. If an input bmp is needed, or any other input, provide that too.
Thank you all for you help, but I solved my own problem.
I was confusing bitmap pixel data with the actual bytes of a bitmap, and Scan0 is the former. The reason I was getting only zero's is because the first few frames were black.