2 * psychlops_figure_standard.h
3 * Psychlops Standard Library (Universal)
5 * Last Modified 2005/10/05 by Kenchi HOSOKAWA
6 * (C) 2005 Kenchi HOSOKAWA, Kazushi MARUYA, Takao SATO
9 #ifndef HEADER_PSYCHLOPS_FIGURE_STANDARD
10 #define HEADER_PSYCHLOPS_FIGURE_STANDARD
12 #include "../../../core/graphic/psychlops_g_fundamental.h"
13 #include "../../../psychlops_core.h"
14 #include "../../../core/ApplicationInterfaces/psychlops_app_thread.h"
22 class Arrow : virtual public Line
25 static Polygon default_head;
26 void createDefaultHead();
27 void setDefaultHead();
33 Arrow(const double x1, const double y1, const double x2, const double y2);
34 Arrow(const Point &dbegin, const Point &dend);
35 Arrow& set(const double x1, const double y1, const double x2, const double y2);
36 Arrow& set(const Point &dbegin, const Point &dend);
37 virtual Arrow& draw(Drawable &target = *Drawable::prime);
38 virtual Arrow& draw(const Color &col, Drawable &target = *Drawable::prime);
39 virtual Arrow& draw(const Stroke &strk, Drawable &target = *Drawable::prime);
43 class Cross : virtual public Shape, virtual public FigureDatum
46 //using FigureDatum::datum; using FigureDatum::shift;
47 //using Shape::centering;
52 Cross(const Rectangle& rect, Stroke dstrk = Stroke::hair_line);
53 Cross(double wid, double hei, Stroke dstrk = Stroke::hair_line);
55 Cross& set(const Rectangle& rect, Stroke dstrk = Stroke::hair_line);
56 Cross& set(double wid, double hei, Stroke dstrk = Stroke::hair_line);
57 virtual Cross& centering();
58 virtual Cross& centering(const Point &p);
59 virtual Cross& draw(Drawable &target = *Drawable::prime);
60 virtual Cross& draw(const Color &col, Drawable &target = *Drawable::prime);
61 virtual Cross& draw(const Stroke &strk, Drawable &target = *Drawable::prime);
65 class MovieSequence : public FigureDatum
\r
67 virtual MovieSequence& nextFrame() = 0;
\r
68 virtual MovieSequence& draw(Drawable& target = *Drawable::prime) = 0;
\r
71 class Movie : public MovieSequence
74 int current_frame_index;
75 std::deque<Image*> frames;
78 enum FOURCC { AUTO, DIB, HFYU, PIM1, MP4V, MJPG, DIVX, XVID };
79 //static std::string bin_path;
80 Rectangle source_area;
86 Movie &set(Image* frames, int frame_num);
87 Movie &reserveFrames(int frame_num);
88 int getCurrentIndex();
89 int setCurrentIndex(int new_current);
90 Image& operator[](int frame_num);
92 virtual Movie& nextFrame();
93 virtual Movie& draw(Drawable& target = *Drawable::prime);
95 virtual Movie& captureThisFrame();
96 virtual Movie& captureThisFrame(const Rectangle &source_area_);
97 virtual Movie& captureThisFrame(int target_frame);
98 virtual Movie& captureThisFrame(const Rectangle &source_area_, int target_frame);
99 virtual Movie& save(std::string filename, const double fps = -1, const FOURCC codec = AUTO);
100 virtual Movie& saveFramesAsImages(std::string filename);
104 class ProgressBar : public FigureDatum
107 Rectangle frame_, bar_;
111 Color fgcolor, bgcolor;
112 ProgressBar(const Rectangle &rect);
113 ProgressBar(const double width, const double height);
114 virtual ~ProgressBar();
115 ProgressBar & set(Rectangle rect);
116 ProgressBar & set(const double width, const double height);
117 virtual ProgressBar & draw(Drawable& target = *Drawable::prime);
118 virtual ProgressBar & draw(const double x, const double y, const double z = 0, Drawable& target = *Drawable::prime) const;
120 ProgressBar & operator()(double ratio);
121 ProgressBar & operator()(double now, double max);
127 } /* <- namespace Figure */
128 } /* <- namespace Psycholops */