1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
#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
#define SWITCH_NONE 0
#define SWITCH_FORWARD 1
#define SWITCH_REVERSE 2
class chainImage : public ofImage{
//todo: threaded image loader
public:
chainImage(){
link=NULL;
ofImage();
}
void init(ofPoint _linkPos,float _linkScale,float _linkRot);
void start(bool reverse);
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;
}
int update(float decayRatio);
ofVec3f getTransform();
float getScale();
float getRotation();
void drawChain(float fadeIn=DEFAULT_FADEIN,bool additive =false, float intensity=1.0f);
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;
additive=false;
intensity=1.0f;
fitFactor=0.9f;
dragScale=0.0f;
dragRotate=0.0f;
dragPoint=ofPoint(0,0);
}
void drawGui(int x,int y,bool is_selected);
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 <chainImage> images;
float currentDefaultImageRatio;
std::list<chainImage>::iterator selected;
ofPoint clickPoint;
ofPoint dragPoint;
float dragScale;
float dragRotate;
float fitFactor;
std::string filename;
chainImage *currentImage;
float decayFactor;
bool additive;
float intensity;
};
|