-
Notifications
You must be signed in to change notification settings - Fork 0
/
background_device.cpp
51 lines (38 loc) · 1.3 KB
/
background_device.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
#include "device.h"
BackgroundDevice::BackgroundDevice(void) {}
BackgroundDevice::~BackgroundDevice(void) {}
Rgb BackgroundDevice::color = Rgb(0, 0, 0);
Device *BackgroundDevice::create(void) {
return new BackgroundDevice();
}
std::string BackgroundDevice::name(void) {
return "Background";
}
bool BackgroundDevice::parse(AspngSurface *surface, Coord coord) {
this->patch = this->flood(surface, coord, BackgroundDevice::color);
return this->patch.size() >= 1;
}
std::list<Patch *> BackgroundDevice::all_patches(void) {
std::list<Patch *> all_patches;
all_patches.push_back(&(this->patch));
return all_patches;
}
std::tuple<LinkResult, PortType, std::string> BackgroundDevice::prelink(Patch *, std::shared_ptr<Device>) {
return std::make_tuple(CanTouch, NoSpecialMeaning, "");
}
bool BackgroundDevice::link(void) {
return true;
}
std::list<std::shared_ptr<Port>> BackgroundDevice::propagate(std::shared_ptr<Port>) {
std::list<std::shared_ptr<Port>> empty;
return empty;
}
ElectricalValue BackgroundDevice::get_value_at_port(std::shared_ptr<Port>) {
return EmptyElectricalValue;
}
void BackgroundDevice::apply_new_value(std::shared_ptr<Port>, ElectricalValue) {
// Deliberately empty.
}
Rgb BackgroundDevice::get_draw_color(Patch *) {
return BackgroundDevice::color;
}