-
Notifications
You must be signed in to change notification settings - Fork 0
/
ColorImageDrawer.cs
39 lines (34 loc) · 1011 Bytes
/
ColorImageDrawer.cs
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
using System.Windows;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using Xtr3D.Net;
namespace CSharpVisualSkeletonSample
{
class ColorImageDrawer
{
ImageInfo m_imageInfo;
private WriteableBitmap m_bmp;
private Int32Rect m_rect;
public ImageSource ImageSource
{
get
{
return m_bmp;
}
}
internal ColorImageDrawer(ImageInfo imageInfo)
{
m_imageInfo = imageInfo;
m_bmp = new WriteableBitmap(m_imageInfo.Width, m_imageInfo.Height, 96, 96, PixelFormats.Rgb24, null);
m_rect = new Int32Rect(0, 0, m_imageInfo.Width, m_imageInfo.Height);
}
internal void DrawColorImage(byte[] image)
{
m_bmp.WritePixels(m_rect,
image,
m_imageInfo.Width *
(m_imageInfo.BitsPerPixel / 8),
0);
}
}
}