T
Tamil Prakash
Guest
I have 3 IntPtr Pointers of Red, Green, and Blue channels. I need to display these pointers as an RGB image. I know the width and height of the image. If I convert it as a single pointer it takes processing cost. Is there any way to display these pointers.
Here is my Conversion Code,
public static void UpdateImage(WriteableBitmap wbitmap, IntPtr red, IntPtr green, IntPtr blue, int totalSize, int width, int height)
{
unsafe
{
byte* redByt = (byte*)red;
byte* blueByt = (byte*)blue;
byte* greenByt = (byte*)green;
byte* buffer = (byte*)wbitmap.BackBuffer;
for (int i = 0; i < totalSize; i+=3)
{
buffer[i * 3] = redByt;
buffer[i * 3 + 1] = blueByt;
buffer[i * 3 + 2] = greenByt;
}
wbitmap.Lock();
wbitmap.AddDirtyRect(new System.Windows.Int32Rect(0, 0, width, height));
wbitmap.Unlock();
}
}
Tamil Prakash
Continue reading...
Here is my Conversion Code,
public static void UpdateImage(WriteableBitmap wbitmap, IntPtr red, IntPtr green, IntPtr blue, int totalSize, int width, int height)
{
unsafe
{
byte* redByt = (byte*)red;
byte* blueByt = (byte*)blue;
byte* greenByt = (byte*)green;
byte* buffer = (byte*)wbitmap.BackBuffer;
for (int i = 0; i < totalSize; i+=3)
{
buffer[i * 3] = redByt;
buffer[i * 3 + 1] = blueByt;
buffer[i * 3 + 2] = greenByt;
}
wbitmap.Lock();
wbitmap.AddDirtyRect(new System.Windows.Int32Rect(0, 0, width, height));
wbitmap.Unlock();
}
}
Tamil Prakash
Continue reading...