g45rg34d
g45rg34d

Reputation: 9660

Pass Bitmap object to unmanaged code

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.

Upvotes: 0

Views: 1811

Answers (1)

Eric J.
Eric J.

Reputation: 150188

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

Upvotes: 1

Related Questions