-
Notifications
You must be signed in to change notification settings - Fork 0
/
BodyBasics.cpp
executable file
·653 lines (544 loc) · 20.6 KB
/
BodyBasics.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
//------------------------------------------------------------------------------
// <copyright file="BodyBasics.cpp" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
#include "stdafx.h"
#include <strsafe.h>
#include "resource.h"
#include "BodyBasics.h"
//add for zmq
#include "ZmqSkeletonPublisher.h"
static const float c_JointThickness = 3.0f;
static const float c_TrackedBoneThickness = 6.0f;
static const float c_InferredBoneThickness = 1.0f;
static const float c_HandSize = 30.0f;
/// <summary>
/// Entry point for the application
/// </summary>
/// <param name="hInstance">handle to the application instance</param>
/// <param name="hPrevInstance">always 0</param>
/// <param name="lpCmdLine">command line arguments</param>
/// <param name="nCmdShow">whether to display minimized, maximized, or normally</param>
/// <returns>status</returns>
int APIENTRY wWinMain(
_In_ HINSTANCE hInstance,
_In_opt_ HINSTANCE hPrevInstance,
_In_ LPWSTR lpCmdLine,
_In_ int nShowCmd
)
{
UNREFERENCED_PARAMETER(hPrevInstance);
UNREFERENCED_PARAMETER(lpCmdLine);
CBodyBasics application;
application.Run(hInstance, nShowCmd);
}
/// <summary>
/// Constructor
/// </summary>
CBodyBasics::CBodyBasics() :
m_hWnd(NULL),
m_nStartTime(0),
m_nLastCounter(0),
m_nFramesSinceUpdate(0),
m_fFreq(0),
m_nNextStatusTime(0LL),
m_pKinectSensor(NULL),
m_pCoordinateMapper(NULL),
m_pBodyFrameReader(NULL),
m_pD2DFactory(NULL),
m_pRenderTarget(NULL),
m_pBrushJointTracked(NULL),
m_pBrushJointInferred(NULL),
m_pBrushBoneTracked(NULL),
m_pBrushBoneInferred(NULL),
m_pBrushHandClosed(NULL),
m_pBrushHandOpen(NULL),
m_pBrushHandLasso(NULL)
{
LARGE_INTEGER qpf = {0};
if (QueryPerformanceFrequency(&qpf))
{
m_fFreq = double(qpf.QuadPart);
}
}
/// <summary>
/// Destructor
/// </summary>
CBodyBasics::~CBodyBasics()
{
DiscardDirect2DResources();
// clean up Direct2D
SafeRelease(m_pD2DFactory);
// done with body frame reader
SafeRelease(m_pBodyFrameReader);
// done with coordinate mapper
SafeRelease(m_pCoordinateMapper);
// close the Kinect Sensor
if (m_pKinectSensor)
{
m_pKinectSensor->Close();
}
SafeRelease(m_pKinectSensor);
}
/// <summary>
/// Creates the main window and begins processing
/// </summary>
/// <param name="hInstance">handle to the application instance</param>
/// <param name="nCmdShow">whether to display minimized, maximized, or normally</param>
int CBodyBasics::Run(HINSTANCE hInstance, int nCmdShow)
{
MSG msg = {0};
WNDCLASS wc;
// Dialog custom window class
ZeroMemory(&wc, sizeof(wc));
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.cbWndExtra = DLGWINDOWEXTRA;
wc.hCursor = LoadCursorW(NULL, IDC_ARROW);
wc.hIcon = LoadIconW(hInstance, MAKEINTRESOURCE(IDI_APP));
wc.lpfnWndProc = DefDlgProcW;
wc.lpszClassName = L"BodyBasicsAppDlgWndClass";
if (!RegisterClassW(&wc))
{
return 0;
}
// Create main application window
HWND hWndApp = CreateDialogParamW(
NULL,
MAKEINTRESOURCE(IDD_APP),
NULL,
(DLGPROC)CBodyBasics::MessageRouter,
reinterpret_cast<LPARAM>(this));
// Show window
ShowWindow(hWndApp, nCmdShow);
// Main message loop
while (WM_QUIT != msg.message)
{
Update();
while (PeekMessageW(&msg, NULL, 0, 0, PM_REMOVE))
{
// If a dialog message will be taken care of by the dialog proc
if (hWndApp && IsDialogMessageW(hWndApp, &msg))
{
continue;
}
TranslateMessage(&msg);
DispatchMessageW(&msg);
}
}
return static_cast<int>(msg.wParam);
}
/// <summary>
/// Main processing function
/// </summary>
void CBodyBasics::Update()
{
if (!m_pBodyFrameReader)
{
return;
}
IBodyFrame* pBodyFrame = NULL;
HRESULT hr = m_pBodyFrameReader->AcquireLatestFrame(&pBodyFrame);
if (SUCCEEDED(hr))
{
INT64 nTime = 0;
hr = pBodyFrame->get_RelativeTime(&nTime);
IBody* ppBodies[BODY_COUNT] = {0};
if (SUCCEEDED(hr))
{
hr = pBodyFrame->GetAndRefreshBodyData(_countof(ppBodies), ppBodies);
}
if (SUCCEEDED(hr))
{
ProcessBody(nTime, BODY_COUNT, ppBodies);
}
for (int i = 0; i < _countof(ppBodies); ++i)
{
SafeRelease(ppBodies[i]);
}
}
SafeRelease(pBodyFrame);
}
/// <summary>
/// Handles window messages, passes most to the class instance to handle
/// </summary>
/// <param name="hWnd">window message is for</param>
/// <param name="uMsg">message</param>
/// <param name="wParam">message data</param>
/// <param name="lParam">additional message data</param>
/// <returns>result of message processing</returns>
LRESULT CALLBACK CBodyBasics::MessageRouter(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
CBodyBasics* pThis = NULL;
if (WM_INITDIALOG == uMsg)
{
pThis = reinterpret_cast<CBodyBasics*>(lParam);
SetWindowLongPtr(hWnd, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(pThis));
}
else
{
pThis = reinterpret_cast<CBodyBasics*>(::GetWindowLongPtr(hWnd, GWLP_USERDATA));
}
if (pThis)
{
return pThis->DlgProc(hWnd, uMsg, wParam, lParam);
}
return 0;
}
/// <summary>
/// Handle windows messages for the class instance
/// </summary>
/// <param name="hWnd">window message is for</param>
/// <param name="uMsg">message</param>
/// <param name="wParam">message data</param>
/// <param name="lParam">additional message data</param>
/// <returns>result of message processing</returns>
LRESULT CALLBACK CBodyBasics::DlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
UNREFERENCED_PARAMETER(wParam);
UNREFERENCED_PARAMETER(lParam);
switch (message)
{
case WM_INITDIALOG:
{
// Bind application window handle
m_hWnd = hWnd;
// Init Direct2D
D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, &m_pD2DFactory);
// Get and initialize the default Kinect sensor
InitializeDefaultSensor();
}
break;
// If the titlebar X is clicked, destroy app
case WM_CLOSE:
DestroyWindow(hWnd);
break;
case WM_DESTROY:
// Quit the main message pump
PostQuitMessage(0);
break;
}
return FALSE;
}
/// <summary>
/// Initializes the default Kinect sensor
/// </summary>
/// <returns>indicates success or failure</returns>
HRESULT CBodyBasics::InitializeDefaultSensor()
{
HRESULT hr;
hr = GetDefaultKinectSensor(&m_pKinectSensor);
if (FAILED(hr))
{
return hr;
}
if (m_pKinectSensor)
{
// Initialize the Kinect and get coordinate mapper and the body reader
IBodyFrameSource* pBodyFrameSource = NULL;
hr = m_pKinectSensor->Open();
if (SUCCEEDED(hr))
{
hr = m_pKinectSensor->get_CoordinateMapper(&m_pCoordinateMapper);
}
if (SUCCEEDED(hr))
{
hr = m_pKinectSensor->get_BodyFrameSource(&pBodyFrameSource);
}
if (SUCCEEDED(hr))
{
hr = pBodyFrameSource->OpenReader(&m_pBodyFrameReader);
}
SafeRelease(pBodyFrameSource);
}
if (!m_pKinectSensor || FAILED(hr))
{
SetStatusMessage(L"No ready Kinect found!", 10000, true);
return E_FAIL;
}
return hr;
}
/// <summary>
/// Handle new body data
/// <param name="nTime">timestamp of frame</param>
/// <param name="nBodyCount">body data count</param>
/// <param name="ppBodies">body data in frame</param>
/// </summary>
void CBodyBasics::ProcessBody(INT64 nTime, int nBodyCount, IBody** ppBodies)
{
bool sendFlg = false;
if (m_hWnd)
{
HRESULT hr = EnsureDirect2DResources();
if (SUCCEEDED(hr) && m_pRenderTarget && m_pCoordinateMapper)
{
m_pRenderTarget->BeginDraw();
m_pRenderTarget->Clear();
RECT rct;
GetClientRect(GetDlgItem(m_hWnd, IDC_VIDEOVIEW), &rct);
int width = rct.right;
int height = rct.bottom;
for (int i = 0; i < nBodyCount; ++i)
{
IBody* pBody = ppBodies[i];
if (pBody)
{
BOOLEAN bTracked = false;
hr = pBody->get_IsTracked(&bTracked);
if (SUCCEEDED(hr) && bTracked && !sendFlg)
{
Joint joints[JointType_Count];
D2D1_POINT_2F jointPoints[JointType_Count];
HandState leftHandState = HandState_Unknown;
HandState rightHandState = HandState_Unknown;
pBody->get_HandLeftState(&leftHandState);
pBody->get_HandRightState(&rightHandState);
hr = pBody->GetJoints(_countof(joints), joints);
//add for orientation
JointOrientation jointOrientations[JointType_Count];
hr &= pBody->GetJointOrientations(_countof(joints), jointOrientations);
if (SUCCEEDED(hr))
{
//for distance limitation
if ( joints[0].Position.Z * joints[0].Position.Z + joints[0].Position.X * joints[0].Position.X > 9 ){
continue;
}
sendFlg = true;
//add for zmq
PublishJointMassages(joints, jointOrientations);
for (int j = 0; j < _countof(joints); ++j)
{
jointPoints[j] = BodyToScreen(joints[j].Position, width, height);
}
DrawBody(joints, jointPoints);
DrawHand(leftHandState, jointPoints[JointType_HandLeft]);
DrawHand(rightHandState, jointPoints[JointType_HandRight]);
}
}
}
}
hr = m_pRenderTarget->EndDraw();
// Device lost, need to recreate the render target
// We'll dispose it now and retry drawing
if (D2DERR_RECREATE_TARGET == hr)
{
hr = S_OK;
DiscardDirect2DResources();
}
}
if (!m_nStartTime)
{
m_nStartTime = nTime;
}
double fps = 0.0;
LARGE_INTEGER qpcNow = {0};
if (m_fFreq)
{
if (QueryPerformanceCounter(&qpcNow))
{
if (m_nLastCounter)
{
m_nFramesSinceUpdate++;
fps = m_fFreq * m_nFramesSinceUpdate / double(qpcNow.QuadPart - m_nLastCounter);
}
}
}
WCHAR szStatusMessage[64];
StringCchPrintf(szStatusMessage, _countof(szStatusMessage), L" FPS = %0.2f Time = %I64d", fps, (nTime - m_nStartTime));
if (SetStatusMessage(szStatusMessage, 1000, false))
{
m_nLastCounter = qpcNow.QuadPart;
m_nFramesSinceUpdate = 0;
}
}
}
/// <summary>
/// Set the status bar message
/// </summary>
/// <param name="szMessage">message to display</param>
/// <param name="showTimeMsec">time in milliseconds to ignore future status messages</param>
/// <param name="bForce">force status update</param>
bool CBodyBasics::SetStatusMessage(_In_z_ WCHAR* szMessage, DWORD nShowTimeMsec, bool bForce)
{
INT64 now = GetTickCount64();
if (m_hWnd && (bForce || (m_nNextStatusTime <= now)))
{
SetDlgItemText(m_hWnd, IDC_STATUS, szMessage);
m_nNextStatusTime = now + nShowTimeMsec;
return true;
}
return false;
}
/// <summary>
/// Ensure necessary Direct2d resources are created
/// </summary>
/// <returns>S_OK if successful, otherwise an error code</returns>
HRESULT CBodyBasics::EnsureDirect2DResources()
{
HRESULT hr = S_OK;
if (m_pD2DFactory && !m_pRenderTarget)
{
RECT rc;
GetWindowRect(GetDlgItem(m_hWnd, IDC_VIDEOVIEW), &rc);
int width = rc.right - rc.left;
int height = rc.bottom - rc.top;
D2D1_SIZE_U size = D2D1::SizeU(width, height);
D2D1_RENDER_TARGET_PROPERTIES rtProps = D2D1::RenderTargetProperties();
rtProps.pixelFormat = D2D1::PixelFormat(DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_IGNORE);
rtProps.usage = D2D1_RENDER_TARGET_USAGE_GDI_COMPATIBLE;
// Create a Hwnd render target, in order to render to the window set in initialize
hr = m_pD2DFactory->CreateHwndRenderTarget(
rtProps,
D2D1::HwndRenderTargetProperties(GetDlgItem(m_hWnd, IDC_VIDEOVIEW), size),
&m_pRenderTarget
);
if (FAILED(hr))
{
SetStatusMessage(L"Couldn't create Direct2D render target!", 10000, true);
return hr;
}
// light green
m_pRenderTarget->CreateSolidColorBrush(D2D1::ColorF(0.27f, 0.75f, 0.27f), &m_pBrushJointTracked);
m_pRenderTarget->CreateSolidColorBrush(D2D1::ColorF(D2D1::ColorF::Yellow, 1.0f), &m_pBrushJointInferred);
m_pRenderTarget->CreateSolidColorBrush(D2D1::ColorF(D2D1::ColorF::Green, 1.0f), &m_pBrushBoneTracked);
m_pRenderTarget->CreateSolidColorBrush(D2D1::ColorF(D2D1::ColorF::Gray, 1.0f), &m_pBrushBoneInferred);
m_pRenderTarget->CreateSolidColorBrush(D2D1::ColorF(D2D1::ColorF::Red, 0.5f), &m_pBrushHandClosed);
m_pRenderTarget->CreateSolidColorBrush(D2D1::ColorF(D2D1::ColorF::Green, 0.5f), &m_pBrushHandOpen);
m_pRenderTarget->CreateSolidColorBrush(D2D1::ColorF(D2D1::ColorF::Blue, 0.5f), &m_pBrushHandLasso);
}
return hr;
}
/// <summary>
/// Dispose Direct2d resources
/// </summary>
void CBodyBasics::DiscardDirect2DResources()
{
SafeRelease(m_pRenderTarget);
SafeRelease(m_pBrushJointTracked);
SafeRelease(m_pBrushJointInferred);
SafeRelease(m_pBrushBoneTracked);
SafeRelease(m_pBrushBoneInferred);
SafeRelease(m_pBrushHandClosed);
SafeRelease(m_pBrushHandOpen);
SafeRelease(m_pBrushHandLasso);
}
/// <summary>
/// Converts a body point to screen space
/// </summary>
/// <param name="bodyPoint">body point to tranform</param>
/// <param name="width">width (in pixels) of output buffer</param>
/// <param name="height">height (in pixels) of output buffer</param>
/// <returns>point in screen-space</returns>
D2D1_POINT_2F CBodyBasics::BodyToScreen(const CameraSpacePoint& bodyPoint, int width, int height)
{
// Calculate the body's position on the screen
DepthSpacePoint depthPoint = {0};
m_pCoordinateMapper->MapCameraPointToDepthSpace(bodyPoint, &depthPoint);
float screenPointX = static_cast<float>(depthPoint.X * width) / cDepthWidth;
float screenPointY = static_cast<float>(depthPoint.Y * height) / cDepthHeight;
return D2D1::Point2F(screenPointX, screenPointY);
}
/// <summary>
/// Draws a body
/// </summary>
/// <param name="pJoints">joint data</param>
/// <param name="pJointPoints">joint positions converted to screen space</param>
void CBodyBasics::DrawBody(const Joint* pJoints, const D2D1_POINT_2F* pJointPoints)
{
// Draw the bones
// Torso
DrawBone(pJoints, pJointPoints, JointType_Head, JointType_Neck);
DrawBone(pJoints, pJointPoints, JointType_Neck, JointType_SpineShoulder);
DrawBone(pJoints, pJointPoints, JointType_SpineShoulder, JointType_SpineMid);
DrawBone(pJoints, pJointPoints, JointType_SpineMid, JointType_SpineBase);
DrawBone(pJoints, pJointPoints, JointType_SpineShoulder, JointType_ShoulderRight);
DrawBone(pJoints, pJointPoints, JointType_SpineShoulder, JointType_ShoulderLeft);
DrawBone(pJoints, pJointPoints, JointType_SpineBase, JointType_HipRight);
DrawBone(pJoints, pJointPoints, JointType_SpineBase, JointType_HipLeft);
// Right Arm
DrawBone(pJoints, pJointPoints, JointType_ShoulderRight, JointType_ElbowRight);
DrawBone(pJoints, pJointPoints, JointType_ElbowRight, JointType_WristRight);
DrawBone(pJoints, pJointPoints, JointType_WristRight, JointType_HandRight);
DrawBone(pJoints, pJointPoints, JointType_HandRight, JointType_HandTipRight);
DrawBone(pJoints, pJointPoints, JointType_WristRight, JointType_ThumbRight);
// Left Arm
DrawBone(pJoints, pJointPoints, JointType_ShoulderLeft, JointType_ElbowLeft);
DrawBone(pJoints, pJointPoints, JointType_ElbowLeft, JointType_WristLeft);
DrawBone(pJoints, pJointPoints, JointType_WristLeft, JointType_HandLeft);
DrawBone(pJoints, pJointPoints, JointType_HandLeft, JointType_HandTipLeft);
DrawBone(pJoints, pJointPoints, JointType_WristLeft, JointType_ThumbLeft);
// Right Leg
DrawBone(pJoints, pJointPoints, JointType_HipRight, JointType_KneeRight);
DrawBone(pJoints, pJointPoints, JointType_KneeRight, JointType_AnkleRight);
DrawBone(pJoints, pJointPoints, JointType_AnkleRight, JointType_FootRight);
// Left Leg
DrawBone(pJoints, pJointPoints, JointType_HipLeft, JointType_KneeLeft);
DrawBone(pJoints, pJointPoints, JointType_KneeLeft, JointType_AnkleLeft);
DrawBone(pJoints, pJointPoints, JointType_AnkleLeft, JointType_FootLeft);
// Draw the joints
for (int i = 0; i < JointType_Count; ++i)
{
D2D1_ELLIPSE ellipse = D2D1::Ellipse(pJointPoints[i], c_JointThickness, c_JointThickness);
if (pJoints[i].TrackingState == TrackingState_Inferred)
{
m_pRenderTarget->FillEllipse(ellipse, m_pBrushJointInferred);
}
else if (pJoints[i].TrackingState == TrackingState_Tracked)
{
m_pRenderTarget->FillEllipse(ellipse, m_pBrushJointTracked);
}
}
}
/// <summary>
/// Draws one bone of a body (joint to joint)
/// </summary>
/// <param name="pJoints">joint data</param>
/// <param name="pJointPoints">joint positions converted to screen space</param>
/// <param name="pJointPoints">joint positions converted to screen space</param>
/// <param name="joint0">one joint of the bone to draw</param>
/// <param name="joint1">other joint of the bone to draw</param>
void CBodyBasics::DrawBone(const Joint* pJoints, const D2D1_POINT_2F* pJointPoints, JointType joint0, JointType joint1)
{
TrackingState joint0State = pJoints[joint0].TrackingState;
TrackingState joint1State = pJoints[joint1].TrackingState;
// If we can't find either of these joints, exit
if ((joint0State == TrackingState_NotTracked) || (joint1State == TrackingState_NotTracked))
{
return;
}
// Don't draw if both points are inferred
if ((joint0State == TrackingState_Inferred) && (joint1State == TrackingState_Inferred))
{
return;
}
// We assume all drawn bones are inferred unless BOTH joints are tracked
if ((joint0State == TrackingState_Tracked) && (joint1State == TrackingState_Tracked))
{
m_pRenderTarget->DrawLine(pJointPoints[joint0], pJointPoints[joint1], m_pBrushBoneTracked, c_TrackedBoneThickness);
}
else
{
m_pRenderTarget->DrawLine(pJointPoints[joint0], pJointPoints[joint1], m_pBrushBoneInferred, c_InferredBoneThickness);
}
}
/// <summary>
/// Draws a hand symbol if the hand is tracked: red circle = closed, green circle = opened; blue circle = lasso
/// </summary>
/// <param name="handState">state of the hand</param>
/// <param name="handPosition">position of the hand</param>
void CBodyBasics::DrawHand(HandState handState, const D2D1_POINT_2F& handPosition)
{
D2D1_ELLIPSE ellipse = D2D1::Ellipse(handPosition, c_HandSize, c_HandSize);
switch (handState)
{
case HandState_Closed:
m_pRenderTarget->FillEllipse(ellipse, m_pBrushHandClosed);
break;
case HandState_Open:
m_pRenderTarget->FillEllipse(ellipse, m_pBrushHandOpen);
break;
case HandState_Lasso:
m_pRenderTarget->FillEllipse(ellipse, m_pBrushHandLasso);
break;
}
}