Question

I have the following function in C++ managed (ref) class:

public static void Transform(Bitmap^ img);

I want to call it from C# managed code. What I do is this:

Bitmap image = new Bitmap(100, 100);
MyClass.Transform(image);

Is this correct, or do I need to use fixed statement? If so, then how?

Thank you.

Was it helpful?

Solution

You need to lock the bitmap's backing memory as shown here.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top