os/graphics/graphicsaccelaration/vgi/inc/vg/vgcontext_symbian.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 /*
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     8 *
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    11 *
    12 * Contributors:
    13 *
    14 * Description: Internal binding API for OpenVG, used for managing OpenVG rendering contexts.
    15 *
    16 */
    17 #ifndef _OPENVG_CONTEXT_SYMBIAN_H
    18 #define _OPENVG_CONTEXT_SYMBIAN_H
    19 
    20 #include "vg/vgcontext.h"
    21 #include <fbs.h>
    22 
    23 /**
    24  * OpenVG is initialized with the selected size and colorspace. A single rendering context is created and
    25  * made active (there is no support for multiple contexts). Single rendering (back buffer) surface is created
    26  * by OpenVG and made active for Read and Write.
    27  * @param aSize Size of the rendering surface (back buffer) size in pixels.
    28  * @param aColorSpace Color space to be used. Must be either VGI_COLORSPACE_LINEAR or VGI_COLORSPACE_SRGB.
    29  * @return Returns KErrNone if initialization was successful. Returns error code KErrArgument
    30  *         if width or height are negative. Returns error code KErrNoMemory if there is insufficient
    31  *         free memory to complete the initialization (smaller size for back buffer or smaller antialiasing setting may
    32  *         work). Returns error code KErrAlreadyExists if the surface and context already exists in this
    33  *         process & thread (call VGITerminate to reset). Returns error code KErrNotSupported
    34  *         if the given colorspace is not supported by the implementation.
    35  */
    36 IMPORT_C TInt VGISymbianInitialize( TSize aSize, VGIColorSpace aColorSpace );
    37 
    38 /**
    39  * OpenVG is initialized with the selected size and colorspace. A single rendering context is created and
    40  * made active (there is no support for multiple contexts). Single rendering (back buffer) surface is created
    41  * by OpenVG and made active for Read and Write.
    42  * @param aSize Size of the rendering surface (back buffer) size in pixels.
    43  * @param aColorSpace Color space to be used. Must be either VGI_COLORSPACE_LINEAR or VGI_COLORSPACE_SRGB.
    44  * @return Returns KErrNone if initialization was successful. Returns error code KErrArgument
    45  *         if width or height are negative. Returns error code KErrNoMemory if there is insufficient
    46  *         free memory to complete the initialization (smaller size for back buffer or smaller antialiasing setting may
    47  *         work). Returns error code KErrAlreadyExists if the surface and context already exists in this
    48  *         process & thread (call VGITerminate to reset). Returns error code KErrNotSupported
    49  *         if the given colorspace is not supported by the implementation.
    50  */
    51 IMPORT_C TInt VGISymbianInitializeEx( TSize aSize, VGIColorSpace aColorSpace, TBool aPremultiplied, TBool aConformant );
    52 
    53 /**
    54  * Copies the current contents of the internal back buffer to the given target buffer using the given stride
    55  * and format. Back buffer contents may be undefined after this function as it marks the start of new frame.
    56  * All target formats are supported by all implementations and the format bit pattern definitions match the
    57  * Symbian formats (EColo64K, EColor16M, EColor16MU, EColor16MA). Target buffer memory is assumed to be generic
    58  * system memory (MMU mapped).
    59  * @param aBitmap Target buffer where the current back buffer is copied to.
    60  *        The implementation uses internal back buffer and this target buffer is used only
    61  *        during the execution of this method.
    62  * @param aMaskBitmap Target buffer for the 8-bits per pixel destination alpha output
    63  *        (only written to by the method if parameter is not NULL and format is other than EColor16MA)
    64  * @param aHint Specify how to process transparent pixels.
    65  *         Value VGI_SKIP_TRANSPARENT_PIXELS means transparent pixels are not copied to the target buffer.
    66  *         Value VGI_COPY_TRANSPARENT_PIXELS means every pixel transparent or not is copied to the target buffer.
    67  * @return Returns KErrNone if copying completed successfully. Returns error code KErrArgument
    68  *         if aBitmap is NULL  or if aHint is neither VGI_SKIP_TRANSPARENT_PIXELS nor VGI_COPY_TRANSPARENT_PIXELS.
    69  *         Returns error code KErrNoMemory if there is insufficient
    70  *         free memory to complete the copying (before returning this error code the implementation internally
    71  *         calls VGISymbianTerminate() and current context and surface are lost.
    72  */
    73 IMPORT_C TInt VGISymbianCopyToBitmap( CFbsBitmap *aBitmap, CFbsBitmap *aMaskBitmap = NULL, VGICopyToTargetHint aHint = VGI_COPY_TRANSPARENT_PIXELS );
    74 
    75 /**
    76  * Rendering surface and context are freed and may not be used after call to this method. OpenVG is terminated (all
    77  * other related resources are freed). If this method is called before VGISymbianInitialize, or VGISymbianTerminate is called after
    78  * already being called, this method does nothing. In other words it is safe to call VGISymbianTerminate() multiple times
    79  * sequentially.
    80  */
    81 IMPORT_C void VGISymbianTerminate();
    82 
    83 /**
    84  * Resizes the back buffer to have the given width and height . This method should always be used to resize the back buffer as in
    85  * many implementations the resize operation can be handled more efficiently than a plain delete old, create new method.
    86  * Old context is preserved and can be used after the resize operation. Contents of the new frame buffer are UNDEFINED.
    87  * @param aSize Size of the rendering surface (back buffer) after resize operation, size in pixels.
    88  * @return Returns KErrNone if resize operation was successful.
    89  *	  Returns error code KErrPermissionDenied if an image is currently set as the render target.
    90  *	  Returns error code KErrArgument if width or height are negative or error code KErrNoMemory if there is insufficient free memory
    91  *	  to allocate the back buffer of given size (smaller size may work).
    92  * @note: if KErrNoMemory is returned, the original surface is lost and VGISymbianTerminate is called internally (context & surface is lost)
    93  */
    94 IMPORT_C TInt VGISymbianResize( TSize aSize );
    95 
    96 /**
    97  * Redirects rendering to an image.
    98  * @param aImage Image to be set as the render target.
    99  * @return Returns KErrNone if successful.
   100  *    Returns error code KErrBadHandle if aImage is not a valid image handle, or is not shared with the current context.
   101  *    Returns error code KErrNotSupported if aImage is not of the same format as the "master surface".
   102  *    Returns error code KErrInUse if aImage shares storage with any other image (via use of the vgChildImage function),
   103  *      or is set as a paint pattern image on a paint object.
   104  *    Returns error code KErrNoMemory if there is insufficient free memory to perform the operation.
   105  * @note: if KErrNoMemory is returned, the original surface is lost and VGISymbianTerminate is called internally (context & surface is lost)
   106  */
   107 IMPORT_C TInt VGISymbianBindToImage( VGImage aImage );
   108 
   109 /**
   110  * Reset the "master surface" as current render target .
   111  * @return Returns KErrNone if successful.
   112  *    Returns error code KErrNoMemory if there is insufficient free memory to perform the operation.
   113  * @note: if KErrNoMemory is returned, the original surface is lost and VGITerminate is called internally (context & surface is lost)
   114  */
   115 IMPORT_C TInt VGISymbianUnBindImage();
   116 
   117 #endif /* _OPENVG_CONTEXT_SYMBIAN_H */