summaryrefslogtreecommitdiff
path: root/liveengine/src/layers.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'liveengine/src/layers.cpp')
-rwxr-xr-xliveengine/src/layers.cpp25
1 files changed, 15 insertions, 10 deletions
diff --git a/liveengine/src/layers.cpp b/liveengine/src/layers.cpp
index e69023b..6724255 100755
--- a/liveengine/src/layers.cpp
+++ b/liveengine/src/layers.cpp
@@ -11,11 +11,11 @@ svglayer::svglayer(string _f)
void svglayer::load(string _f){
//check if files exits
svg.load(_f);
- printf("%i paths\n",svg.getNumPath());
+ printf("%s: %i paths\n",_f.c_str(),svg.getNumPath());
for (int i=0;i<svg.getNumPath();i++) {
fills.push_back(svg.getPathAt(i).getFillColor());
strokes.push_back(svg.getPathAt(i).getStrokeColor());
- printf(" path %i: fill %08x stroke %08x\n",i,svg.getPathAt(i).getFillColor().getHex(),svg.getPathAt(i).getStrokeColor().getHex());
+ //printf(" path %i: fill %08x stroke %08x\n",i,svg.getPathAt(i).getFillColor().getHex(),svg.getPathAt(i).getStrokeColor().getHex());
}
isLoaded= (svg.getNumPath()>0);
}
@@ -26,19 +26,24 @@ void svglayer::getCentre(int cx,int cy) {
}
}
-void svglayer::draw(float a,int cx,int cy) {
+void svglayer::draw(float a,int cx,int cy,float colShift) {
getCentre(cx,cy);
- for (int i=0;i<svg.getNumPath();i++) {
- svg.getPathAt(i).setFillColor(fills[i]*a);
+ for (int i=0;i<svg.getNumPath();i++) {
+ ofColor c=fills[i]*a;
+ if (colShift>0.0f) {
+ c.setHue(fmod(c.getHue()+colShift,255.0f));
+ //printf ("shift from %f to %f\n",c.getHue(),c.getHue()+colShift);
+ }
+ svg.getPathAt(i).setFillColor(c);
svg.getPathAt(i).draw(xo,yo);
}
}
-void svglayer::draw(float a,unsigned char* controllers,int cx,int cy,bool transparentBlack) {
+void svglayer::draw(float a,unsigned char* controllers,int cx,int cy,bool transparentBlack,float colShift) {
getCentre(cx,cy);
//draw layers tinted by controllers
for (int i=0;i<svg.getNumPath();i++) {
- float h=fills[i].getHue();
+ float h=fmod(fills[i].getHue()+colShift,255.0f);
float ha=h/42.7; //0-5
int h1=(((int)ha)+2)%6;
int h2=h1+1;
@@ -77,14 +82,14 @@ WTF is going on with the image drawing
*/
-void imglayer::draw(float a,int cx,int cy) {
+void imglayer::draw(float a,int cx,int cy,float colShift) {
//if (img.isAllocated()) if (!img.isUsingTexture()) img.setUseTexture(true); //has to be done from the main thread? still doesn't work
img.draw(0,0,ofGetWidth(),ofGetHeight());
printf("drawing %f\n",ofGetElapsedTimef());
}
-void imglayer::draw(float a,unsigned char* controllers,int cx,int cy,bool transparentBlack=false) {
- imglayer::draw(a,cx,cy);
+void imglayer::draw(float a,unsigned char* controllers,int cx,int cy,bool transparentBlack=false,float colShift=0.0f) {
+ imglayer::draw(a,cx,cy,colShift);
}