i am new in programming this kind of stuff and a search did not help me out. i found following code on the web and would need to modify it because this is giving me a overflowexception on toint32().
Any help appreciated! thanks
// lock bitmap data
BitmapData bmData = img.LockBits(
new Rectangle(0, 0, width, height),
ImageLockMode.ReadWrite,
PixelFormat.Format24bppRgb);
// copy image data
int srcStride = bmData.Stride;
int dstStride = bmData.Stride;
int dst = bmData.Scan0.ToInt32() + dstStride * (height - 1);
int src = pBuffer.ToInt32();
for (int y = 0; y < height; y++)
{
Win32.memcpy(dst, src, srcStride);
dst -= dstStride;
src += srcStride;
}
// unlock bitmap data
img.UnlockBits(bmData);
Scan0 is a pointer, using ToInt32() will overflow if you run in 64-bit mode. You must use ToInt64() and cast back to IntPtr. Your memcpy() declaration is wrong as well. Some handy declarations: