diff options
| author | Tim Redfern <tim@eclectronics.org> | 2012-09-21 17:02:21 +0100 |
|---|---|---|
| committer | Tim Redfern <tim@eclectronics.org> | 2012-09-21 17:02:21 +0100 |
| commit | d1a44d34955133815d2c322b600a79cceecf5a95 (patch) | |
| tree | 8f952884350d4fccc5143f8e53718277e4c1ceeb /liveengine/src/layers.cpp | |
| parent | 530bf6501e6f13ed3e91d4d0e2763613146774a2 (diff) | |
beginning gui
Diffstat (limited to 'liveengine/src/layers.cpp')
| -rwxr-xr-x | liveengine/src/layers.cpp | 25 |
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);
} |
