Hi, I have two forms that both open windows, I need to get the response from a checkbox on Form2 and use it with Form1, Form2 is not a dialogue and needs to open all the time. Any ideas? Thanks.
CopperCircle
Posts
-
How can I get input from 2 forms? -
And operator in c#?Hi, I am trying to convert some of my BlitzBasic code over to C# and I cant get the following statment to work? Blitz: If paletteRmap[i]=0 And paletteGmap[i]=0 And paletteBmap[i]=0 C#: If (paletteRmap[best]=0 & paletteGmap[best]=0 & paletteBmap[best]=0) Error Message The left-hand side of an assignment must be a variable, property or indexer? Thanks.
-
How can I copy a block of memory?Hi, I found a very quick method in the end using RtlMoveMemory:
[DllImport("kernel32")]
public static extern void RtlMoveMemory(IntPtr dest, IntPtr src, int len);System.IntPtr pBuffer2 = Marshal.AllocHGlobal(BufferSize); //Assign unmanaged memory
RtlMoveMemory(pBuffer2, pBuffer, BufferSize); //Copy memory
byte* p2 = (byte*)(void*)pBuffer2;
// Use p2 to access image pixels
Marshal.FreeHGlobal(pBuffer2); //Free unmanaged memoryThanks, for the help and hope this helps some one else.
-
How can I copy a block of memory?Thanks, I tried to use Marshal.Copy but I could not get it to work, could you please show how to implement it? Cheers,
-
How can I copy a block of memory?Thanks, I got it to work, but there must be an faster/easyer way to copy a block of memory? This is what I did to get it to work with Marshal.ReadByte, it gives me p2 which I can use on the copied image:
byte[] bytes = new byte[BufferSize];
for (int i = 0; i < BufferSize; i++)
bytes[i] = Marshal.ReadByte(pBuffer, i);fixed (byte* pTmp = bytes)
{
System.IntPtr pBuffer2 = new IntPtr((void*)pTmp);
byte* p2 = (byte*)(void*)pBuffer2;
} -
How can I copy a block of memory?Thanks for the reply, I am very new to C# and I am just working off the Videocog tutorials, do you have an example of how Marshal.Copy works?
-
How can I copy a block of memory?Hi, I am trying to use the third party VideoCog componet with C# and I need to copy a image frame? Videocog drops the frame into an rgb array in memory and I can then fast process the pixels using pointers. How can I create another copy of the frame from memory so that I can also access that via another pointer? Thanks...
- private void videoCogControl1_FrameReady(double SampleTime, IntPtr pBuffer,
-
int BufferSize, int Width, int Height)
-
{
-
unsafe
-
{
-
byte\* p = (byte\*)(void\*)pBuffer;
-
int nWidth = Width \* 3;
-
for (int y = 0; y < Height; y++)
-
{
-
for (int x = 0; x < nWidth; x++)
-
{
-
p\[0\] = (byte)(255 - p\[0\]);
-
p++;
-
}
-
}
-
}
-
}
-
How can I copy a block of memory?Hi, I have an image in memory as an RGB array, I need to make a fast copy of it? I access the image in usafe mode using the following pointer byte* p = (byte*)(void*)pBuffer; I need another copy of the data so that I can create a new pointer to it and leave my origional data unaffected. Thanks...
-
How to navigate memory using pointers?Hi, the problem is I have only used Blitz Basic before and I could jump to a pixel, eg GetColor(129,280)"Width,Height", with pointers I have to scan along the image for the data, I dont know how to jump to the pixel data I want?
-
How to navigate memory using pointers?Hi, I am very new to C# but I am modifying an image buffer directly within memory, I am scanning along moving the pointer to get the RGB of each pixel, but I need away to jump around the image memory and read the pixels at random rather than just p++ or p--? Thanks...
unsafe { byte\* p = (byte\*)(void\*)pBuffer; for(int y = 0; y < Height; y++) { for(int x = 0; x < Width; x++) { //B int srcB = p\[0\]; p++; //G int srcG = p\[0\]; p++; //R int srcR = p\[0\]; p++; } } }
-
How to get a RGB values from an image buffer?Hi, I am new to C# and im working trying some image processing, im using this bit of code to invert the pixels on an image grabbed from a video file, how do I extract the RGB values from a pixel in C# using the image buffer? Speed is of the essence... Thanks in advance.
unsafe
{
byte* p = (byte *)(void *)pBuffer;
int nWidth = Width * 3;
for(int y = 0; y < Height; y++)
{
for(int x = 0; x < nWidth; x++ )
{
p[0] = (byte)(255-p[0]);
p++;