C#与C++之间可以互相传递图片数据
发布时间
阅读量:
阅读量
将C#中的数据传递至C++环境,需先对C++代码进行编译生成dll库文件,此处暂不详述具体编译步骤。
C#语言特性与应用
- 定义交互界面
[DllImport("dllmake")]
private unsafe static extern bool detectAndDraw(byte[] ImageBuffer, byte[] ImageBuffer1, int imageWeidth, int imageHeight, byte[] data);
接口的调用
bool flag = detectAndDraw(rgbValues, rgbValues1, ImageWeidth, ImageHeight, pstdata);
将图像转换为byte[]格式
注:无法直接通过IO方式将图像读取为byte[]数组,若采用此方法获取数组,所传输的数据将无法还原为完整的图像。需借助C#内置库(System.Drawing.dll)实现该操作。 ## System.Drawing.dll
Bitmap bmp = (Bitmap)Image.From
全部评论 (0)
还没有任何评论哟~
