os/graphics/graphicsaccelaration/vgi/inc/vg/vgcontext_symbian.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/graphics/graphicsaccelaration/vgi/inc/vg/vgcontext_symbian.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,117 @@
     1.4 +/*
     1.5 +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description: Internal binding API for OpenVG, used for managing OpenVG rendering contexts.
    1.18 +*
    1.19 +*/
    1.20 +#ifndef _OPENVG_CONTEXT_SYMBIAN_H
    1.21 +#define _OPENVG_CONTEXT_SYMBIAN_H
    1.22 +
    1.23 +#include "vg/vgcontext.h"
    1.24 +#include <fbs.h>
    1.25 +
    1.26 +/**
    1.27 + * OpenVG is initialized with the selected size and colorspace. A single rendering context is created and
    1.28 + * made active (there is no support for multiple contexts). Single rendering (back buffer) surface is created
    1.29 + * by OpenVG and made active for Read and Write.
    1.30 + * @param aSize Size of the rendering surface (back buffer) size in pixels.
    1.31 + * @param aColorSpace Color space to be used. Must be either VGI_COLORSPACE_LINEAR or VGI_COLORSPACE_SRGB.
    1.32 + * @return Returns KErrNone if initialization was successful. Returns error code KErrArgument
    1.33 + *         if width or height are negative. Returns error code KErrNoMemory if there is insufficient
    1.34 + *         free memory to complete the initialization (smaller size for back buffer or smaller antialiasing setting may
    1.35 + *         work). Returns error code KErrAlreadyExists if the surface and context already exists in this
    1.36 + *         process & thread (call VGITerminate to reset). Returns error code KErrNotSupported
    1.37 + *         if the given colorspace is not supported by the implementation.
    1.38 + */
    1.39 +IMPORT_C TInt VGISymbianInitialize( TSize aSize, VGIColorSpace aColorSpace );
    1.40 +
    1.41 +/**
    1.42 + * OpenVG is initialized with the selected size and colorspace. A single rendering context is created and
    1.43 + * made active (there is no support for multiple contexts). Single rendering (back buffer) surface is created
    1.44 + * by OpenVG and made active for Read and Write.
    1.45 + * @param aSize Size of the rendering surface (back buffer) size in pixels.
    1.46 + * @param aColorSpace Color space to be used. Must be either VGI_COLORSPACE_LINEAR or VGI_COLORSPACE_SRGB.
    1.47 + * @return Returns KErrNone if initialization was successful. Returns error code KErrArgument
    1.48 + *         if width or height are negative. Returns error code KErrNoMemory if there is insufficient
    1.49 + *         free memory to complete the initialization (smaller size for back buffer or smaller antialiasing setting may
    1.50 + *         work). Returns error code KErrAlreadyExists if the surface and context already exists in this
    1.51 + *         process & thread (call VGITerminate to reset). Returns error code KErrNotSupported
    1.52 + *         if the given colorspace is not supported by the implementation.
    1.53 + */
    1.54 +IMPORT_C TInt VGISymbianInitializeEx( TSize aSize, VGIColorSpace aColorSpace, TBool aPremultiplied, TBool aConformant );
    1.55 +
    1.56 +/**
    1.57 + * Copies the current contents of the internal back buffer to the given target buffer using the given stride
    1.58 + * and format. Back buffer contents may be undefined after this function as it marks the start of new frame.
    1.59 + * All target formats are supported by all implementations and the format bit pattern definitions match the
    1.60 + * Symbian formats (EColo64K, EColor16M, EColor16MU, EColor16MA). Target buffer memory is assumed to be generic
    1.61 + * system memory (MMU mapped).
    1.62 + * @param aBitmap Target buffer where the current back buffer is copied to.
    1.63 + *        The implementation uses internal back buffer and this target buffer is used only
    1.64 + *        during the execution of this method.
    1.65 + * @param aMaskBitmap Target buffer for the 8-bits per pixel destination alpha output
    1.66 + *        (only written to by the method if parameter is not NULL and format is other than EColor16MA)
    1.67 + * @param aHint Specify how to process transparent pixels.
    1.68 + *         Value VGI_SKIP_TRANSPARENT_PIXELS means transparent pixels are not copied to the target buffer.
    1.69 + *         Value VGI_COPY_TRANSPARENT_PIXELS means every pixel transparent or not is copied to the target buffer.
    1.70 + * @return Returns KErrNone if copying completed successfully. Returns error code KErrArgument
    1.71 + *         if aBitmap is NULL  or if aHint is neither VGI_SKIP_TRANSPARENT_PIXELS nor VGI_COPY_TRANSPARENT_PIXELS.
    1.72 + *         Returns error code KErrNoMemory if there is insufficient
    1.73 + *         free memory to complete the copying (before returning this error code the implementation internally
    1.74 + *         calls VGISymbianTerminate() and current context and surface are lost.
    1.75 + */
    1.76 +IMPORT_C TInt VGISymbianCopyToBitmap( CFbsBitmap *aBitmap, CFbsBitmap *aMaskBitmap = NULL, VGICopyToTargetHint aHint = VGI_COPY_TRANSPARENT_PIXELS );
    1.77 +
    1.78 +/**
    1.79 + * Rendering surface and context are freed and may not be used after call to this method. OpenVG is terminated (all
    1.80 + * other related resources are freed). If this method is called before VGISymbianInitialize, or VGISymbianTerminate is called after
    1.81 + * already being called, this method does nothing. In other words it is safe to call VGISymbianTerminate() multiple times
    1.82 + * sequentially.
    1.83 + */
    1.84 +IMPORT_C void VGISymbianTerminate();
    1.85 +
    1.86 +/**
    1.87 + * Resizes the back buffer to have the given width and height . This method should always be used to resize the back buffer as in
    1.88 + * many implementations the resize operation can be handled more efficiently than a plain delete old, create new method.
    1.89 + * Old context is preserved and can be used after the resize operation. Contents of the new frame buffer are UNDEFINED.
    1.90 + * @param aSize Size of the rendering surface (back buffer) after resize operation, size in pixels.
    1.91 + * @return Returns KErrNone if resize operation was successful.
    1.92 + *	  Returns error code KErrPermissionDenied if an image is currently set as the render target.
    1.93 + *	  Returns error code KErrArgument if width or height are negative or error code KErrNoMemory if there is insufficient free memory
    1.94 + *	  to allocate the back buffer of given size (smaller size may work).
    1.95 + * @note: if KErrNoMemory is returned, the original surface is lost and VGISymbianTerminate is called internally (context & surface is lost)
    1.96 + */
    1.97 +IMPORT_C TInt VGISymbianResize( TSize aSize );
    1.98 +
    1.99 +/**
   1.100 + * Redirects rendering to an image.
   1.101 + * @param aImage Image to be set as the render target.
   1.102 + * @return Returns KErrNone if successful.
   1.103 + *    Returns error code KErrBadHandle if aImage is not a valid image handle, or is not shared with the current context.
   1.104 + *    Returns error code KErrNotSupported if aImage is not of the same format as the "master surface".
   1.105 + *    Returns error code KErrInUse if aImage shares storage with any other image (via use of the vgChildImage function),
   1.106 + *      or is set as a paint pattern image on a paint object.
   1.107 + *    Returns error code KErrNoMemory if there is insufficient free memory to perform the operation.
   1.108 + * @note: if KErrNoMemory is returned, the original surface is lost and VGISymbianTerminate is called internally (context & surface is lost)
   1.109 + */
   1.110 +IMPORT_C TInt VGISymbianBindToImage( VGImage aImage );
   1.111 +
   1.112 +/**
   1.113 + * Reset the "master surface" as current render target .
   1.114 + * @return Returns KErrNone if successful.
   1.115 + *    Returns error code KErrNoMemory if there is insufficient free memory to perform the operation.
   1.116 + * @note: if KErrNoMemory is returned, the original surface is lost and VGITerminate is called internally (context & surface is lost)
   1.117 + */
   1.118 +IMPORT_C TInt VGISymbianUnBindImage();
   1.119 +
   1.120 +#endif /* _OPENVG_CONTEXT_SYMBIAN_H */