0
votes

I'm trying to send image to atl com dll. In C#,

System.Drawing.Imaging.BitmapData bmpdata = 
bmp1.LockBits(new System.Drawing.Rectangle(0,0,bmp1.Width, bmp1.Height),
System.Drawing.Imaging.ImageLockMode.ReadWrite, bmp1.PixelFormat);

And get the bytearray of bitmapdata just like this,

bmpdata.Scan0;

How can i send this bitmap data in to ATL COM dll? i will create a opencv cv::mat inside com dll using incoming bytearray.

Thanks.

1

1 Answers

0
votes

I guess the Automation-compatible way would be to Marshal.Copy the contents into an array of bytes, and have it marshaled as a SAFEARRAY of bytes.

I don't know it it's the simplest way, but it's the first I can think of. There are probably other ways if your interface is not Automation-compatible, like simply passing the IntPtr as a byte pointer and size.