Frame.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using System;
  2. namespace TouchlessA3D {
  3. public enum FrameRotation {
  4. /// No rotation.
  5. ROTATION_NONE = 0,
  6. /// Rotated 180 degrees.
  7. ROTATION_180 = 180
  8. }
  9. public interface IFrame : System.IDisposable {
  10. IntPtr getNativeFrame ();
  11. }
  12. public struct Frame : IFrame {
  13. IntPtr m_nativeFrame;
  14. public Frame (IntPtr src_y, int src_stride_y,
  15. IntPtr src_u, int src_stride_u,
  16. IntPtr src_v, int src_stride_v,
  17. int pixel_stride_uv, int width, int height,
  18. long timestamp_ms, FrameRotation rotation) {
  19. m_nativeFrame = NativeCalls.ta3d_frame_create_from_android_420 (
  20. src_y, src_stride_y, src_u, src_stride_u,
  21. src_v, src_stride_v, pixel_stride_uv, width, height,
  22. timestamp_ms, rotation);
  23. }
  24. public Frame (
  25. IntPtr src_rgba, int src_stride,
  26. int width, int height,
  27. long timestamp_ms, FrameRotation rotation,
  28. bool flip_vertically) {
  29. m_nativeFrame = NativeCalls.ta3d_frame_create_from_rgba (
  30. src_rgba, src_stride, width, height,
  31. timestamp_ms, rotation, flip_vertically);
  32. }
  33. public IntPtr getNativeFrame () {
  34. return m_nativeFrame;
  35. }
  36. public void Dispose () {
  37. NativeCalls.ta3d_frame_destroy (m_nativeFrame);
  38. }
  39. }
  40. }