T
Turbot
Hello,
I have come across this bit of code in a C# project and want to try and
replicate the behaviour in VB:
System.IntPtr ptrScan0 = objBMData.Scan0;
System.IntPtr ptrSrcScan0 = objBMSrc.Scan0;
byte * pOrig = (byte *)(void *)ptrScan0;
byte * pSrc = (byte *)(void *)ptrSrcScan0;
I know that VB does not support byte pointers but there must be a way
of doing this. The code then goes on to do this:
for(int y=0;y < yVal;++y)
{
for(int x=0; x < xVal; ++x )
{
pOrig[0] = pSrc[newVal1];
pOrig[1] = pSrc[newVal2];
pOrig[2] = pSrc[newVal3];
pOrig += 3;
}
pOrig += nOffset;
}
I may be wrong (i've never been a C programmer) but this looks like we
are setting three values in memory based on the current position of the
pointer and then shifting the start position of the pointer by three
through each iteration of the inner for loop. Again, I would need to
know how to do this in VB.NET.
Your help is much appreciated.
IAN KEVAN
I have come across this bit of code in a C# project and want to try and
replicate the behaviour in VB:
System.IntPtr ptrScan0 = objBMData.Scan0;
System.IntPtr ptrSrcScan0 = objBMSrc.Scan0;
byte * pOrig = (byte *)(void *)ptrScan0;
byte * pSrc = (byte *)(void *)ptrSrcScan0;
I know that VB does not support byte pointers but there must be a way
of doing this. The code then goes on to do this:
for(int y=0;y < yVal;++y)
{
for(int x=0; x < xVal; ++x )
{
pOrig[0] = pSrc[newVal1];
pOrig[1] = pSrc[newVal2];
pOrig[2] = pSrc[newVal3];
pOrig += 3;
}
pOrig += nOffset;
}
I may be wrong (i've never been a C programmer) but this looks like we
are setting three values in memory based on the current position of the
pointer and then shifting the start position of the pointer by three
through each iteration of the inner for loop. Again, I would need to
know how to do this in VB.NET.
Your help is much appreciated.
IAN KEVAN