【发布时间】:2017-09-07 16:35:27
【问题描述】:
我在一个这样写的 dll 中有一个 Delphi 函数:
function LensFlare(Bitmap: TBitmap; X, Y: Int32; Brightness: Real): TBitmap; StdCall;
Begin
// ...
Result := Bitmap;
End;
我想在 C# 中使用它, 我已经尝试过了,但我没有成功:
[DllImport("ImageProcessor")]
static extern Bitmap LensFlare(Bitmap bitmap, int x, int y, double Brightness);
private void button1_Click(object sender, EventArgs e)
{
Bitmap b = new Bitmap(@"d:\a.bmp");
pictureBox1.Image = LensFlare(b, 100, 100, 50); // Error!
}
错误:“试图读取或写入受保护的内存。这通常表明其他内存已损坏。”
我该怎么做?
【问题讨论】:
标签: c# image delphi dll bitmap