B
BartMan
Greetings,
Is there a way to convert a TransformedBitmap to InteropBitmap when using WPF?
I can't seem to get it conver correctly after it is has been transformed.
I tried casting it, and using the as, but can't seem to find a way to do this?
Basically we are getting a InteropBitmap from a 3rd party app and I need to
rotate it, and then pass it back out as InteropBitmap in its rotated format.
For Example:
TransformedBitmap tb = new TransformedBitmap();
// bitmap from a 3rd party Directshow Filter grabber.
InteropBitmap bitmap =
System.Windows.Interop.Imaging.CreateBitmapSourceFromMemorySection(section,
capGrabber.Width, capGrabber.Height, PixelFormats.Bgr32,
capGrabber.Width *
PixelFormats.Bgr32.BitsPerPixel / 8, 0) as InteropBitmap;
// Rotate the bitmap 90 degrees.
tb.BeginInit();
tb.Source = bitmap;
RotateTransform transform = new RotateTransform(90);
tb.Transform = transform;
tb.EndInit();
// Does not cast? HOW DO I CONVERT?
InteropBitmap bitmapRotated = (InteropBitmap)tb;
return bitmapRotated;
How can I do the InteropBitmap conversion?
Thanks for any suggestions!
Is there a way to convert a TransformedBitmap to InteropBitmap when using WPF?
I can't seem to get it conver correctly after it is has been transformed.
I tried casting it, and using the as, but can't seem to find a way to do this?
Basically we are getting a InteropBitmap from a 3rd party app and I need to
rotate it, and then pass it back out as InteropBitmap in its rotated format.
For Example:
TransformedBitmap tb = new TransformedBitmap();
// bitmap from a 3rd party Directshow Filter grabber.
InteropBitmap bitmap =
System.Windows.Interop.Imaging.CreateBitmapSourceFromMemorySection(section,
capGrabber.Width, capGrabber.Height, PixelFormats.Bgr32,
capGrabber.Width *
PixelFormats.Bgr32.BitsPerPixel / 8, 0) as InteropBitmap;
// Rotate the bitmap 90 degrees.
tb.BeginInit();
tb.Source = bitmap;
RotateTransform transform = new RotateTransform(90);
tb.Transform = transform;
tb.EndInit();
// Does not cast? HOW DO I CONVERT?
InteropBitmap bitmapRotated = (InteropBitmap)tb;
return bitmapRotated;
How can I do the InteropBitmap conversion?
Thanks for any suggestions!