开发者

Bitmap as a pointer [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago. 开发者_JAVA技巧

Hi i have a Bitmap which is showing in a file in a form;

Bitmap btm = new Bitmap("F:\\Image.bmp");

i have a method in a class which take this btm and do some process and return back what i need is to pass this btm to this function in the class as a memory pointer and return its address

im not sure that will this process is able to do it C# as other C based languages C/C++


if you are looking for a memory pointer to the pixel data then use Bitmap.LockBits() in an unsafe block. it returns a BitmapData object that contains info about the bitmap and the address.

take a look at this msdn article for more info.

EDIT: Would just like to note that if you would like to change pixel data then you could use the SetPixel method so you don't have to 'go unsafe'. But if you are looking at manipulating many pixels at a time then modifying them in memory does give better performance.

Hope that helps.

Cheers!


You can use delegates in C# in place of function pointers.

These links may help you understand the concept:

are there function pointers in c#?

Function pointers in C#

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜