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
10 ** This package is free software; you can redistribute it and/or
11 ** modify it under the terms of the GNU General Public License as
12 ** published by the Free Software Foundation; either version 2 of
13 ** the License, or (at your option) any later version.
15 ** This package is distributed in the hope that it will be useful,
16 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 ** General Public License for more details.
21 /* ========================================================================= */
23 /* === S T A R T =========================================================== */
25 #ifndef __SYNFIG_RENDERDESC_H
26 #define __SYNFIG_RENDERDESC_H
28 /* === H E A D E R S ======================================================= */
36 /* === M A C R O S ========================================================= */
39 #define DPM2DPI(x) (float(x)/39.3700787402f)
40 #define DPI2DPM(x) (float(x)*39.3700787402f)
43 /* === T Y P E D E F S ===================================================== */
45 /* === C L A S S E S & S T R U C T S ======================================= */
69 LINK_PX_ASPECT=(1<<10),
71 LINK_IM_ASPECT=(1<<12),
73 LINK_IM_CENTER=(1<<14)
90 Time time_begin, time_end;
97 ANTIALIAS_MONTE_CARLO,
103 //! Default Constructor
107 x_res (DPI2DPM(72.0f)),
108 y_res (DPI2DPM(72.0f)),
113 background (Color::gray()),
123 RendDesc &apply(const RendDesc &x);
126 const Color &get_bg_color()const;
129 RendDesc &set_bg_color(const Color &bg);
131 //! Return the width of the composition in pixels
134 //! Set the width of the composition in pixels.
135 /*! The other parameters are adjusted according to the
136 ** constraints placed on the flags.
138 RendDesc &set_w(int x);
140 //! Return the height of the composition in pixels
143 //! Set the height of the composition in pixels.
144 /*! The other parameters are adjusted according to the
145 ** constraints placed on the flags.
147 RendDesc &set_h(int y);
149 //! Sets the width and height of the composition in pixels
150 RendDesc &set_wh(int x, int y);
152 //! Returns the horizontal resolution (in dots per meter)
153 Real get_x_res()const;
155 //! Sets the horizontal resolution (in dots per meter)
156 RendDesc &set_x_res(Real x);
158 //! Returns the vertical resolution (in dots per meter)
159 Real get_y_res()const;
161 //! Sets the vertical resolution (in dots per meter)
162 RendDesc &set_y_res(Real y);
165 //! Return the physical width of the composition in meters
166 Real get_physical_w()const;
168 //! Return the physical height of the composition in meters
169 Real get_physical_h()const;
171 //! Set the physical width of the composition in meters
172 RendDesc &set_physical_w(Real w);
174 //! Set the physical height of the composition in meters
175 RendDesc &set_physical_h(Real h);
178 //! Return the index of the first frame
179 int get_frame_start()const;
181 //! Set the index of the first frame
182 RendDesc &set_frame_start(int x);
184 //! Return the index of the last frame
185 int get_frame_end()const;
187 //! Set the index of the last frame
188 RendDesc &set_frame_end(int x);
190 //! Return the starting time of the animation
191 const Time get_time_start()const;
193 //! Set the time that the animation will start
194 RendDesc &set_time_start(Time x);
196 //! Return the end time of the animation
197 const Time get_time_end()const;
199 //! Set the time that the animation will end
200 RendDesc &set_time_end(Time x);
202 //! Setup for one frame at the given time
203 RendDesc &set_time(Time x);
205 //! Setup for one frame
206 RendDesc &set_frame(int x);
208 //! Return the frame rate (frames-per-second)
209 const float &get_frame_rate()const;
211 //! Set the frame rate (frames-per-second)
212 RendDesc &set_frame_rate(float x);
214 //! Return the status of the interlaced flag
215 const bool &get_interlaced()const;
217 //! Set the interlace flag
218 RendDesc &set_interlaced(bool x);
220 //! Return the status of the clamp flag
221 const bool &get_clamp()const;
223 //! Set the clamp flag
224 RendDesc &set_clamp(bool x);
226 //! Set constraint flags
227 RendDesc &set_flags(const int &x);
229 //! Clear constraint flags
230 RendDesc &clear_flags();
232 //! Get constraint flags
233 int get_flags()const;
235 //! Return the aspect ratio of a single pixel
236 Point::value_type get_pixel_aspect()const;
238 //! Return the aspect ratio of the entire image
239 Point::value_type get_image_aspect()const;
241 //! Return the antialias amount
242 const int &get_antialias()const;
244 //! Set the antialias amount
245 RendDesc &set_antialias(const int &x);
247 //! Return the distance from the bottom-right to the top-left
248 Real get_span()const;
250 //! Set the span distance
251 RendDesc& set_span(const Real &x);
253 //const Gamma &get_gamma()const;
255 //RendDesc &set_gamma(const Gamma &x);
257 const Point &get_focus()const;
259 RendDesc &set_focus(const Point &x);
261 const Point &get_tl()const;
263 RendDesc &set_tl(const Point &x);
265 const Point &get_br()const;
267 RendDesc &set_br(const Point &x);
269 Rect get_rect()const { return Rect(get_tl(),get_br()); }
271 RendDesc &set_viewport(const Point &__tl, const Point &__br);
273 RendDesc &set_viewport(Vector::value_type a,Vector::value_type b,Vector::value_type c,Vector::value_type d);
275 //! Returns the width of one pixel
278 //! Returns the height of one pixel
281 //! Sets viewport to represent the screen at the give pixel coordinates
282 RendDesc &set_subwindow(int x, int y, int w, int h);
283 }; // END of class RendDesc
285 //! This operator allows the combining of RendDesc::Lock flags using the '|' operator
286 /*! \see RendDesc::Lock, RendDesc */
287 inline RendDesc::Lock operator|(RendDesc::Lock lhs, RendDesc::Lock rhs)
289 return static_cast<RendDesc::Lock>((int)lhs|(int)rhs);
292 //! This operator allows the masking of RendDesc::Lock flags using the '&' operator
293 /*! \see RendDesc::Lock, RendDesc */
294 inline RendDesc::Lock operator&(RendDesc::Lock lhs, RendDesc::Lock rhs)
296 return static_cast<RendDesc::Lock>((int)lhs&(int)rhs);
299 //! This operator allows the inverting of RendDesc::Lock flags using the '~' operator
300 /*! \see RendDesc::Lock, RendDesc */
301 inline RendDesc::Lock operator~(RendDesc::Lock rhs)
303 return static_cast<RendDesc::Lock>(~(int)rhs);
306 //! This operator is for checking RendDesc::Lock flags.
307 /*! Don't think of it as "less then or equal to", but think of it
308 ** like an arrow. Is \a rhs inside of \a lhs ?
309 ** \see RendDesc::Lock, RendDesc */
310 inline bool operator<=(RendDesc::Lock lhs, RendDesc::Lock rhs)
312 return static_cast<int>(lhs) & static_cast<int>(rhs)==static_cast<int>(rhs);
316 }; /* end namespace synfig */
318 /* === E N D =============================================================== */