renddesc.h

Go to the documentation of this file.
00001 /* === S Y N F I G ========================================================= */
00021 /* ========================================================================= */
00022 
00023 /* === S T A R T =========================================================== */
00024 
00025 #ifndef __SYNFIG_RENDERDESC_H
00026 #define __SYNFIG_RENDERDESC_H
00027 
00028 /* === H E A D E R S ======================================================= */
00029 
00030 #include "vector.h"
00031 #include "color.h"
00032 #include "types.h"
00033 #include <cmath>
00034 #include "rect.h"
00035 
00036 /* === M A C R O S ========================================================= */
00037 
00038 #ifndef DPM2DPI
00039 #define DPM2DPI(x)  (float(x)/39.3700787402f)
00040 #define DPI2DPM(x)  (float(x)*39.3700787402f)
00041 #endif
00042 
00043 /* === T Y P E D E F S ===================================================== */
00044 
00045 /* === C L A S S E S & S T R U C T S ======================================= */
00046 
00047 namespace synfig {
00048 
00052 class RendDesc
00053 {
00054 public:
00055     enum Lock
00056     {
00057         PX_ASPECT=(1<<0),
00058         PX_AREA=(1<<1),
00059         PX_W=(1<<2),
00060         PX_H=(1<<3),
00061 
00062         IM_ASPECT=(1<<4),
00063         IM_SPAN=(1<<5),
00064         IM_W=(1<<6),
00065         IM_H=(1<<7),
00066         IM_ZOOMIN=(1<<8),
00067         IM_ZOOMOUT=(1<<9),
00068 
00069         LINK_PX_ASPECT=(1<<10),
00070         LINK_PX_AREA=(1<<11),
00071         LINK_IM_ASPECT=(1<<12),
00072         LINK_IM_SPAN=(1<<13),
00073         LINK_IM_CENTER=(1<<14)
00074     };
00075 
00076 private:
00077     int w_,h_;
00078     Real x_res;
00079     Real y_res;
00080     Point tl_, br_;
00081     Point focus;
00082     int a;
00083     //Gamma gamma;
00084     Color background;
00085     int flags;
00086     bool interlaced;
00087     bool clamp;
00088 
00089     float frame_rate;
00090     Time time_begin, time_end;
00091 
00092 public:
00093 
00094     enum
00095     {
00096         ANTIALIAS_UNIFORM,
00097         ANTIALIAS_MONTE_CARLO,
00098         ANTIALIAS_JITTERED,
00099         ANTIALIAS_ADAPTIVE,
00100         ANTIALIAS_QUINTCUNX
00101     } AntialiasFilter;
00102 
00104     RendDesc():
00105         w_          (480),
00106         h_          (270),
00107         x_res       (DPI2DPM(72.0f)),
00108         y_res       (DPI2DPM(72.0f)),
00109         tl_         (-4,2.25),
00110         br_         (4,-2.25),
00111         focus       (0,0),
00112         a           (2),
00113         background  (Color::gray()),
00114         flags       (0),
00115         interlaced  (false),
00116         clamp       (false),
00117         frame_rate  (24),
00118         time_begin  (0),
00119         time_end    (0)
00120     { }
00121 
00123     RendDesc &apply(const RendDesc &x);
00124 
00126     const Color &get_bg_color()const;
00127 
00129     RendDesc &set_bg_color(const Color &bg);
00130 
00132     int get_w()const;
00133 
00135 
00138     RendDesc &set_w(int x);
00139 
00141     int get_h()const;
00142 
00144 
00147     RendDesc &set_h(int y);
00148 
00150     RendDesc &set_wh(int x, int y);
00151 
00153     Real get_x_res()const;
00154 
00156     RendDesc &set_x_res(Real x);
00157 
00159     Real get_y_res()const;
00160 
00162     RendDesc &set_y_res(Real y);
00163 
00164 
00166     Real get_physical_w()const;
00167 
00169     Real get_physical_h()const;
00170 
00172     RendDesc &set_physical_w(Real w);
00173 
00175     RendDesc &set_physical_h(Real h);
00176 
00177 
00179     int get_frame_start()const;
00180 
00182     RendDesc &set_frame_start(int x);
00183 
00185     int get_frame_end()const;
00186 
00188     RendDesc &set_frame_end(int x);
00189 
00191     const Time get_time_start()const;
00192 
00194     RendDesc &set_time_start(Time x);
00195 
00197     const Time get_time_end()const;
00198 
00200     RendDesc &set_time_end(Time x);
00201 
00203     RendDesc &set_time(Time x);
00204 
00206     RendDesc &set_frame(int x);
00207 
00209     const float &get_frame_rate()const;
00210 
00212     RendDesc &set_frame_rate(float x);
00213 
00215     const bool &get_interlaced()const;
00216 
00218     RendDesc &set_interlaced(bool x);
00219 
00221     const bool &get_clamp()const;
00222 
00224     RendDesc &set_clamp(bool x);
00225 
00227     RendDesc &set_flags(const int &x);
00228 
00230     RendDesc &clear_flags();
00231 
00233     int get_flags()const;
00234 
00236     Point::value_type get_pixel_aspect()const;
00237 
00239     Point::value_type get_image_aspect()const;
00240 
00242     const int &get_antialias()const;
00243 
00245     RendDesc &set_antialias(const int &x);
00246 
00248     Real get_span()const;
00249 
00251     RendDesc& set_span(const Real &x);
00252 
00253     //const Gamma &get_gamma()const;
00254 
00255     //RendDesc &set_gamma(const Gamma &x);
00256 
00257     const Point &get_focus()const;
00258 
00259     RendDesc &set_focus(const Point &x);
00260 
00261     const Point &get_tl()const;
00262 
00263     RendDesc &set_tl(const Point &x);
00264 
00265     const Point &get_br()const;
00266 
00267     RendDesc &set_br(const Point &x);
00268 
00269     Rect get_rect()const { return Rect(get_tl(),get_br()); }
00270 
00271     RendDesc &set_viewport(const Point &__tl, const Point &__br);
00272 
00273     RendDesc &set_viewport(Vector::value_type a,Vector::value_type b,Vector::value_type c,Vector::value_type d);
00274 
00276     Real get_pw()const;
00277 
00279     Real get_ph()const;
00280 
00282     RendDesc &set_subwindow(int x, int y, int w, int h);
00283 };  // END of class RendDesc
00284 
00286 
00287 inline RendDesc::Lock operator|(RendDesc::Lock lhs, RendDesc::Lock rhs)
00288 {
00289     return static_cast<RendDesc::Lock>((int)lhs|(int)rhs);
00290 }
00291 
00293 
00294 inline RendDesc::Lock operator&(RendDesc::Lock lhs, RendDesc::Lock rhs)
00295 {
00296     return static_cast<RendDesc::Lock>((int)lhs&(int)rhs);
00297 }
00298 
00300 
00301 inline RendDesc::Lock operator~(RendDesc::Lock rhs)
00302 {
00303     return static_cast<RendDesc::Lock>(~(int)rhs);
00304 }
00305 
00307 
00310 inline bool operator<=(RendDesc::Lock lhs, RendDesc::Lock rhs)
00311 {
00312     return static_cast<int>(lhs) & static_cast<int>(rhs)==static_cast<int>(rhs);
00313 }
00314 
00315 
00316 }; /* end namespace synfig */
00317 
00318 /* === E N D =============================================================== */
00319 
00320 #endif

Generated on Wed Aug 15 05:00:23 2007 for synfig by  doxygen 1.5.3