1 /* === S I N F G =========================================================== */
3 ** \brief Template Header
5 ** $Id: renddesc.h,v 1.1.1.1 2005/01/04 01:23:14 darco Exp $
8 ** Copyright (c) 2002 Robert B. Quattlebaum Jr.
10 ** This software and associated documentation
11 ** are CONFIDENTIAL and PROPRIETARY property of
12 ** the above-mentioned copyright holder.
14 ** You may not copy, print, publish, or in any
15 ** other way distribute this software without
16 ** a prior written agreement with
17 ** the copyright holder.
20 /* ========================================================================= */
22 /* === S T A R T =========================================================== */
24 #ifndef __SINFG_RENDERDESC_H
25 #define __SINFG_RENDERDESC_H
27 /* === H E A D E R S ======================================================= */
35 /* === M A C R O S ========================================================= */
38 #define DPM2DPI(x) (float(x)/39.3700787402f)
39 #define DPI2DPM(x) (float(x)*39.3700787402f)
42 /* === T Y P E D E F S ===================================================== */
44 /* === C L A S S E S & S T R U C T S ======================================= */
68 LINK_PX_ASPECT=(1<<10),
70 LINK_IM_ASPECT=(1<<12),
72 LINK_IM_CENTER=(1<<14)
89 Time time_begin, time_end;
96 ANTIALIAS_MONTE_CARLO,
102 //! Default Constructor
106 x_res (DPI2DPM(72.0f)),
107 y_res (DPI2DPM(72.0f)),
112 background (Color::gray()),
122 RendDesc &apply(const RendDesc &x);
125 const Color &get_bg_color()const;
128 RendDesc &set_bg_color(const Color &bg);
130 //! Return the width of the composition in pixels
133 //! Set the width of the composition in pixels.
134 /*! The other parameters are adjusted according to the
135 ** constraints placed on the flags.
137 RendDesc &set_w(int x);
139 //! Return the height of the composition in pixels
142 //! Set the height of the composition in pixels.
143 /*! The other parameters are adjusted according to the
144 ** constraints placed on the flags.
146 RendDesc &set_h(int y);
148 //! Sets the width and height of the composition in pixels
149 RendDesc &set_wh(int x, int y);
151 //! Returns the horizontal resolution (in dots per meter)
152 Real get_x_res()const;
154 //! Sets the horizontal resolution (in dots per meter)
155 RendDesc &set_x_res(Real x);
157 //! Returns the vertical resolution (in dots per meter)
158 Real get_y_res()const;
160 //! Sets the vertical resolution (in dots per meter)
161 RendDesc &set_y_res(Real y);
164 //! Return the physical width of the composition in meters
165 Real get_physical_w()const;
167 //! Return the physical height of the composition in meters
168 Real get_physical_h()const;
170 //! Set the physical width of the composition in meters
171 RendDesc &set_physical_w(Real w);
173 //! Set the physical height of the composition in meters
174 RendDesc &set_physical_h(Real h);
177 //! Return the index of the first frame
178 int get_frame_start()const;
180 //! Set the index of the first frame
181 RendDesc &set_frame_start(int x);
183 //! Return the index of the last frame
184 int get_frame_end()const;
186 //! Set the index of the last frame
187 RendDesc &set_frame_end(int x);
189 //! Return the starting time of the animation
190 const Time get_time_start()const;
192 //! Set the time that the animation will start
193 RendDesc &set_time_start(Time x);
195 //! Return the end time of the animation
196 const Time get_time_end()const;
198 //! Set the time that the animation will end
199 RendDesc &set_time_end(Time x);
201 //! Setup for one frame at the given time
202 RendDesc &set_time(Time x);
204 //! Setup for one frame
205 RendDesc &set_frame(int x);
207 //! Return the frame rate (frames-per-second)
208 const float &get_frame_rate()const;
210 //! Set the frame rate (frames-per-second)
211 RendDesc &set_frame_rate(float x);
213 //! Return the status of the interlaced flag
214 const bool &get_interlaced()const;
216 //! Set the interlace flag
217 RendDesc &set_interlaced(bool x);
219 //! Return the status of the clamp flag
220 const bool &get_clamp()const;
222 //! Set the clamp flag
223 RendDesc &set_clamp(bool x);
225 //! Set constraint flags
226 RendDesc &set_flags(const int &x);
228 //! Clear constraint flags
229 RendDesc &clear_flags();
231 //! Get constraint flags
232 int get_flags()const;
234 //! Return the aspect ratio of a single pixel
235 Point::value_type get_pixel_aspect()const;
237 //! Return the aspect ratio of the entire image
238 Point::value_type get_image_aspect()const;
240 //! Return the antialias amount
241 const int &get_antialias()const;
243 //! Set the antilaias amount
244 RendDesc &set_antialias(const int &x);
246 //! Return the distance from the bottom-right to the top-left
247 Real get_span()const;
249 //! Set the span distance
250 RendDesc& set_span(const Real &x);
252 //const Gamma &get_gamma()const;
254 //RendDesc &set_gamma(const Gamma &x);
256 const Point &get_focus()const;
258 RendDesc &set_focus(const Point &x);
260 const Point &get_tl()const;
262 RendDesc &set_tl(const Point &x);
264 const Point &get_br()const;
266 RendDesc &set_br(const Point &x);
268 Rect get_rect()const { return Rect(get_tl(),get_br()); }
270 RendDesc &set_viewport(const Point &__tl, const Point &__br);
272 RendDesc &set_viewport(Vector::value_type a,Vector::value_type b,Vector::value_type c,Vector::value_type d);
274 //! Returns the width of one pixel
277 //! Returns the height of one pixel
280 //! Sets viewport to represent the screen at the give pixel coordinates
281 RendDesc &set_subwindow(int x, int y, int w, int h);
282 }; // END of class RendDesc
284 //! This operator allows the combining of RendDesc::Lock flags using the '|' operator
285 /*! \see RendDesc::Lock, RendDesc */
286 inline RendDesc::Lock operator|(RendDesc::Lock lhs, RendDesc::Lock rhs)
288 return static_cast<RendDesc::Lock>((int)lhs|(int)rhs);
291 //! This operator allows the masking of RendDesc::Lock flags using the '&' operator
292 /*! \see RendDesc::Lock, RendDesc */
293 inline RendDesc::Lock operator&(RendDesc::Lock lhs, RendDesc::Lock rhs)
295 return static_cast<RendDesc::Lock>((int)lhs&(int)rhs);
298 //! This operator allows the inverting of RendDesc::Lock flags using the '~' operator
299 /*! \see RendDesc::Lock, RendDesc */
300 inline RendDesc::Lock operator~(RendDesc::Lock rhs)
302 return static_cast<RendDesc::Lock>(~(int)rhs);
305 //! This operator is for checking RendDesc::Lock flags.
306 /*! Don't think of it as "less then or equal to", but think of it
307 ** like an arrow. Is \a rhs inside of \a lhs ?
308 ** \see RendDesc::Lock, RendDesc */
309 inline bool operator<=(RendDesc::Lock lhs, RendDesc::Lock rhs)
311 return static_cast<int>(lhs) & static_cast<int>(rhs)==static_cast<int>(rhs);
315 }; /* end namespace sinfg */
317 /* === E N D =============================================================== */