os/graphics/graphicscomposition/openwfcompositionengine/composition/include/wfcdevice.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/wfcdevice.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,320 @@
     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 +/*! \ingroup wfc
    1.27 + *  \file wfcdevice.h
    1.28 + *
    1.29 + *  \brief Device handling interface
    1.30 + */
    1.31 +#ifndef WFCDEVICE_H_
    1.32 +#define WFCDEVICE_H_
    1.33 +
    1.34 +#include "WF/wfc.h"
    1.35 +#include "wfcstructs.h"
    1.36 +#include "wfcimageprovider.h"
    1.37 +
    1.38 +#ifdef __cplusplus
    1.39 +extern "C" {
    1.40 +#endif
    1.41 +
    1.42 +/*!
    1.43 + *  Get list of available devices.
    1.44 + *
    1.45 + *  \param idList Pointer to list where device IDs should be written
    1.46 + *  \param listCapacity Maximum number of IDs to write
    1.47 + *  \param filterList User provided array
    1.48 + *
    1.49 + *  \return Number of IDs written.
    1.50 + */
    1.51 +OWF_API_CALL WFCint
    1.52 +WFC_Devices_GetIds(WFCint* idList,
    1.53 +                   WFCint listCapacity,
    1.54 +                   const WFCint* filterList);
    1.55 +
    1.56 +/*!
    1.57 + *  \brief Create instance of a device whose ID
    1.58 + *  matches deviceId
    1.59 + *
    1.60 + *  \param deviceId ID of the device to create. Must be WFC_DEFAULT_DEVICE_ID
    1.61 + *  or some other valid device ID (returned by Devices_GetIds)
    1.62 + *
    1.63 + *  \return Handle to created device or WFC_INVALID_HANDLE
    1.64 + *
    1.65 + */
    1.66 +OWF_API_CALL WFCint
    1.67 +WFC_Device_Create(WFCint deviceId);
    1.68 +
    1.69 +/*!
    1.70 + *  \brief Destroy device, or rather queue it for destruction.
    1.71 + *
    1.72 + *  \param device Device
    1.73 + */
    1.74 +OWF_API_CALL void
    1.75 +WFC_Device_Destroy(WFC_DEVICE* device);
    1.76 +
    1.77 +/*!
    1.78 + *  \brief Set error code for device.
    1.79 + *
    1.80 + *  Obs! In case the previous
    1.81 + *  error code hasn't been read from the device, this function
    1.82 + *  does nothing; the new error is set only if "current" error
    1.83 + *  is none.
    1.84 + *
    1.85 + *  \param dev Device object
    1.86 + *  \param code Error to set
    1.87 + *
    1.88 + */
    1.89 +OWF_API_CALL void OWF_APIENTRY
    1.90 +WFC_Device_SetError(WFCDevice dev,
    1.91 +                    WFCErrorCode code);
    1.92 +
    1.93 +/*!
    1.94 + *  \brief Read and reset last error code from device.
    1.95 + *
    1.96 + *  \param device Device object
    1.97 + *
    1.98 + *  \return WFCErrorCode
    1.99 + */
   1.100 +OWF_API_CALL WFCErrorCode
   1.101 +WFC_Device_GetError(WFC_DEVICE* device);
   1.102 +
   1.103 +/*!
   1.104 + *  \brief Find device object by handle
   1.105 + *
   1.106 + *  \param dev Device handle
   1.107 + *
   1.108 + *  \return Mathing device object or NULL
   1.109 + */
   1.110 +OWF_API_CALL WFC_DEVICE*
   1.111 +WFC_Device_FindByHandle(WFCDevice dev);
   1.112 +
   1.113 +/*!
   1.114 + *  \brief Get device attribute
   1.115 + *
   1.116 + *  \param device Device
   1.117 + *  \param attrib Attribute name
   1.118 + *  \param value Pointer to where the value should be saved
   1.119 + *
   1.120 + *  \return WFCErrorCode
   1.121 + */
   1.122 +OWF_API_CALL WFCErrorCode
   1.123 +WFC_Device_GetAttribi(WFC_DEVICE* device,
   1.124 +                      WFCDeviceAttrib attrib,
   1.125 +                      WFCint* value);
   1.126 +
   1.127 +/*!
   1.128 + *  \brief Create context on device
   1.129 + *
   1.130 + *  \param device Device
   1.131 + *  \param stream Target stream for context
   1.132 + *  \param type Context type
   1.133 + *
   1.134 + *  \return New context
   1.135 + */
   1.136 +OWF_API_CALL WFC_CONTEXT*
   1.137 +WFC_Device_CreateContext(WFC_DEVICE* device,
   1.138 +                         OWFNativeStreamType stream,
   1.139 +                         WFCContextType type,
   1.140 +                         WFCint screenNum);
   1.141 +
   1.142 +/*!
   1.143 + *  \brief Destroy context from device
   1.144 + */
   1.145 +OWF_API_CALL WFCErrorCode
   1.146 +WFC_Device_DestroyContext(WFC_DEVICE* device,
   1.147 +                          WFCContext context);
   1.148 +
   1.149 +/*!
   1.150 + *  \brief Destroy all device's contexts
   1.151 + *
   1.152 + *  \param device Device object
   1.153 + */
   1.154 +OWF_API_CALL void
   1.155 +WFC_Device_DestroyContexts(WFC_DEVICE* device);
   1.156 +
   1.157 +/*!
   1.158 + *  \brief Find context context object by handle
   1.159 + *
   1.160 + *  \param device Device
   1.161 + *  \param context Context handle
   1.162 + *
   1.163 + *  \return Corresponding context object or NULL
   1.164 + *  if handle is invalid.
   1.165 + */
   1.166 +OWF_API_CALL WFC_CONTEXT*
   1.167 +WFC_Device_FindContext(WFC_DEVICE* device,
   1.168 +                       WFCContext context);
   1.169 +
   1.170 +/*!
   1.171 + *  \brief Create new element
   1.172 + *
   1.173 + *  \param device
   1.174 + *  \param context
   1.175 + *
   1.176 + *  \return New element or NULL
   1.177 + */
   1.178 +OWF_API_CALL WFC_ELEMENT*
   1.179 +WFC_Device_CreateElement(WFC_DEVICE* device, WFC_CONTEXT* context);
   1.180 +
   1.181 +/*!
   1.182 + *  \brief Destroy element
   1.183 + *
   1.184 + *  \param device
   1.185 + *  \param element
   1.186 + */
   1.187 +OWF_API_CALL WFCErrorCode
   1.188 +WFC_Device_DestroyElement(WFC_DEVICE* device,
   1.189 +                          WFCElement element);
   1.190 +
   1.191 +/*!
   1.192 + *  \brief Destroy all elements from device
   1.193 + *
   1.194 + *  \param device Device
   1.195 + */
   1.196 +OWF_API_CALL void
   1.197 +WFC_Device_DestroyElements(WFC_DEVICE* device);
   1.198 +
   1.199 +/*!
   1.200 + *  \brief Find element by handle
   1.201 + *
   1.202 + *  \param device Device
   1.203 + *  \param el Element handle
   1.204 + *
   1.205 + *  \return Element object
   1.206 + */
   1.207 +OWF_API_CALL WFC_ELEMENT*
   1.208 +WFC_Device_FindElement(WFC_DEVICE* device,
   1.209 +                       WFCElement el);
   1.210 +
   1.211 +/*!
   1.212 + *  \brief Set element integer vector attribute
   1.213 + *
   1.214 + *  \param device Device
   1.215 + *  \param element Element handle
   1.216 + *  \param attrib Attribute name
   1.217 + *  \param count Attribute value vector length (1 for scalar attribute)
   1.218 + *  \param values Pointer to values
   1.219 + *
   1.220 + *  \return WFCErrorCode: WFC_ERROR_BAD_ATTRIBUTE if attribute name is invalid;
   1.221 + *  WFC_ERROR_INVALID_ARGUMENT if values is NULL or if the count doesn't match
   1.222 + *  the attribute's size; WFC_ERROR_BAD_HANDLE if element handle is invalid.
   1.223 + */
   1.224 +OWF_API_CALL WFCErrorCode
   1.225 +WFC_Device_SetElementAttribiv(WFC_DEVICE* device,
   1.226 +                              WFCElement element,
   1.227 +                              WFCElementAttrib attrib,
   1.228 +                              WFCint count,
   1.229 +                              const WFCint* values);
   1.230 +
   1.231 +/*!
   1.232 + *  \brief Set element attribute
   1.233 + */
   1.234 +OWF_API_CALL WFCErrorCode
   1.235 +WFC_Device_SetElementAttribfv(WFC_DEVICE* device,
   1.236 +                              WFCElement element,
   1.237 +                              WFCElementAttrib attrib,
   1.238 +                              WFCint count,
   1.239 +                              const WFCfloat* values);
   1.240 +/*!
   1.241 + *  \brief Get element attribute
   1.242 + */
   1.243 +OWF_API_CALL WFCErrorCode
   1.244 +WFC_Device_GetElementAttribiv(WFC_DEVICE* device,
   1.245 +                              WFCElement element,
   1.246 +                              WFCElementAttrib attrib,
   1.247 +                              WFCint count,
   1.248 +                              WFCint* values);
   1.249 +/*!
   1.250 + *  \brief Get element attribute
   1.251 + */
   1.252 +OWF_API_CALL WFCErrorCode
   1.253 +WFC_Device_GetElementAttribfv(WFC_DEVICE* device,
   1.254 +                              WFCElement element,
   1.255 +                              WFCElementAttrib attrib,
   1.256 +                              WFCint count,
   1.257 +                              WFCfloat* values);
   1.258 +
   1.259 +
   1.260 +/*!
   1.261 + *  \brief Destroy all image providers from device
   1.262 + *
   1.263 + *  \param device Device
   1.264 + */
   1.265 +OWF_API_CALL void
   1.266 +WFC_Device_DestroyImageProviders(WFC_DEVICE* device);
   1.267 +
   1.268 +OWF_API_CALL WFC_IMAGE_PROVIDER*
   1.269 +WFC_Device_FindImageProvider(WFC_DEVICE* device,
   1.270 +                             WFCHandle handle,
   1.271 +                             WFC_IMAGE_PROVIDER_TYPE type);
   1.272 +
   1.273 +OWF_API_CALL WFC_IMAGE_PROVIDER*
   1.274 +WFC_Device_CreateSource(WFC_DEVICE* device,
   1.275 +                        WFC_CONTEXT* context,
   1.276 +                        WFCNativeStreamType stream);
   1.277 +
   1.278 +OWF_API_CALL WFC_IMAGE_PROVIDER*
   1.279 +WFC_Device_CreateMask(WFC_DEVICE* device,
   1.280 +                      WFC_CONTEXT* context,
   1.281 +                      WFCNativeStreamType stream);
   1.282 +
   1.283 +OWF_API_CALL WFCErrorCode
   1.284 +WFC_Device_DestroySource(WFC_DEVICE* device, WFCSource source);
   1.285 +
   1.286 +OWF_API_CALL WFCErrorCode
   1.287 +WFC_Device_DestroyMask(WFC_DEVICE* device, WFCMask mask);
   1.288 +
   1.289 +OWF_API_CALL WFC_IMAGE_PROVIDER*
   1.290 +WFC_Device_FindSource(WFC_DEVICE* device, WFCSource source);
   1.291 +
   1.292 +OWF_API_CALL WFC_IMAGE_PROVIDER*
   1.293 +WFC_Device_FindMask(WFC_DEVICE* device, WFCMask mask);
   1.294 +
   1.295 +OWF_API_CALL void
   1.296 +WFC_Device_EnableContentNotifications(WFC_DEVICE* device,
   1.297 +                                      WFC_CONTEXT* context,
   1.298 +                                      WFCboolean enable);
   1.299 +
   1.300 +OWF_API_CALL WFCboolean
   1.301 +WFC_Device_StreamIsTarget(WFC_DEVICE* device,
   1.302 +                          WFCNativeStreamType stream);
   1.303 +
   1.304 +OWF_API_CALL WFC_CONTEXT*
   1.305 +WFC_Device_FindContextByScreen(WFC_DEVICE* device,
   1.306 +                               WFCint screenNumber);
   1.307 +
   1.308 +OWF_API_CALL void
   1.309 +WFC_Device_DestroyContextElements(WFC_DEVICE* device,
   1.310 +                                  WFC_CONTEXT* context);
   1.311 +
   1.312 +OWF_API_CALL void
   1.313 +WFC_Device_DestroyContextImageProviders(WFC_DEVICE* device,
   1.314 +                                        WFC_CONTEXT* context);
   1.315 +
   1.316 +OWF_API_CALL WFCboolean
   1.317 +WFC_Device_FindScreenNumber(WFCint screenNumber);
   1.318 +
   1.319 +#ifdef __cplusplus
   1.320 +}
   1.321 +#endif
   1.322 +
   1.323 +#endif /*WFCDEVICE_H_*/