C#转delphi求相助(急)
C#转delphi求帮助(急)
大多都是一知半解,求翻译一下
------解决方案--------------------
看上去象是将一段内存恢复到bitmap当中。对于Delphi也许比这个操作更为简单,那就是利用TBitmap类型,或许可以通过LoadFromStream一类的进行操作。
------解决方案--------------------
好像是以扫描线的形式把_getChangesBuffer这段内存里存的图像,写到开始初始化的bitmap里。
GetChangesBuffer 应该是个结构体,按同样声明在delphi同样声明一个结构体。然后就是delphi的内存操作,不比C#复杂。
var result = new Bitmap(_bitmapWidth, _bitmapHeight, format);
var rect = new System.Drawing.Rectangle(0, 0, _bitmapWidth, _bitmapHeight);
BitmapData bmpData = result.LockBits(rect, ImageLockMode.WriteOnly, format);
// Get the address of the first line.
IntPtr ptr = bmpData.Scan0;
// Declare an array to hold the bytes of the bitmap.
int bytes = bmpData.Stride * _bitmapHeight;
var getChangesBuffer = (GetChangesBuffer) Marshal.PtrToStructure(_getChangesBuffer, typeof (GetChangesBuffer));
var data = new byte[bytes];
Marshal.Copy(getChangesBuffer.UserBuffer, data, 0, bytes);
// Copy the RGB values into the bitmap.
Marshal.Copy(data, 0, ptr, bytes);
result.UnlockBits(bmpData);
大多都是一知半解,求翻译一下
------解决方案--------------------
看上去象是将一段内存恢复到bitmap当中。对于Delphi也许比这个操作更为简单,那就是利用TBitmap类型,或许可以通过LoadFromStream一类的进行操作。
------解决方案--------------------
好像是以扫描线的形式把_getChangesBuffer这段内存里存的图像,写到开始初始化的bitmap里。
GetChangesBuffer 应该是个结构体,按同样声明在delphi同样声明一个结构体。然后就是delphi的内存操作,不比C#复杂。