Mercurial > hg > aimc
comparison trunk/src/Modules/Output/Graphics/Devices/GraphicsOutputDeviceCairo.h @ 398:3ee03a6b95a0
- All \t to two spaces (style guide compliance)
author | tomwalters |
---|---|
date | Fri, 15 Oct 2010 05:46:53 +0000 |
parents | 7a573750b186 |
children | 7bfed53caacf |
comparison
equal
deleted
inserted
replaced
397:7a573750b186 | 398:3ee03a6b95a0 |
---|---|
45 { | 45 { |
46 public: | 46 public: |
47 GraphicsOutputDeviceCairo(AimParameters *pParam); | 47 GraphicsOutputDeviceCairo(AimParameters *pParam); |
48 virtual ~GraphicsOutputDeviceCairo(); | 48 virtual ~GraphicsOutputDeviceCairo(); |
49 | 49 |
50 /*! \brief Initializes this output device, prepares plotting tools. | 50 /*! \brief Initializes this output device, prepares plotting tools. |
51 * \param sDir Directory or filename where to put images, max length is | 51 * \param sDir Directory or filename where to put images, max length is |
52 * _MAX_PATH. Must end with slash!!! | 52 * _MAX_PATH. Must end with slash!!! |
53 * \return true on success, false on failure. | 53 * \return true on success, false on failure. |
54 * | 54 * |
55 * sDir can be either a filename, in which case the output will be | 55 * sDir can be either a filename, in which case the output will be |
56 * to that file, or a directory, in which case it will be filled | 56 * to that file, or a directory, in which case it will be filled |
57 * with 6-digit numbered files. A new file is then created at every | 57 * with 6-digit numbered files. A new file is then created at every |
58 * call to gGrab(). | 58 * call to gGrab(). |
59 * | 59 * |
60 * As usual, make sure to call this function before any other. If this | 60 * As usual, make sure to call this function before any other. If this |
61 * Initialize() failed, you shouldn't try the other functions either. | 61 * Initialize() failed, you shouldn't try the other functions either. |
62 */ | 62 */ |
63 bool Initialize(const char *sDir); | 63 bool Initialize(const char *sDir); |
64 bool Initialize(); | 64 bool Initialize(); |
65 void gGrab(); | 65 void gGrab(); |
66 void gBeginLineStrip(); | 66 void gBeginLineStrip(); |
67 void gBeginQuadStrip(); | 67 void gBeginQuadStrip(); |
68 using GraphicsOutputDevice::gVertex3f; // Because we overload it | 68 using GraphicsOutputDevice::gVertex3f; // Because we overload it |
69 void gVertex3f(float x, float y, float z); | 69 void gVertex3f(float x, float y, float z); |
70 void gColor3f(float r, float g, float b); | 70 void gColor3f(float r, float g, float b); |
71 void gEnd(); | 71 void gEnd(); |
72 void gText3f(float x, float y, float z, const char *sStr, bool bRotated = false); | 72 void gText3f(float x, float y, float z, const char *sStr, bool bRotated = false); |
73 void gRelease(); | 73 void gRelease(); |
74 unsigned char* GetBuffer(); | 74 unsigned char* GetBuffer(); |
75 int GetPixelFormat(); | 75 int GetPixelFormat(); |
76 protected: | 76 protected: |
77 /*! \brief Internal initialisation | 77 /*! \brief Internal initialisation |
78 * | 78 * |
79 */ | 79 */ |
80 void Init(); | 80 void Init(); |
81 | 81 |
82 /*! \brief Open the file with given index for output | 82 /*! \brief Open the file with given index for output |
83 * \param index File number to open | 83 * \param index File number to open |
84 * \return true on success, false on error | 84 * \return true on success, false on error |
85 * | 85 * |
86 * This opens a file for output and sets up the plotting library. | 86 * This opens a file for output and sets up the plotting library. |
87 */ | 87 */ |
88 bool OpenFile(unsigned int index); | 88 bool OpenFile(unsigned int index); |
89 | 89 |
90 //! \brief Closes a plot output file, if any is open. | 90 //! \brief Closes a plot output file, if any is open. |
91 void CloseFile(); | 91 void CloseFile(); |
92 | 92 |
93 //! \brief Set to true if the input file can be written to | 93 //! \brief Set to true if the input file can be written to |
94 bool m_bOutputFile; | 94 bool m_bOutputFile; |
95 //! \brief The Cairo plotter | 95 //! \brief The Cairo plotter |
96 int m_iPlotHandle; | 96 int m_iPlotHandle; |
97 //! \brief Output directory | 97 //! \brief Output directory |
98 char m_sDir[PATH_MAX]; | 98 char m_sDir[PATH_MAX]; |
99 //! \brief Current file number | 99 //! \brief Current file number |
100 unsigned int m_iFileNumber; | 100 unsigned int m_iFileNumber; |
101 //! \brief true if this is the first vertex after gBegin() | 101 //! \brief true if this is the first vertex after gBegin() |
102 bool m_bIsFirstVertex; | 102 bool m_bIsFirstVertex; |
103 | 103 |
104 enum VertexType { | 104 enum VertexType { |
105 VertexTypeNone, | 105 VertexTypeNone, |
106 VertexTypeLine, | 106 VertexTypeLine, |
107 VertexTypeQuad | 107 VertexTypeQuad |
108 }; | 108 }; |
109 //! \brief The current vertex type | 109 //! \brief The current vertex type |
110 VertexType m_iVertexType; | 110 VertexType m_iVertexType; |
111 //! \brief Begin vertex of current quad | 111 //! \brief Begin vertex of current quad |
112 float m_aPrevX[3], m_aPrevY[3]; | 112 float m_aPrevX[3], m_aPrevY[3]; |
113 //! \brief Current number of quad vertices stored | 113 //! \brief Current number of quad vertices stored |
114 unsigned int m_iPrevVertexCount; | 114 unsigned int m_iPrevVertexCount; |
115 | 115 |
116 //! \brief Whether to invert the colors or not | 116 //! \brief Whether to invert the colors or not |
117 bool m_bInvertColors; | 117 bool m_bInvertColors; |
118 | 118 |
119 //! \brief Cairo Drawing Surface | 119 //! \brief Cairo Drawing Surface |
120 cairo_surface_t *m_cSurface; | 120 cairo_surface_t *m_cSurface; |
121 | 121 |
122 //! \brief Cairo Context | 122 //! \brief Cairo Context |
123 cairo_t *m_cCr; | 123 cairo_t *m_cCr; |
124 | 124 |
125 //! \brief Internal store for the input filename | 125 //! \brief Internal store for the input filename |
126 char m_sFilename[PATH_MAX]; | 126 char m_sFilename[PATH_MAX]; |
127 | 127 |
128 unsigned int m_iWidth; | 128 unsigned int m_iWidth; |
129 unsigned int m_iHeight; | 129 unsigned int m_iHeight; |
130 bool m_bUseMemoryBuffer; | 130 bool m_bUseMemoryBuffer; |
131 }; | 131 }; |
132 | 132 |
133 #endif /* __GRAPHICS_OUTPUT_DEVICE_CAIRO_H__ */ | 133 #endif /* __GRAPHICS_OUTPUT_DEVICE_CAIRO_H__ */ |