#include "layers.h" svglayer::svglayer() { xo=0;yo=0; } svglayer::svglayer(string _f) { load(_f); } void svglayer::load(string _f){ //check if files exits svg.load(_f); printf("%s: %i paths\n",_f.c_str(),svg.getNumPath()); for (int i=0;i0); } void svglayer::getCentre(int cx,int cy) { if (svg.getNumPath()>0) { xo=(cx-svg.getWidth())/2; yo=(cy-svg.getHeight())/2; } } void svglayer::draw(float a,int cx,int cy,float colShift) { getCentre(cx,cy); for (int i=0;i0.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,float colShift) { getCentre(cx,cy); //draw layers tinted by controllers for (int i=0;i0.1) { svg.getPathAt(i).draw(xo,yo); } } } svglayer::~svglayer() { //dtor } imglayer::imglayer() { //img.setUseTexture(false); } imglayer::imglayer(string _f) { load(_f); } void imglayer::load(string _f){ bool success=img.loadImage(_f); printf("%s\n",success?"loaded":"not loaded"); } /* WTF is going on with the image drawing */ 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,float colShift=0.0f) { imglayer::draw(a,cx,cy,colShift); } imglayer::~imglayer() { //img.setUseTexture(false); //free texture }