svgtopt/VGRenderer/inc/VGSurface.h
changeset 0 d46562c3d99d
child 17 db5c883ad1c5
equal deleted inserted replaced
-1:000000000000 0:d46562c3d99d
       
     1 /*
       
     2 * Copyright (c) 2003 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:  CVGSurface header file
       
    15  *
       
    16 */
       
    17 
       
    18 #ifndef VGSURFACE_H
       
    19 #define VGSURFACE_H
       
    20 
       
    21 #include <e32std.h>
       
    22 #include <e32base.h>
       
    23 
       
    24 #include "MVGSurfaceImpl.h"
       
    25 
       
    26 class RWindow;
       
    27 class CFbsBitmap;
       
    28 class CVGRenderer;
       
    29 
       
    30 /**
       
    31  *  CVGSurface
       
    32  * 
       
    33  */
       
    34 class CVGSurface : public CBase
       
    35     {
       
    36 public:
       
    37     enum SurfaceConfig
       
    38     {
       
    39     BTIMAP_HEADER = MVGSurfaceImpl::BTIMAP_HEADER,
       
    40     ALPHA_SIZE = MVGSurfaceImpl::ALPHA_SIZE,
       
    41     ALPHA_MASK_SIZE = MVGSurfaceImpl::ALPHA_MASK_SIZE
       
    42     };
       
    43     
       
    44     /**
       
    45      * Destructor.
       
    46      */
       
    47     ~CVGSurface();
       
    48 
       
    49     /*!
       
    50      * @fn          NewL()
       
    51      * @bief        Creates the renderer surface abstraction
       
    52      * @param       aVGSurfaceImpl The surface implementation
       
    53      * @return      Renderer surface abstraction
       
    54      */
       
    55     static CVGSurface* NewL(MVGSurfaceImpl *aVGSurfaceImpl);
       
    56 
       
    57     /*!
       
    58      * @fn          NewL()
       
    59      * @bief        Creates the renderer surface abstraction
       
    60      * @param       aVGSurfaceImpl The surface implementation
       
    61      * @return      Renderer surface abstraction
       
    62      */
       
    63     static CVGSurface* NewLC(MVGSurfaceImpl *aVGSurfaceImpl);
       
    64 
       
    65     /*!
       
    66      * @fn          InitializeSurface(TSize aSize, TInt aColorSpace)
       
    67      * @bief        Initialize the surface
       
    68      * @param       aSize The surface size
       
    69      * @param       aColorSpace This is optional with egl
       
    70      * @return      KErrNone in case of succesfull, appropriate error code otherwise
       
    71      */
       
    72     TInt InitializeSurface(TSize aSize, TInt aColorSpace)
       
    73         {
       
    74         return iImpl->InitializeSurface(aSize, aColorSpace);
       
    75         }
       
    76 
       
    77     /*!
       
    78      * @fn          CreateSurface(RWindow *aSurface, CFbsBitmap *aBitmap)
       
    79      * @bief        Creates the actual rendering surface
       
    80      * @param       aDisplayMode    The display mode
       
    81      * @param       aSurface The window object
       
    82      * @param       aBitmap  The bitmao object, is optional
       
    83      * @return      KErrNone in case of succesfull, appropriate error code otherwise
       
    84      */
       
    85     TInt CreateSurface(TInt aDisplayMode, RWindow *aSurface, CFbsBitmap *aBitmap)
       
    86         {
       
    87         return iImpl->CreateSurface(aDisplayMode, aSurface, aBitmap);
       
    88         }
       
    89     
       
    90     /*!
       
    91      * @fn          ResizeSurface(TSize aSize)
       
    92      * @bief        Resizes the surface
       
    93      * @param       aSize   The new size
       
    94      * @return      KErrNone in case of succesfull, appropriate error code otherwise
       
    95      */
       
    96     TInt ResizeSurface(TSize aSize)
       
    97         {
       
    98         return iImpl->ResizeSurface(aSize);
       
    99         }
       
   100 
       
   101     /*!
       
   102      * @fn          SetConfiguration
       
   103      * @brief       sets surface/context/display configuration options
       
   104      * @param       aOption  name of the option
       
   105      * @param       aValue   value(s) for the option
       
   106      */
       
   107     void SetConfiguration(TInt aOption, const TAny* aValue)
       
   108         {
       
   109         return iImpl->SetConfiguration(aOption, aValue);
       
   110         }
       
   111     /*!
       
   112      * @fn          CopyBitmap(CFbsBitmap *aBitmap, CFbsBitmap *aMask, TInt aOption)
       
   113      * @brief       copies the bitmap from the surface to the given bitmap
       
   114      * @param       aDisplayMode    The display mode
       
   115      * @param       aBitmap The bitmap where the content will be copied
       
   116      * @param       aMask   Mask
       
   117      * @param       aOption Options, may be required for VGI calls
       
   118      */
       
   119     TInt CopyBitmap(TInt aDisplayMode,TInt aMaskMode,CFbsBitmap *aBitmap, CFbsBitmap *aMask, TSize aSize)
       
   120         {
       
   121         return iImpl->CopyBitmap(aDisplayMode,aMaskMode, aBitmap, aMask, aSize);
       
   122         }
       
   123  
       
   124     /**
       
   125      * @fn          PrepareToBindClientBuffer
       
   126      *              Prepares the renderer to bind to an image. 
       
   127      *              This is added to allow some performance improvement the TLV renderer
       
   128      *              This method should be called before creating the VGImage, which should be made as the surface.
       
   129      *              No other image should be created after calling this function
       
   130      */
       
   131     TInt PrepareToBindClientBuffer()
       
   132         {
       
   133         return iImpl->PrepareToBindClientBuffer();
       
   134         }
       
   135     /*!
       
   136      * @fn          BindSurfaces(TInt buffer)
       
   137      * @brief       This function is used for Binding Off-Screen Rendering Surfaces To Client Buffers
       
   138      * @param       buffer is a client API reference to the buffer to be bound. buffer must be a valid VGImage handle.
       
   139      * @return      0 if success
       
   140      */
       
   141     TInt BindClientBuffer(TInt buffer)
       
   142         {
       
   143         return iImpl->BindClientBuffer(buffer);
       
   144         }
       
   145     
       
   146     /*!
       
   147      * @fn          UnbindSurface(TInt surface)
       
   148      * @brief       copies the bitmap from the surface to the given bitmap
       
   149      * @param       aBitmap The bitmap where the content will be copied
       
   150      * @param       aMask   Mask
       
   151      * @param       aOption Options, may be required for VGI calls
       
   152      * @return      0 if success
       
   153      */
       
   154     TInt UnBindClientBuffer()
       
   155         {
       
   156         return iImpl->UnBindClientBuffer();
       
   157         }
       
   158     /*!
       
   159      * @fn          TerminateSurface()
       
   160      * @brief       Will destroy the surface
       
   161      */
       
   162     void TerminateSurface()
       
   163         {
       
   164         iImpl->TerminateSurface();
       
   165         }
       
   166 
       
   167 
       
   168 private:
       
   169 
       
   170     CVGSurface();
       
   171 
       
   172     /**
       
   173      * default constructor for performing 2nd stage construction
       
   174      */
       
   175     void ConstructL(MVGSurfaceImpl *aVGSurfaceImpl);
       
   176 
       
   177     MVGSurfaceImpl  *iImpl;
       
   178     };
       
   179 
       
   180 #endif // VGSURFACE_H