Click here to Skip to main content
15,887,485 members
Home / Discussions / C#
   

C#

 
AnswerRe: Searching in XML Pin
Not Active13-Jul-09 8:19
mentorNot Active13-Jul-09 8:19 
AnswerRe: Searching in XML Pin
0x3c013-Jul-09 8:43
0x3c013-Jul-09 8:43 
GeneralRe: Searching in XML Pin
Not Active13-Jul-09 10:19
mentorNot Active13-Jul-09 10:19 
GeneralRe: Searching in XML Pin
0x3c013-Jul-09 19:54
0x3c013-Jul-09 19:54 
QuestionUnmanaged DLL: C# variable for C++ char** Pin
belier113-Jul-09 7:06
belier113-Jul-09 7:06 
AnswerRe: Unmanaged DLL: C# variable for C++ char** Pin
Luc Pattyn13-Jul-09 7:28
sitebuilderLuc Pattyn13-Jul-09 7:28 
GeneralRe: Unmanaged DLL: C# variable for C++ char** Pin
belier113-Jul-09 9:47
belier113-Jul-09 9:47 
GeneralRe: Unmanaged DLL: C# variable for C++ char** Pin
Luc Pattyn13-Jul-09 10:04
sitebuilderLuc Pattyn13-Jul-09 10:04 
Hi,

when fixed doesn't fit the requirements, GCHandle will. I tend to almost always use GCHandle, even when fixed would suffice. One of the advantages is you typically don't need to copy the data AT ALL, since the scenario is:
1. managed world creates an array
2. uses GCHandle to pin and get the pointer
3. passes it to native world, which fills the buffer, then returns
4. managed world frees GCHandle and uses the array.
See, no copy involved, hence also no performance hit.

If the buffer is really the entire pixel data of a Bitmap, I would try and use Bitmap.Lockbits to pin and get the pointer (it does what GCHandle does for a general object), pass that pointer to the native world, and all would be OK again without a copy operation, provided your native code:
1. applies the right byte ordering within a pixel
2. applies the right pixel ordering
3. applies the right bitmap stride (normally no problem if scanlines are a multiple of 4 bytes, which is true for 32-bit pixels, or image widths that are multiples of 4).

My number 1 rule in image processing is: avoid copy operations.

Smile | :)

Luc Pattyn [Forum Guidelines] [My Articles]

The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.

GeneralRe: Unmanaged DLL: C# variable for C++ char** Pin
belier113-Jul-09 11:07
belier113-Jul-09 11:07 
GeneralRe: Unmanaged DLL: C# variable for C++ char** Pin
Luc Pattyn13-Jul-09 11:12
sitebuilderLuc Pattyn13-Jul-09 11:12 
GeneralRe: Unmanaged DLL: C# variable for C++ char** Pin
belier114-Jul-09 1:10
belier114-Jul-09 1:10 
QuestionGet local groups and users from server remotely with console app Pin
briancollins3213-Jul-09 6:50
briancollins3213-Jul-09 6:50 
QuestionHow do you count the number of decimals in a decimal datatype Pin
Nathan Revka13-Jul-09 6:26
Nathan Revka13-Jul-09 6:26 
AnswerRe: How do you count the number of decimals in a decimal datatype Pin
Luc Pattyn13-Jul-09 6:34
sitebuilderLuc Pattyn13-Jul-09 6:34 
AnswerRe: How do you count the number of decimals in a decimal datatype Pin
musefan13-Jul-09 6:51
musefan13-Jul-09 6:51 
AnswerRe: How do you count the number of decimals in a decimal datatype Pin
TheGreatAndPowerfulOz13-Jul-09 6:51
TheGreatAndPowerfulOz13-Jul-09 6:51 
QuestionDccg Pin
peishen8813-Jul-09 5:47
peishen8813-Jul-09 5:47 
AnswerRe: Dccg Pin
Luc Pattyn13-Jul-09 5:54
sitebuilderLuc Pattyn13-Jul-09 5:54 
GeneralRe: Dccg Pin
DoctorMick13-Jul-09 5:58
DoctorMick13-Jul-09 5:58 
GeneralRe: Dccg Pin
peishen8813-Jul-09 6:10
peishen8813-Jul-09 6:10 
GeneralRe: Dccg Pin
Luc Pattyn13-Jul-09 6:33
sitebuilderLuc Pattyn13-Jul-09 6:33 
QuestionHorizontal scrollbar broken in datagrid after migrating to VS2008 Pin
smcirish13-Jul-09 4:47
smcirish13-Jul-09 4:47 
Question2 dimensional byte array Pin
Vivek Vijayan13-Jul-09 4:19
Vivek Vijayan13-Jul-09 4:19 
AnswerRe: 2 dimensional byte array Pin
harold aptroot13-Jul-09 4:51
harold aptroot13-Jul-09 4:51 
GeneralRe: 2 dimensional byte array Pin
Vivek Vijayan13-Jul-09 5:07
Vivek Vijayan13-Jul-09 5:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.