comparison trunk/src/Modules/Output/Graphics/Devices/GraphicsOutputDeviceCairo.h @ 411:a908972d234e

- Added support for movies!
author tomwalters
date Thu, 21 Oct 2010 01:46:39 +0000
parents dd13c9834ceb
children f2dd5788e1d8
comparison
equal deleted inserted replaced
410:7af493eb1563 411:a908972d234e
45 * This class outputs a graphics operation to file. It only supports 2d though, 45 * This class outputs a graphics operation to file. It only supports 2d though,
46 * so the z-component is ignored. 46 * so the z-component is ignored.
47 */ 47 */
48 class GraphicsOutputDeviceCairo : public GraphicsOutputDevice { 48 class GraphicsOutputDeviceCairo : public GraphicsOutputDevice {
49 public: 49 public:
50 GraphicsOutputDeviceCairo(Parameters *pParam); 50 GraphicsOutputDeviceCairo(Parameters *parameters);
51 virtual ~GraphicsOutputDeviceCairo(); 51 virtual ~GraphicsOutputDeviceCairo();
52 52
53 /*! \brief Initializes this output device, prepares plotting tools. 53 /*! \brief Initializes this output device, prepares plotting tools.
54 * \param sDir Directory or filename where to put images, max length is 54 * \param sDir Directory or filename where to put images, max length is
55 * _MAX_PATH. Must end with slash!!! 55 * _MAX_PATH. Must end with slash.
56 * \return true on success, false on failure. 56 * \return true on success, false on failure.
57 * 57 *
58 * sDir can be either a filename, in which case the output will be 58 * sDir can be either a filename, in which case the output will be
59 * to that file, or a directory, in which case it will be filled 59 * to that file, or a directory, in which case it will be filled
60 * with 6-digit numbered files. A new file is then created at every 60 * with 6-digit numbered files. A new file is then created at every
61 * call to gGrab(). 61 * call to gGrab().
62 * 62 *
63 * As usual, make sure to call this function before any other. If this 63 * As usual, make sure to call this function before any other. If this
64 * Initialize() failed, you shouldn't try the other functions either. 64 * Initialize() failed, you shouldn't try the other functions either.
65 */ 65 */
66 bool Initialize(const char *sDir); 66 bool Initialize(string directory);
67 bool Initialize();
68 void gGrab(); 67 void gGrab();
69 void gBeginLineStrip(); 68 void gBeginLineStrip();
70 void gBeginQuadStrip(); 69 void gBeginQuadStrip();
71 using GraphicsOutputDevice::gVertex3f; // Because we overload it 70 using GraphicsOutputDevice::gVertex3f; // Because we overload it
72 void gVertex3f(float x, float y, float z); 71 void gVertex3f(float x, float y, float z);
78 int GetPixelFormat(); 77 int GetPixelFormat();
79 protected: 78 protected:
80 /*! \brief Internal initialisation 79 /*! \brief Internal initialisation
81 * 80 *
82 */ 81 */
83 void Init(); 82 void InititalzeInternal();
84 83
85 /*! \brief Open the file with given index for output 84 /*! \brief Open the file with given index for output
86 * \param index File number to open 85 * \param index File number to open
87 * \return true on success, false on error 86 * \return true on success, false on error
88 * 87 *
93 //! \brief Closes a plot output file, if any is open. 92 //! \brief Closes a plot output file, if any is open.
94 void CloseFile(); 93 void CloseFile();
95 94
96 //! \brief Set to true if the input file can be written to 95 //! \brief Set to true if the input file can be written to
97 bool m_bOutputFile; 96 bool m_bOutputFile;
98 //! \brief The Cairo plotter
99 int m_iPlotHandle;
100 //! \brief Output directory 97 //! \brief Output directory
101 char m_sDir[FILENAME_MAX]; 98 string directory_;
102 //! \brief Current file number 99 //! \brief Current file number
103 unsigned int m_iFileNumber; 100 unsigned int m_iFileNumber;
104 //! \brief true if this is the first vertex after gBegin() 101 //! \brief true if this is the first vertex after gBegin()
105 bool m_bIsFirstVertex; 102 bool m_bIsFirstVertex;
106 103
124 121
125 //! \brief Cairo Context 122 //! \brief Cairo Context
126 cairo_t *m_cCr; 123 cairo_t *m_cCr;
127 124
128 //! \brief Internal store for the input filename 125 //! \brief Internal store for the input filename
129 char m_sFilename[FILENAME_MAX]; 126 string image_filename_;
130 127
131 unsigned int m_iWidth; 128 unsigned int m_iWidth;
132 unsigned int m_iHeight; 129 unsigned int m_iHeight;
133 bool m_bUseMemoryBuffer; 130 bool m_bUseMemoryBuffer;
134 }; 131 };