Ejemplo n.º 1
0
        /// <summary>
        /// Gets a nice C# library version of the Frame Mode class
        /// </summary>
        /// <param name="mode">
        /// A <see cref="FreenectFrameMode"/>
        /// </param>
        /// <returns>
        /// A <see cref="FrameMode"/>
        /// </returns>
        internal static FrameMode FromInterop(FreenectFrameMode nativeMode, FrameModeType type)
        {
            FrameMode mode = null;

            // Make sure mode is valid
            if (nativeMode.IsValid == 0)
            {
                return(null);
            }

            // Figure out what type of mode it is
            if (type == FrameMode.FrameModeType.VideoFormat)
            {
                mode = new VideoFrameMode();
            }
            else if (type == FrameMode.FrameModeType.DepthFormat)
            {
                mode = new DepthFrameMode();
            }

            // Copy over rest of data
            mode.nativeMode          = nativeMode;
            mode.Size                = nativeMode.Bytes;
            mode.Width               = nativeMode.Width;
            mode.Height              = nativeMode.Height;
            mode.Resolution          = nativeMode.Resolution;
            mode.DataBitsPerPixel    = nativeMode.DataBitsPerPixel;
            mode.PaddingBitsPerPixel = nativeMode.PaddingBitsPerPixel;
            mode.FrameRate           = nativeMode.Framerate;
            mode.videoFormat         = nativeMode.VideoFormat;
            mode.depthFormat         = nativeMode.DepthFormat;

            return(mode);
        }
Ejemplo n.º 2
0
		/// <summary>
		/// Gets a nice C# library version of the Frame Mode class
		/// </summary>
		/// <param name="mode">
		/// A <see cref="FreenectFrameMode"/>
		/// </param>
		/// <returns>
		/// A <see cref="FrameMode"/>
		/// </returns>
		internal static FrameMode FromInterop(FreenectFrameMode nativeMode, FrameModeType type)
		{
			FrameMode mode = null;
			
			// Make sure mode is valid
			if(nativeMode.IsValid == 0)
			{
				return null;
			}
			
			// Figure out what type of mode it is
			if(type == FrameMode.FrameModeType.VideoFormat)
			{
				mode = new VideoFrameMode();
			}
			else if(type == FrameMode.FrameModeType.DepthFormat)
			{
				mode = new DepthFrameMode();
			}
			
			// Copy over rest of data
			mode.nativeMode = nativeMode;
			mode.Size = nativeMode.Bytes;
			mode.Width = nativeMode.Width;
			mode.Height = nativeMode.Height;
			mode.Resolution = nativeMode.Resolution;
			mode.DataBitsPerPixel = nativeMode.DataBitsPerPixel;
			mode.PaddingBitsPerPixel = nativeMode.PaddingBitsPerPixel;
			mode.FrameRate = nativeMode.Framerate;
			mode.videoFormat = nativeMode.VideoFormat;
			mode.depthFormat = nativeMode.DepthFormat;
			
			return mode;
		}