G
Guest
I dont know if I missed something in documentation,
but I was having a problem with "Bitmap.LockBits" and
was wondering if anyone else has discovered it too.
According to everyones examples including some of
the MVP's website examples, one could use unmanaged
code to manipulate a bitmap by casting the IntPtr from
the Bitmap.LockBits to say an (int*).
The problem I found is that the bitmap would rarely
move around in memory throwing a fault if you were
in the middle of manipulating a bmp.
My application was a cute little scrolling program
doing a 600x800 bmp at about 30fps. It usualy took about
5 to 10minutes before it tanked. (surely directx and
manipulating textures would have been faster, but thats
not the point.)
I found that if I specified the bitmaps data via another
one of the bitmap constructors, then pinning the memory
in the GC then and only then would the program be 100%
stable.
The only thing I know the Bitmap.LockBits does is lock
out a portion of the bitmap to prevent cross threading issues.
Has anyone else had this problem? Any other solutions while
still using pointers to manipulate data?
but I was having a problem with "Bitmap.LockBits" and
was wondering if anyone else has discovered it too.
According to everyones examples including some of
the MVP's website examples, one could use unmanaged
code to manipulate a bitmap by casting the IntPtr from
the Bitmap.LockBits to say an (int*).
The problem I found is that the bitmap would rarely
move around in memory throwing a fault if you were
in the middle of manipulating a bmp.
My application was a cute little scrolling program
doing a 600x800 bmp at about 30fps. It usualy took about
5 to 10minutes before it tanked. (surely directx and
manipulating textures would have been faster, but thats
not the point.)
I found that if I specified the bitmaps data via another
one of the bitmap constructors, then pinning the memory
in the GC then and only then would the program be 100%
stable.
The only thing I know the Bitmap.LockBits does is lock
out a portion of the bitmap to prevent cross threading issues.
Has anyone else had this problem? Any other solutions while
still using pointers to manipulate data?