//------------------------------------------------------------------------------ // // Copyright (c) Microsoft Corporation. All rights reserved. // //------------------------------------------------------------------------------ // Manages the drawing of image data #pragma once #include #include "iCapture.h" class ImageRenderer { public: /// /// Constructor /// ImageRenderer(); /// /// Destructor /// virtual ~ImageRenderer(); /// /// Set the window to draw to as well as the video format /// Implied bits per pixel is 32 /// /// window to draw to /// already created D2D factory object /// width (in pixels) of image data to be drawn /// height (in pixels) of image data to be drawn /// length (in bytes) of a single scanline /// indicates success or failure HRESULT Initialize(HWND hwnd, ID2D1Factory* pD2DFactory, int sourceWidth, int sourceHeight, int sourceStride); /// /// Draws a 32 bit per pixel image of previously specified width, height, and stride to the associated hwnd /// /// image data in RGBX format /// size of image data in bytes /// indicates success or failure HRESULT Draw(BYTE* pImage, unsigned long cbImage, std::vector &bodies); private: HWND m_hWnd; // Format information UINT m_sourceHeight; UINT m_sourceWidth; LONG m_sourceStride; // Direct2D ID2D1Factory* m_pD2DFactory; ID2D1HwndRenderTarget* m_pRenderTarget; ID2D1Bitmap* m_pBitmap; /// /// Ensure necessary Direct2d resources are created /// /// indicates success or failure HRESULT EnsureResources(); /// /// Dispose of Direct2d resources /// void DiscardResources(); //void DrawBody(Body &body); //void DrawBone(Body &body, JointType joint0, JointType joint1); ID2D1SolidColorBrush* m_pBrushJointTracked; ID2D1SolidColorBrush* m_pBrushJointInferred; ID2D1SolidColorBrush* m_pBrushBoneTracked; ID2D1SolidColorBrush* m_pBrushBoneInferred; ID2D1SolidColorBrush* m_pBrushHandClosed; ID2D1SolidColorBrush* m_pBrushHandOpen; ID2D1SolidColorBrush* m_pBrushHandLasso; };