diff options
| author | Tim Redfern <tim@eclectronics.org> | 2012-09-14 19:24:39 +0100 |
|---|---|---|
| committer | Tim Redfern <tim@eclectronics.org> | 2012-09-14 19:24:39 +0100 |
| commit | 4fda3af17e55c0afff35b3f3ebbe5b4fd1ffad7e (patch) | |
| tree | ca47926461a8c7176c3542ff7734ec74833abdba /liveengine/src/layers.cpp | |
| parent | 639dfe9190c06bba4dced32f282ad1fddc573b59 (diff) | |
working nicely multiscreen
Diffstat (limited to 'liveengine/src/layers.cpp')
| -rwxr-xr-x[-rw-r--r--] | liveengine/src/layers.cpp | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/liveengine/src/layers.cpp b/liveengine/src/layers.cpp index 6ab91ca..ad251ea 100644..100755 --- a/liveengine/src/layers.cpp +++ b/liveengine/src/layers.cpp @@ -17,33 +17,42 @@ void svglayer::load(string _f){ 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());
} - if (svg.getNumPath()>0) { - xo=(ofGetWidth()-svg.getWidth())/2; - yo=(ofGetHeight()-svg.getHeight())/2; - } isLoaded= (svg.getNumPath()>0);
}
+void svglayer::getCentre() {
+ if (svg.getNumPath()>0) {
+ xo=(ofGetWidth()-svg.getWidth())/2;
+ yo=(ofGetHeight()-svg.getHeight())/2;
+ }
+}
void svglayer::draw(float a) {
- //svg.draw(); + getCentre(); for (int i=0;i<svg.getNumPath();i++) { svg.getPathAt(i).setFillColor(fills[i]*a); svg.getPathAt(i).draw(xo,yo); }
} -void svglayer::draw(float a,unsigned char* controllers) { - //draw layers tinted by controllers
- for (int i=0;i<svg.getNumPath();i++) { + +void svglayer::draw(float a,unsigned char* controllers,bool transparentBlack) {
+ getCentre(); + //draw layers tinted by controllers
+ for (int i=0;i<svg.getNumPath();i++) { float h=fills[i].getHue(); float ha=h/42.7; //0-5 - int h1=(int)ha; + int h1=(((int)ha)+2)%6; int h2=h1+1; float f2=ha-h1; float f1=1.0f-f2; + //if (transparentBlack) printf("transparent black draw %f\n",(a*(((controllers[h1]*f1)+(controllers[h2]*f2))/127.0))); + svg.getPathAt(i).setFillColor(fills[i]*a*(((controllers[h1]*f1)+(controllers[h2]*f2))/127.0));; - svg.getPathAt(i).draw(xo,yo); + if (!transparentBlack||(a*(((controllers[h1]*f1)+(controllers[h2]*f2))/127.0))>0.1) { + svg.getPathAt(i).draw(xo,yo); + } }
-}
+} +
svglayer::~svglayer()
{
|
