1 /* === S Y N F I G ========================================================= */
2 /*! \file synfig/renddesc.h
3 ** \brief Template Header
8 ** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
9 ** Copyright (c) 2008 Chris Moore
11 ** This package is free software; you can redistribute it and/or
12 ** modify it under the terms of the GNU General Public License as
13 ** published by the Free Software Foundation; either version 2 of
14 ** the License, or (at your option) any later version.
16 ** This package is distributed in the hope that it will be useful,
17 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 ** General Public License for more details.
22 /* ========================================================================= */
24 /* === S T A R T =========================================================== */
26 #ifndef __SYNFIG_RENDERDESC_H
27 #define __SYNFIG_RENDERDESC_H
29 /* === H E A D E R S ======================================================= */
37 /* === M A C R O S ========================================================= */
40 #define DPM2DPI(x) (float(x)/39.3700787402f)
41 #define DPI2DPM(x) (float(x)*39.3700787402f)
44 /* === T Y P E D E F S ===================================================== */
46 /* === C L A S S E S & S T R U C T S ======================================= */
58 PX_ASPECT=(1<<0), // "Pixel Aspect" in Locks and Links
59 PX_AREA=(1<<1), // not used
60 PX_W=(1<<2), // "Pixel Width" in Locks and Links - not used
61 PX_H=(1<<3), // "Pixel Height" in Locks and Links - not used
63 IM_ASPECT=(1<<4), // "Image Aspect" in Locks and Links
64 IM_SPAN=(1<<5), // "Image Span" in Locks and Links
65 IM_W=(1<<6), // "Image Width" in Locks and Links
66 IM_H=(1<<7), // "Image Height" in Locks and Links
67 IM_ZOOMIN=(1<<8), // not used
68 IM_ZOOMOUT=(1<<9), // not used
70 LINK_PX_ASPECT=(1<<10), // not used
71 LINK_PX_AREA=(1<<11), // not used
72 LINK_IM_ASPECT=(1<<12), // not used
73 LINK_IM_SPAN=(1<<13), // not used
74 LINK_IM_CENTER=(1<<14) // not used
91 Time time_begin, time_end;
98 ANTIALIAS_MONTE_CARLO,
104 //! Default Constructor
108 x_res (DPI2DPM(72.0f)),
109 y_res (DPI2DPM(72.0f)),
114 background (Color::gray()),
124 RendDesc &apply(const RendDesc &x);
127 const Color &get_bg_color()const;
130 RendDesc &set_bg_color(const Color &bg);
132 //! Return the width of the composition in pixels
135 //! Set the width of the composition in pixels.
136 /*! The other parameters are adjusted according to the
137 ** constraints placed on the flags.
139 RendDesc &set_w(int x);
141 //! Return the height of the composition in pixels
144 //! Set the height of the composition in pixels.
145 /*! The other parameters are adjusted according to the
146 ** constraints placed on the flags.
148 RendDesc &set_h(int y);
150 //! Sets the width and height of the composition in pixels
151 RendDesc &set_wh(int x, int y);
153 //! Returns the horizontal resolution (in dots per meter)
154 Real get_x_res()const;
156 //! Sets the horizontal resolution (in dots per meter)
157 RendDesc &set_x_res(Real x);
159 //! Returns the vertical resolution (in dots per meter)
160 Real get_y_res()const;
162 //! Sets the vertical resolution (in dots per meter)
163 RendDesc &set_y_res(Real y);
166 //! Return the physical width of the composition in meters
167 Real get_physical_w()const;
169 //! Return the physical height of the composition in meters
170 Real get_physical_h()const;
172 //! Set the physical width of the composition in meters
173 RendDesc &set_physical_w(Real w);
175 //! Set the physical height of the composition in meters
176 RendDesc &set_physical_h(Real h);
179 //! Return the index of the first frame
180 int get_frame_start()const;
182 //! Set the index of the first frame
183 RendDesc &set_frame_start(int x);
185 //! Return the index of the last frame
186 int get_frame_end()const;
188 //! Set the index of the last frame
189 RendDesc &set_frame_end(int x);
191 //! Return the starting time of the animation
192 const Time get_time_start()const;
194 //! Set the time that the animation will start
195 RendDesc &set_time_start(Time x);
197 //! Return the end time of the animation
198 const Time get_time_end()const;
200 //! Set the time that the animation will end
201 RendDesc &set_time_end(Time x);
203 //! Setup for one frame at the given time
204 RendDesc &set_time(Time x);
206 //! Setup for one frame
207 RendDesc &set_frame(int x);
209 //! Return the frame rate (frames-per-second)
210 const float &get_frame_rate()const;
212 //! Set the frame rate (frames-per-second)
213 RendDesc &set_frame_rate(float x);
215 //! Return the status of the interlaced flag
216 const bool &get_interlaced()const;
218 //! Set the interlace flag
219 RendDesc &set_interlaced(bool x);
221 //! Return the status of the clamp flag
222 const bool &get_clamp()const;
224 //! Set the clamp flag
225 RendDesc &set_clamp(bool x);
227 //! Set constraint flags
228 RendDesc &set_flags(const int &x);
230 //! Clear constraint flags
231 RendDesc &clear_flags();
233 //! Get constraint flags
234 int get_flags()const;
236 //! Return the aspect ratio of a single pixel
237 Point::value_type get_pixel_aspect()const;
239 //! Return the aspect ratio of the entire image
240 Point::value_type get_image_aspect()const;
242 //! Return the antialias amount
243 const int &get_antialias()const;
245 //! Set the antialias amount
246 RendDesc &set_antialias(const int &x);
248 //! Return the distance from the bottom-right to the top-left
249 Real get_span()const;
251 //! Set the span distance
252 RendDesc& set_span(const Real &x);
254 //const Gamma &get_gamma()const;
256 //RendDesc &set_gamma(const Gamma &x);
258 const Point &get_focus()const;
260 RendDesc &set_focus(const Point &x);
262 const Point &get_tl()const;
264 RendDesc &set_tl(const Point &x);
266 const Point &get_br()const;
268 RendDesc &set_br(const Point &x);
270 Rect get_rect()const { return Rect(get_tl(),get_br()); }
272 RendDesc &set_viewport(const Point &__tl, const Point &__br);
274 RendDesc &set_viewport(Vector::value_type a,Vector::value_type b,Vector::value_type c,Vector::value_type d);
276 //! Returns the width of one pixel
279 //! Returns the height of one pixel
282 //! Sets viewport to represent the screen at the given pixel coordinates
283 RendDesc &set_subwindow(int x, int y, int w, int h);
284 }; // END of class RendDesc
286 //! This operator allows the combining of RendDesc::Lock flags using the '|' operator
287 /*! \see RendDesc::Lock, RendDesc */
288 inline RendDesc::Lock operator|(RendDesc::Lock lhs, RendDesc::Lock rhs)
290 return static_cast<RendDesc::Lock>((int)lhs|(int)rhs);
293 //! This operator allows the masking of RendDesc::Lock flags using the '&' operator
294 /*! \see RendDesc::Lock, RendDesc */
295 inline RendDesc::Lock operator&(RendDesc::Lock lhs, RendDesc::Lock rhs)
297 return static_cast<RendDesc::Lock>((int)lhs&(int)rhs);
300 //! This operator allows the inverting of RendDesc::Lock flags using the '~' operator
301 /*! \see RendDesc::Lock, RendDesc */
302 inline RendDesc::Lock operator~(RendDesc::Lock rhs)
304 return static_cast<RendDesc::Lock>(~(int)rhs);
307 }; /* end namespace synfig */
309 /* === E N D =============================================================== */