os/graphics/graphicscomposition/openwfcompositionengine/composition/include/wfccontext.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/graphics/graphicscomposition/openwfcompositionengine/composition/include/wfccontext.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,346 @@
     1.4 +/* Copyright (c) 2009 The Khronos Group Inc.
     1.5 + * Portions copyright (c) 2009-2010  Nokia Corporation and/or its subsidiary(-ies)
     1.6 + *
     1.7 + * Permission is hereby granted, free of charge, to any person obtaining a
     1.8 + * copy of this software and/or associated documentation files (the
     1.9 + * "Materials"), to deal in the Materials without restriction, including
    1.10 + * without limitation the rights to use, copy, modify, merge, publish,
    1.11 + * distribute, sublicense, and/or sell copies of the Materials, and to
    1.12 + * permit persons to whom the Materials are furnished to do so, subject to
    1.13 + * the following conditions:
    1.14 + *
    1.15 + * The above copyright notice and this permission notice shall be included
    1.16 + * in all copies or substantial portions of the Materials.
    1.17 + *
    1.18 + * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
    1.19 + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
    1.20 + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
    1.21 + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
    1.22 + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
    1.23 + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
    1.24 + * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
    1.25 + */
    1.26 +
    1.27 +/*! \ingroup wfc
    1.28 + *  \file wfccontext.h
    1.29 + *
    1.30 + *  \brief Context handling interface
    1.31 + */
    1.32 +#ifndef WFCCONTEXT_H_
    1.33 +#define WFCCONTEXT_H_
    1.34 +
    1.35 +#include "WF/wfc.h"
    1.36 +#include "wfcstructs.h"
    1.37 +#include "wfcdevice.h"
    1.38 +#include "owfscreen.h"
    1.39 +
    1.40 +#ifdef __cplusplus
    1.41 +extern "C"
    1.42 +{
    1.43 +#endif
    1.44 +
    1.45 +#define MAX_SOURCE_WIDTH        OWF_SURFACE_WIDTH
    1.46 +#define MAX_SOURCE_HEIGHT       OWF_SURFACE_HEIGHT
    1.47 +/*!
    1.48 +Initialize context attributes
    1.49 +\return ATTR_ERROR_NONE if attributes have been properly initialised.
    1.50 +*/
    1.51 +OWF_API_CALL OWF_ATTRIBUTE_LIST_STATUS
    1.52 +WFC_Context_InitializeAttributes(WFC_CONTEXT* context,
    1.53 +                                 WFCContextType type);
    1.54 +
    1.55 +/*!
    1.56 + *  \brief Create new context on device
    1.57 + *
    1.58 + *  \param device Device on which the context should be created
    1.59 + *  \param type Context type (on- or off-screen)
    1.60 + *
    1.61 + *  \return New context object or NULL in case of failure
    1.62 +*/
    1.63 +OWF_API_CALL WFC_CONTEXT*
    1.64 +WFC_Context_Create(WFC_DEVICE* device,
    1.65 +                   WFCNativeStreamType stream,
    1.66 +                   WFCContextType type,
    1.67 +                   WFCint screenNum);
    1.68 +/*!
    1.69 + * \brief Releases the resources associated with the context.  
    1.70 + * Some of these resources hold reference-counts on the context,
    1.71 + * so this must be called BEFORE the main attempt to destroy the context.
    1.72 + * 
    1.73 + *  \param type Context type (on- or off-screen)
    1.74 + */
    1.75 +OWF_API_CALL void
    1.76 +WFC_Context_Shutdown(WFC_CONTEXT* context);
    1.77 +
    1.78 +/*!
    1.79 + *  \brief Setup context rendering target
    1.80 + *
    1.81 + *  \param context Context
    1.82 + *  \param stream Target stream to use for rendering
    1.83 + */
    1.84 +OWF_API_CALL void
    1.85 +WFC_Context_SetTargetStream(WFC_CONTEXT* context,
    1.86 +                            OWFNativeStreamType stream);
    1.87 +
    1.88 +/*!
    1.89 + * \brief Checks if the given stream would be valid as an off-screen context target.
    1.90 + * Checks that the format can be rendered TO.
    1.91 + * Also checks that the image size is acceptable (within the scratch buffers).
    1.92 + * This is called before the context is created so is effectively a "static" context method.
    1.93 + * 
    1.94 + *  \param stream Target stream to use for rendering
    1.95 + */
    1.96 +OWF_API_CALL WFCboolean
    1.97 +WFC_Context_IsValidTargetStream(OWFNativeStreamType stream);
    1.98 +/*!
    1.99 + * \brief Checks that the image size is acceptable (within the scratch buffers).
   1.100 + * This is called before the source is created.
   1.101 + * 
   1.102 + *  \param stream source stream to use for rendering.
   1.103 + */
   1.104 +OWF_API_CALL WFCboolean
   1.105 +WFC_Context_IsValidSourceStream(OWFNativeStreamType stream);
   1.106 +/*!
   1.107 + * \brief Destroy all masks in context
   1.108 + *
   1.109 + * \param context Context
   1.110 + */
   1.111 +OWF_API_CALL void
   1.112 +WFC_Context_DestroyMasks(WFC_CONTEXT* context);
   1.113 +
   1.114 +/*!
   1.115 + * \brief Destroy all context sources
   1.116 + */
   1.117 +OWF_API_CALL void
   1.118 +WFC_Context_DestroySources(WFC_CONTEXT* context);
   1.119 +
   1.120 +/*!
   1.121 + *  \brief Destroy all context elements
   1.122 + *
   1.123 + *  \param context Context object
   1.124 + */
   1.125 +OWF_API_CALL void
   1.126 +WFC_Context_DestroyElements(WFC_CONTEXT* context);
   1.127 +
   1.128 +/*!
   1.129 + *  \brief Find element from current scene
   1.130 + *
   1.131 + *  \param context Context object
   1.132 + *  \param element Element to find
   1.133 + *
   1.134 + *  \return Element object or NULL if element hasn't been inserted
   1.135 + *  into current scene.
   1.136 + */
   1.137 +OWF_API_CALL WFC_ELEMENT*
   1.138 +WFC_Context_FindElement(WFC_CONTEXT* context,
   1.139 +                        WFCElement element);
   1.140 +
   1.141 +/*!
   1.142 + *  \brief Activate/deactivate auto-composition on context
   1.143 + *
   1.144 + *  \param context Context
   1.145 + *  \param act Auto-composition enable/disable
   1.146 + */
   1.147 +OWF_API_CALL void
   1.148 +WFC_Context_Activate(WFC_CONTEXT* context,
   1.149 +                     WFCboolean act);
   1.150 +
   1.151 +/*!
   1.152 + *  \brief Insert composition request to command stream
   1.153 + *
   1.154 + *  \param device
   1.155 + *  \param context
   1.156 + *  \param wait WFD_TRUE if executed synchronously
   1.157 + */
   1.158 +OWF_API_CALL WFCboolean
   1.159 +WFC_Context_InvokeComposition(WFC_DEVICE* device,
   1.160 +                              WFC_CONTEXT* context,
   1.161 +                              WFCboolean wait);
   1.162 +
   1.163 +/*!
   1.164 + *
   1.165 + *  \brief Insert commit request to command stream
   1.166 + *
   1.167 + *  \param device
   1.168 + *  \param context
   1.169 + *  \param wait WFD_TRUE if executed synchronously
   1.170 + */
   1.171 +OWF_API_CALL WFCErrorCode
   1.172 +WFC_Context_InvokeCommit(WFC_DEVICE* device,
   1.173 +                         WFC_CONTEXT* context,
   1.174 +                         WFCboolean wait);
   1.175 +
   1.176 +/*!
   1.177 + *  \brief Insert fence token to context's command stream
   1.178 + *
   1.179 + *  \param dpy
   1.180 + *  \param context
   1.181 + *  \param sync
   1.182 + */
   1.183 +OWF_API_CALL void
   1.184 +WFC_Context_InsertFence(WFC_CONTEXT* context,
   1.185 +                        WFCEGLDisplay dpy,
   1.186 +                        WFCEGLSync sync);
   1.187 +
   1.188 +/*!
   1.189 + *  \brief Create element
   1.190 + *
   1.191 + *  \param context
   1.192 + */
   1.193 +OWF_API_CALL WFC_ELEMENT*
   1.194 +WFC_Context_CreateElement(WFC_CONTEXT* context);
   1.195 +
   1.196 +/*! \brief Destroy element
   1.197 + *  \param context
   1.198 + *  \param element
   1.199 + */
   1.200 +OWF_API_CALL WFCErrorCode
   1.201 +WFC_Context_DestroyElement(WFC_CONTEXT* context, WFCElement element);
   1.202 +
   1.203 +/*!
   1.204 + *  \brief IncreaseClientElementCount
   1.205 + *
   1.206 + *  \param context
   1.207 + *  \return positive increased current element count; negative or zero indicating the count can't be increased
   1.208 + */
   1.209 +OWF_API_CALL WFCint
   1.210 +WFC_Context_IncreaseClientElementCount(WFC_CONTEXT* context);
   1.211 +
   1.212 +/*!
   1.213 + *  \brief DecreaseClientElementCount
   1.214 + *
   1.215 + *  \param context
   1.216 + *  \return positive or zero decreased current element count; negative indicating the count can't be decreased - p0robably already zero
   1.217 + */
   1.218 +OWF_API_CALL WFCint
   1.219 +WFC_Context_DecreaseClientElementCount(WFC_CONTEXT* context);
   1.220 +
   1.221 +/*!
   1.222 + *  \brief Insert element into context's scene
   1.223 + *
   1.224 + *  \param context
   1.225 + *  \param element
   1.226 + *  \param subordinate
   1.227 + *
   1.228 + *  \return WFCErrorCode
   1.229 + */
   1.230 +OWF_API_CALL WFCErrorCode
   1.231 +WFC_Context_InsertElement(WFC_CONTEXT* context,
   1.232 +                          WFCElement element,
   1.233 +                          WFCElement subordinate);
   1.234 +
   1.235 +/*!
   1.236 + *  \brief Remove element from context's scene
   1.237 + *
   1.238 + *  \param context
   1.239 + *  \param element
   1.240 + *
   1.241 + *  \return WFCErrorCode
   1.242 + */
   1.243 +OWF_API_CALL WFCErrorCode
   1.244 +WFC_Context_RemoveElement(WFC_CONTEXT* context,
   1.245 +                          WFCElement element);
   1.246 +
   1.247 +/*!
   1.248 + *  \brief Fetch the handle of the element that is above the given element.
   1.249 + *
   1.250 + *  \param context
   1.251 + *  \param element
   1.252 + *
   1.253 + *  \return Error code. On return, the location pointed by result
   1.254 + *  will contain handle of the element above OR WFC_INVALID_HANDLE,
   1.255 + *  if no element is above given element.
   1.256 + */
   1.257 +OWF_API_CALL WFCErrorCode
   1.258 +WFC_Context_GetElementAbove(WFC_CONTEXT* context,
   1.259 +                            WFCElement element,
   1.260 +                            WFCElement* result);
   1.261 +
   1.262 +/*!
   1.263 + *  \brief Fetch the handle of the element that is below the given element.
   1.264 + *
   1.265 + *  \param context
   1.266 + *  \param element
   1.267 + *
   1.268 + *  \return Error code. On return, the location pointed by result
   1.269 + *  will contain handle of the element below OR WFC_INVALID_HANDLE,
   1.270 + *  if no element is below given element.
   1.271 + */
   1.272 +OWF_API_CALL WFCErrorCode
   1.273 +WFC_Context_GetElementBelow(WFC_CONTEXT* context,
   1.274 +                            WFCElement element,
   1.275 +                            WFCElement* result);
   1.276 +
   1.277 +/*!
   1.278 + *  \brief Get context attribute value
   1.279 + *
   1.280 + *  \param context
   1.281 + *  \param attrib
   1.282 + *  \param value
   1.283 + *
   1.284 + *  \return WFCErrorCode
   1.285 + */
   1.286 +OWF_API_CALL WFCErrorCode
   1.287 +WFC_Context_GetAttribi(WFC_CONTEXT* context,
   1.288 +                       WFCContextAttrib attrib,
   1.289 +                       WFCint* value);
   1.290 +
   1.291 +/*!
   1.292 + *  \brief Set context attribute value
   1.293 + *
   1.294 + *  \param context
   1.295 + *  \param attrib
   1.296 + *  \param value
   1.297 + *
   1.298 + *  \return WFCErrorCode
   1.299 + */
   1.300 +OWF_API_CALL WFCErrorCode
   1.301 +WFC_Context_SetAttribi(WFC_CONTEXT* context,
   1.302 +                       WFCContextAttrib attrib,
   1.303 +                       WFCint value);
   1.304 +
   1.305 +/*!
   1.306 + *  \brief Get context attribute value
   1.307 + *
   1.308 + *  \param context
   1.309 + *  \param attrib
   1.310 + *  \param value
   1.311 + *
   1.312 + *  \return WFCErrorCode
   1.313 + */
   1.314 +OWF_API_CALL WFCErrorCode
   1.315 +WFC_Context_GetAttribfv(WFC_CONTEXT* context,
   1.316 +                        WFCContextAttrib attrib,
   1.317 +                        WFCint count,
   1.318 +                        WFCfloat* values);
   1.319 +
   1.320 +/*!
   1.321 + *  \brief Set context attribute value
   1.322 + *
   1.323 + *  \param context
   1.324 + *  \param attrib
   1.325 + *  \param value
   1.326 + *
   1.327 + *  \return WFCErrorCode
   1.328 + */
   1.329 +OWF_API_CALL WFCErrorCode
   1.330 +WFC_Context_SetAttribfv(WFC_CONTEXT* context,
   1.331 +                        WFCContextAttrib attrib,
   1.332 +                        WFCint count,
   1.333 +                        const WFCfloat* values);
   1.334 +
   1.335 +
   1.336 +/*!
   1.337 + *  \brief Check if context is currently activated
   1.338 + *
   1.339 + *  \param context
   1.340 + */
   1.341 +
   1.342 +OWF_API_CALL WFCboolean
   1.343 +WFC_Context_Active(WFC_CONTEXT* context);
   1.344 +
   1.345 +#ifdef __cplusplus
   1.346 +}
   1.347 +#endif
   1.348 +
   1.349 +#endif /*WFCCONTEXT_H_*/