C
Chris
When I run this code in VB.NET, it hangs on the GeneratePerlinTexture call.
I think it is because I am not calling it correctly.
The C# code that works:
[DllImport("PerlinDLL.dll")]
static extern unsafe void GeneratePerlinTexture(void *ARGB32_pixels, int w,
int h);
....later...
BitmapData bmData;
Rectangle rect = new Rectangle(0,0,bmp_ARGB32.Width,bmp_ARGB32.Height);
bmData = bmp_ARGB32.LockBits(rect, ImageLockMode.ReadWrite,
PixelFormat.Format32bppArgb);
GeneratePerlinTexture(bmData.Scan0.ToPointer(), bmp_ARGB32.Width,
bmp_ARGB32.Height);
bmp_ARGB32.UnlockBits(bmData);
What I've done in VB.NET:
Declare Sub GeneratePerlinTexture Lib "Perlindll.dll" Alias
"GeneratePerlinTexture" (ByVal ARGB32_pixels As System.IntPtr, ByVal x As
Integer, ByVal y As Integer)
....later...
Dim bmData As Drawing.Imaging.BitmapData
Dim rect = New Rectangle(0, 0, my_bitmap.Width, my_bitmap.Height)
bmData = my_bitmap.LockBits(rect, Imaging.ImageLockMode.ReadWrite,
Imaging.PixelFormat.Format32bppArgb)
GeneratePerlinTexture(bmData.Scan0, my_bitmap.Width, my_bitmap.Height)
'Hangs here
my_bitmap.UnlockBits(bmData)
I have the source code for the DLL if needed.
I cannot figure it out!
Thank you if you can help.
Chris
I think it is because I am not calling it correctly.
The C# code that works:
[DllImport("PerlinDLL.dll")]
static extern unsafe void GeneratePerlinTexture(void *ARGB32_pixels, int w,
int h);
....later...
BitmapData bmData;
Rectangle rect = new Rectangle(0,0,bmp_ARGB32.Width,bmp_ARGB32.Height);
bmData = bmp_ARGB32.LockBits(rect, ImageLockMode.ReadWrite,
PixelFormat.Format32bppArgb);
GeneratePerlinTexture(bmData.Scan0.ToPointer(), bmp_ARGB32.Width,
bmp_ARGB32.Height);
bmp_ARGB32.UnlockBits(bmData);
What I've done in VB.NET:
Declare Sub GeneratePerlinTexture Lib "Perlindll.dll" Alias
"GeneratePerlinTexture" (ByVal ARGB32_pixels As System.IntPtr, ByVal x As
Integer, ByVal y As Integer)
....later...
Dim bmData As Drawing.Imaging.BitmapData
Dim rect = New Rectangle(0, 0, my_bitmap.Width, my_bitmap.Height)
bmData = my_bitmap.LockBits(rect, Imaging.ImageLockMode.ReadWrite,
Imaging.PixelFormat.Format32bppArgb)
GeneratePerlinTexture(bmData.Scan0, my_bitmap.Width, my_bitmap.Height)
'Hangs here
my_bitmap.UnlockBits(bmData)
I have the source code for the DLL if needed.
I cannot figure it out!
Thank you if you can help.
Chris