summaryrefslogtreecommitdiff
path: root/NT/src/nodes_source.h
diff options
context:
space:
mode:
Diffstat (limited to 'NT/src/nodes_source.h')
-rw-r--r--NT/src/nodes_source.h31
1 files changed, 17 insertions, 14 deletions
diff --git a/NT/src/nodes_source.h b/NT/src/nodes_source.h
index ede0dcb..ffc826f 100644
--- a/NT/src/nodes_source.h
+++ b/NT/src/nodes_source.h
@@ -10,45 +10,48 @@ namespace Rotor {
//1 - a data type which is a variable length array of data [as opposed to a array of inlets]
//2 - a way to initialise this from json
//enum - this is a hack to achieve this? designed for option selectors, can it work here?
- //or just parse a string into a list of colours?
+
+ //for now: just parse a string into a list of colours
+
Signal_colour(){
selector=create_inlet<double>("selector");
- palette=create_inlet<string>("palette","colour to choose from palette","Palette","000000")
+ palette=create_inlet<string>("palette","colour to choose from palette","Palette","000000");
//create_attribute("palette","palette list of web colours","Colour palette","000000");
+ type="signal_colour";
title="Signal colour";
description="Cycles through a palette of background colours according to selector signal";
- NODEID="a2183fe0-2d09-11e3-9a64-538ee2cf40bc";
+ type_id="a2183fe0-2d09-11e3-9a64-538ee2cf40bc";
};
- Signal_colour(map<string,string> &settings):Signal_colour() {
- base_settings(settings);
- for (uint32_t i=0;i<attributes["palette"]->value.size()/6;i++){
- palette.push_back(Colour(attributes["palette"]->value.substr(i*6,6)));
+ Signal_colour(Json::Value &settings):Signal_colour() {
+ init(settings);
+ for (uint32_t i=0;i<palette.get().size()/6;i++){
+ colours.push_back(Colour(attributes["palette"]->value.substr(i*6,6)));
}
prevcol=-1;
};
~Signal_colour(){};
- Image *output(const Frame_spec &frame){
+ const Image &output(const Frame_parameters &frame){
if (palette.size()) {
int col=((int)inputs[0]->get((Time_spec)frame))%palette.size();
//if (col!=prevcol) cerr<<"colour now "<<palette[col].r<<","<<palette[col].g<<","<<palette[col].b<<endl;
//if (col!=prevcol){ //how about when starting a new render?
for (int i=0;i<image.w*image.h;i++){
- image.RGBdata[i*3]=palette[col].r;
- image.RGBdata[i*3+1]=palette[col].g;
- image.RGBdata[i*3+2]=palette[col].b;
+ image.RGBdata[i*3]=colours[col].r;
+ image.RGBdata[i*3+1]=colours[col].g;
+ image.RGBdata[i*3+2]=colours[col].b;
}
prevcol=col;
//}
- return &image;
+ return image;
}
return nullptr;
}
Signal_colour* clone(map<string,string> &_settings) { return new Signal_colour(_settings);};
private:
- vector<Colour> palette;
+ vector<Colour> colours;
int prevcol;
Number_inlet *selector;
- Enum_inlet *palette;
+ String_inlet *palette;
};
/*
class Signal_greyscale: public Image_node {