forked from hanzelpeter/dispmanx_vnc
-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathDMXResource.cpp
More file actions
33 lines (27 loc) · 747 Bytes
/
DMXResource.cpp
File metadata and controls
33 lines (27 loc) · 747 Bytes
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
#include "DMXResource.hpp"
#include "Exception.hpp"
DMXResource::~DMXResource()
{
Close();
};
void DMXResource::Create(VC_IMAGE_TYPE_T type, int width, int height, uint32_t *vc_image_ptr)
{
m_resource = vc_dispmanx_resource_create(type, width, height, vc_image_ptr);
if (m_resource == DISPMANX_NO_HANDLE)
throw Exception("vc_dispmanx_resource_create failed");
}
void DMXResource::Close()
{
if (m_resource != DISPMANX_NO_HANDLE) {
vc_dispmanx_resource_delete(m_resource);
m_resource = DISPMANX_NO_HANDLE;
}
}
void DMXResource::ReadData(VC_RECT_T& rect, void *image, int pitch)
{
vc_dispmanx_resource_read_data(m_resource, &rect, image, pitch);
}
DISPMANX_RESOURCE_HANDLE_T DMXResource::GetResourceHandle()
{
return m_resource;
}