-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFostroFilter.cpp
More file actions
43 lines (34 loc) · 997 Bytes
/
FostroFilter.cpp
File metadata and controls
43 lines (34 loc) · 997 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
41
42
43
#include "FostroImage.h"
#include "FostroMask.h"
#include "FostroPixel.h"
#include "FostroFilter.h"
FostroFilter::FostroFilter(int width, int height) {
mask = new FostroMask(width, height);
}
FostroFilter::FostroFilter(const FostroFilter& other) {
mask = new FostroMask(*other.mask);
}
FostroFilter& FostroFilter::operator=(const FostroFilter& other) {
delete mask;
mask = new FostroMask(*other.mask);
return *this;
}
FostroFilter::~FostroFilter() {
delete mask;
}
FostroImage* FostroFilter::applyFilter(FostroImage* image, int c) {
std::cout << "This function should never be called, something went wrong in applyFilter." << std::endl;
return NULL;
}
void FostroFilter::setAllMaskValsSame(float val) {
mask->setAllMaskVals(val);
}
void FostroFilter::setAllMaskVals(float* vals) {
int mWidth = mask->getWidth();
int mHeight = mask->getHeight();
for (int i = 0; i < mHeight; i++) {
for (int j = 0; j < mWidth; j++) {
mask->setMaskVal(i, j, vals[i*mWidth+j]);
}
}
}