#pragma once #include "ofMain.h" #include "ofxJSON.h" #define THUMB_BORDER_RATIO 0.8 #define THUMB_SIZE 160 #define DEFAULT_FADEIN 1.0 #define BEZIER_OUT 0.2 #define BEZIER_IN 0.5 class chainImage : public ofImage{ //todo: threaded image loader public: chainImage(){ link=NULL; ofImage(); } void init(ofPoint _linkPos,float _linkScale,float _linkRot); void start(); bool load(std::string _filename){ filename=_filename; if (ofImage::load(filename)){ makeThumbnail(); //could there be a way to load without committing the texture //setUseTexture(false); setAnchorPoint(getWidth()/2,getHeight()/2); return true; } return false; } bool update(float decayRatio); ofVec3f getTransform(); float getScale(); float getRotation(); void drawChain(float fadeIn=DEFAULT_FADEIN); ofImage thumbnail; void makeThumbnail(); Json::Value toJson(); bool fromJson(Json::Value json); chainImage *link; ofPoint linkPos; float linkScale; float linkRot; std::string filename; float transition; float fadeIn; float speed; float time; float scale; ofPolyline path; //int totalframes,framecount; }; class chainImageSet{ public: chainImageSet(){ currentDefaultImageRatio=0.3; filename=""; outputSize=ofPoint(1024,576); decayFactor=.999; } void drawGui(); void drawOutput(); void update(); bool add(std::string filename,glm::vec2 pos); void keyPressed(ofKeyEventArgs &keyargs); void mouseDragged(int x, int y, int button); void mousePressed(int x, int y, int button); void mouseReleased(int x, int y, int button); bool saveJson(std::string filename); bool loadJson(std::string filename); ofPoint outputSize; std::list images; float currentDefaultImageRatio; std::list::iterator selected; ofPoint clickPoint; ofPoint dragPoint; float dragScale; float dragRotate; std::string filename; chainImage *currentImage; float decayFactor; };