-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathdrawable.cpp
More file actions
40 lines (32 loc) · 1019 Bytes
/
drawable.cpp
File metadata and controls
40 lines (32 loc) · 1019 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
33
34
35
36
37
38
39
40
/*
* File: drawable.cpp
* Author: fishi
*
* Created on Štvrtok, 2011, marec 17, 16:05
*/
#include "include/drawable.hpp"
namespace iwb {
Drawable::Drawable(const char* imagePath, Presentation *prs, CvPoint projectorUL, CvPoint projectorBR) {
image = cvLoadImage(imagePath, CV_LOAD_IMAGE_UNCHANGED);
this->projectorUL = projectorUL;
this->projectorBR = projectorBR;
this->prs = prs;
prs->addComponent(this);
}
Drawable::~Drawable() {
cvReleaseImage(&image);
}
int Drawable::getProjectorWidth() {
return projectorBR.x - projectorUL.x;
}
int Drawable::getProjectorHeight() {
return projectorBR.y - projectorUL.y;
}
void Drawable::setImagePath(const char* imagePath) {
cvReleaseImage(&image);
image = cvLoadImage(imagePath, CV_LOAD_IMAGE_UNCHANGED);
}
void Drawable::draw(Presentation* prs) {
prs->putImage(projectorUL, projectorBR, NULL, NULL, image);
}
}