- Main Page
- Related Pages
- Namespaces
- Classes
- Files

# renddesc.h

Go to the documentation of this file.

    00001 /* === S Y N F I G ========================================================= */
    00022 /* ========================================================================= */
    00023
    00024 /* === S T A R T =========================================================== */
    00025
    00026 #ifndef __SYNFIG_RENDERDESC_H
    00027 #define __SYNFIG_RENDERDESC_H
    00028
    00029 /* === H E A D E R S ======================================================= */
    00030
    00031 #include "vector.h"
    00032 #include "color.h"
    00033 #include "types.h"
    00034 #include <cmath>
    00035 #include "rect.h"
    00036
    00037 /* === M A C R O S ========================================================= */
    00038
    00039 #ifndef DPM2DPI
    00040 #define DPM2DPI(x)  (float(x)/39.3700787402f)
    00041 #define DPI2DPM(x)  (float(x)*39.3700787402f)
    00042 #endif
    00043
    00044 /* === T Y P E D E F S ===================================================== */
    00045
    00046 /* === C L A S S E S & S T R U C T S ======================================= */
    00047
    00048 namespace synfig {
    00049
    00053 class RendDesc
    00054 {
    00055 public:
    00056     enum Lock
    00057     {
    00058         PX_ASPECT=(1<<0),       // "Pixel Aspect" in Locks and Links
    00059         PX_AREA=(1<<1),         // not used
    00060         PX_W=(1<<2),            // "Pixel Width" in Locks and Links - not used
    00061         PX_H=(1<<3),            // "Pixel Height" in Locks and Links - not used
    00062
    00063         IM_ASPECT=(1<<4),       // "Image Aspect" in Locks and Links
    00064         IM_SPAN=(1<<5),         // "Image Span" in Locks and Links
    00065         IM_W=(1<<6),            // "Image Width" in Locks and Links
    00066         IM_H=(1<<7),            // "Image Height" in Locks and Links
    00067         IM_ZOOMIN=(1<<8),       // not used
    00068         IM_ZOOMOUT=(1<<9),      // not used
    00069
    00070         LINK_PX_ASPECT=(1<<10), // not used
    00071         LINK_PX_AREA=(1<<11),   // not used
    00072         LINK_IM_ASPECT=(1<<12), // not used
    00073         LINK_IM_SPAN=(1<<13),   // not used
    00074         LINK_IM_CENTER=(1<<14)  // not used
    00075     };
    00076
    00077 private:
    00078     int w_,h_;
    00079     Real x_res;
    00080     Real y_res;
    00081     Point tl_, br_;
    00082     Point focus;
    00083     int a;
    00084     //Gamma gamma;
    00085     Color background;
    00086     int flags;
    00087     bool interlaced;
    00088     bool clamp;
    00089
    00090     float frame_rate;
    00091     Time time_begin, time_end;
    00092
    00093 public:
    00094
    00095     enum
    00096     {
    00097         ANTIALIAS_UNIFORM,
    00098         ANTIALIAS_MONTE_CARLO,
    00099         ANTIALIAS_JITTERED,
    00100         ANTIALIAS_ADAPTIVE,
    00101         ANTIALIAS_QUINTCUNX
    00102     } AntialiasFilter;
    00103
    00105     RendDesc():
    00106         w_          (480),
    00107         h_          (270),
    00108         x_res       (DPI2DPM(72.0f)),
    00109         y_res       (DPI2DPM(72.0f)),
    00110         tl_         (-4,2.25),
    00111         br_         (4,-2.25),
    00112         focus       (0,0),
    00113         a           (2),
    00114         background  (Color::gray()),
    00115         flags       (0),
    00116         interlaced  (false),
    00117         clamp       (false),
    00118         frame_rate  (24),
    00119         time_begin  (0),
    00120         time_end    (0)
    00121     { }
    00122
    00124     RendDesc &apply(const RendDesc &x);
    00125
    00127     const Color &get_bg_color()const;
    00128
    00130     RendDesc &set_bg_color(const Color &bg);
    00131
    00133     int get_w()const;
    00134
    00136
    00139     RendDesc &set_w(int x);
    00140
    00142     int get_h()const;
    00143
    00145
    00148     RendDesc &set_h(int y);
    00149
    00151     RendDesc &set_wh(int x, int y);
    00152
    00154     Real get_x_res()const;
    00155
    00157     RendDesc &set_x_res(Real x);
    00158
    00160     Real get_y_res()const;
    00161
    00163     RendDesc &set_y_res(Real y);
    00164
    00165
    00167     Real get_physical_w()const;
    00168
    00170     Real get_physical_h()const;
    00171
    00173     RendDesc &set_physical_w(Real w);
    00174
    00176     RendDesc &set_physical_h(Real h);
    00177
    00178
    00180     int get_frame_start()const;
    00181
    00183     RendDesc &set_frame_start(int x);
    00184
    00186     int get_frame_end()const;
    00187
    00189     RendDesc &set_frame_end(int x);
    00190
    00192     const Time get_time_start()const;
    00193
    00195     RendDesc &set_time_start(Time x);
    00196
    00198     const Time get_time_end()const;
    00199
    00201     RendDesc &set_time_end(Time x);
    00202
    00204     RendDesc &set_time(Time x);
    00205
    00207     RendDesc &set_frame(int x);
    00208
    00210     const float &get_frame_rate()const;
    00211
    00213     RendDesc &set_frame_rate(float x);
    00214
    00216     const bool &get_interlaced()const;
    00217
    00219     RendDesc &set_interlaced(bool x);
    00220
    00222     const bool &get_clamp()const;
    00223
    00225     RendDesc &set_clamp(bool x);
    00226
    00228     RendDesc &set_flags(const int &x);
    00229
    00231     RendDesc &clear_flags();
    00232
    00234     int get_flags()const;
    00235
    00237     Point::value_type get_pixel_aspect()const;
    00238
    00240     Point::value_type get_image_aspect()const;
    00241
    00243     const int &get_antialias()const;
    00244
    00246     RendDesc &set_antialias(const int &x);
    00247
    00249     Real get_span()const;
    00250
    00252     RendDesc& set_span(const Real &x);
    00253
    00254     //const Gamma &get_gamma()const;
    00255
    00256     //RendDesc &set_gamma(const Gamma &x);
    00257
    00258     const Point &get_focus()const;
    00259
    00260     RendDesc &set_focus(const Point &x);
    00261
    00262     const Point &get_tl()const;
    00263
    00264     RendDesc &set_tl(const Point &x);
    00265
    00266     const Point &get_br()const;
    00267
    00268     RendDesc &set_br(const Point &x);
    00269
    00270     Rect get_rect()const { return Rect(get_tl(),get_br()); }
    00271
    00272     RendDesc &set_viewport(const Point &__tl, const Point &__br);
    00273
    00274     RendDesc &set_viewport(Vector::value_type a,Vector::value_type b,Vector::value_type c,Vector::value_type d);
    00275
    00277     Real get_pw()const;
    00278
    00280     Real get_ph()const;
    00281
    00283     RendDesc &set_subwindow(int x, int y, int w, int h);
    00284 };  // END of class RendDesc
    00285
    00287
    00288 inline RendDesc::Lock operator|(RendDesc::Lock lhs, RendDesc::Lock rhs)
    00289 {
    00290     return static_cast<RendDesc::Lock>((int)lhs|(int)rhs);
    00291 }
    00292
    00294
    00295 inline RendDesc::Lock operator&(RendDesc::Lock lhs, RendDesc::Lock rhs)
    00296 {
    00297     return static_cast<RendDesc::Lock>((int)lhs&(int)rhs);
    00298 }
    00299
    00301
    00302 inline RendDesc::Lock operator~(RendDesc::Lock rhs)
    00303 {
    00304     return static_cast<RendDesc::Lock>(~(int)rhs);
    00305 }
    00306
    00307 }; /* end namespace synfig */
    00308
    00309 /* === E N D =============================================================== */
    00310
    00311 #endif