Merge "Build and package Layer Management service binaries." into tizen
[profile/ivi/layer-management.git] / LayerManagerBase / include / IRenderer.h
1 /***************************************************************************
2  *
3  * Copyright 2010,2011 BMW Car IT GmbH
4  *
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  *        http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  ****************************************************************************/
19
20 #ifndef _IRENDERER_H_
21 #define _IRENDERER_H_
22
23 #include <string>
24 #include "LayerType.h"
25 #include "Shader.h"
26 #include "OptimizationType.h"
27
28
29 class InputManager;
30
31
32 /**
33  * Abstract Base of all CompositingControllers, ie Renderers.
34  * \defgroup RendererAPI Layer Management Renderer API
35  */
36 class IRenderer
37 {
38 public:
39     /**
40      * \brief      default destructor
41      */
42     virtual ~IRenderer()
43     {
44     }
45
46     /**
47      * \brief      Start the actual rendering process (render loop)
48      * \ingroup    RendererAPI
49      * \param[in]  width width of display handled by this renderer
50      * \param[in]  height height of display handled by this renderer
51      * \param[in]  displayName name of display handled by this renderer
52      * \param[in]  maxIterationTimeInMS expected wakup time for health reporting in milliseconds (-1 to disable wakeup)
53      * \return     TRUE: renderer was started successfully
54      * \return     FALSE: renderer start failed
55      */
56     virtual bool start(int width, int height, const char* displayName, int maxIterationDurationInMS) = 0;
57
58     /**
59      * \brief      Stop rendering process (stop render loop)
60      * \ingroup    RendererAPI
61      */
62     virtual void stop() = 0;
63
64     /**
65      * \brief      Switch debug mode of this component on or off
66      * \ingroup    RendererAPI
67      * \param[in]  onoff TRUE: Turn on debug mode, FALSE: Turn off debug mode
68      */
69     virtual void setdebug(bool onoff) = 0;
70
71     /**
72      * \brief      Store graphical content of screen to bitmap
73      * \ingroup    RendererAPI
74      * \param[in]  fileToSave path to bitmap file to store the graphical content
75      */
76     virtual void doScreenShot(std::string fileToSave, const unsigned int screen_id) = 0;
77
78     /**
79      * \brief      Store graphical content of layer to bitmap
80      * \ingroup    RendererAPI
81      * \param[in]  fileToSave path to bitmap file to store the graphical content
82      * \param[in]  id id of layer
83      */
84     virtual void doScreenShotOfLayer(std::string fileToSave, const unsigned int id) = 0;
85
86     /**
87      * \brief      Store graphical content of surface to bitmap
88      * \ingroup    RendererAPI
89      * \param[in]  fileToSave path to bitmap file to store the graphical content
90      * \param[in]  id id of surface
91      * \param[in]  layer_id id of layer
92      */
93     virtual void doScreenShotOfSurface(std::string fileToSave, const unsigned int id, const unsigned int layer_id) = 0;
94
95     /**
96      * \brief      Get the capabilies of a layer type
97      * \ingroup    RendererAPI
98      * \param[in]  layertype type of layer
99      * \return     bitset with flags set for capabilities
100      */
101     virtual unsigned int getLayerTypeCapabilities(LayerType layertype) = 0;
102
103     /**
104      * \brief      Get the number of supported hardware layers of the renderer for a screen
105      * \ingroup    RendererAPI
106      * \param[in]  screenID id of the screen
107      * \return     Number of supported hardware layers for screen
108      */
109     virtual unsigned int getNumberOfHardwareLayers(unsigned int screenID) = 0;
110
111     /**
112      * \brief      Get the resolution of a screen handled by this renderer
113      * \ingroup    RendererAPI
114      * \param[in]  screenID id of the screen
115      * \return     array with width and height of screen
116      */
117     virtual unsigned int* getScreenResolution(unsigned int screenID) = 0;
118
119     /**
120      * \brief      Get the list if available screen ids
121      * \ingroup    RendererAPI
122      * \param[out] length length of the returned array
123      * \return     array containing all available screen ids
124      */
125     virtual unsigned int* getScreenIDs(unsigned int* length) = 0;
126
127     /**
128      * \brief      Create a shader object (that can be applied to surfaces)
129      * \ingroup    RendererAPI
130      * \param[in]  vertexName filename of vertex shader source code
131      * \param[in]  fragmentName filename of fragment shader source code
132      * \return     Pointer to created shader object
133      */
134     virtual Shader* createShader(const string* vertexName, const string* fragmentName) = 0;
135
136     /**
137      * \brief      Trigger a redraw for this renderer
138      * \ingroup    RendererAPI
139      */
140     virtual void signalWindowSystemRedraw() = 0;
141
142     /**
143      * \brief      Force composition for entire scene
144      * \ingroup    RendererAPI
145      */
146     virtual void forceCompositionWindowSystem() = 0;
147
148     /**
149       * \brief      Get the InputManager associated to the Scene
150       * \ingroup    RendererAPI
151       */
152     virtual InputManager* getInputManager() const = 0;
153
154     /**
155      * \brief      Set the mode for the specified optimization (e.g. OFF,ON,AUTO)
156      * \ingroup    RendererAPI
157      * \param[in]  id id of optimization
158      * \param[in] mode mode to set for the optimization
159      * \return     TRUE: id and mode are valid and mode was set
160      * \return     FALSE: id or mode was invalid and/or mode could not be set
161      */
162     virtual bool setOptimizationMode(OptimizationType id, OptimizationModeType mode) = 0;
163
164     /**
165      * \brief      Get the current mode for the specified optimization
166      * \ingroup    RendererAPI
167      * \param[in]  id id of optimization
168      * \param[out] mode retrieved mode value
169      * \return     TRUE: id is valid and mode was returned
170      * \return     FALSE: id was invalid and/or mode was not returned
171      */
172     virtual bool getOptimizationMode(OptimizationType id, OptimizationModeType *mode) = 0;
173 };
174
175 #endif /* _IRENDERER_H_ */
176