uiacceltk/hitchcock/coretoolkit/inc/HuiRenderPlugin.h
changeset 0 15bf7259bb7c
equal deleted inserted replaced
-1:000000000000 0:15bf7259bb7c
       
     1 /*
       
     2 * Copyright (c) 2006-2007 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:   Definition of CHuiRenderPlugin, a base class for
       
    15 *                all rendering plugins / renderers.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 #ifndef __HUIRENDERPLUGIN_H__
       
    23 #define __HUIRENDERPLUGIN_H__
       
    24 
       
    25 
       
    26 #include <e32base.h>
       
    27 #include <bitdev.h>
       
    28 #include <uiacceltk/HuiMesh.h>
       
    29 
       
    30 #include "HuiRenderPluginBase.h"
       
    31 
       
    32 
       
    33 /* Forward declarations. */
       
    34 class MHuiRenderSurface;
       
    35 class CHuiEnv;
       
    36 class CHuiDisplay;
       
    37 class CHuiGc;
       
    38 class CHuiTexture;
       
    39 class THuiTextureHandle;
       
    40 class CHuiTextureManager;
       
    41 class THuiFontManager;
       
    42 class CHuiTextMesh;
       
    43 class CHuiCurvePath;
       
    44 class CHuiCanvasGc;
       
    45 
       
    46 class CHuiFxEngine;
       
    47 
       
    48 /**
       
    49  * Rendering plugin identifiers.
       
    50  */
       
    51 enum THuiRenderPluginId
       
    52     {
       
    53     /** BitGdi renderer for legacy systems. */
       
    54     EHuiRenderPluginBitgdi,
       
    55 
       
    56     /** OpenVG 1.0 renderer. */
       
    57     EHuiRenderPluginVg10,
       
    58 
       
    59     /** OpenGL ES 1.0 renderer. */
       
    60     EHuiRenderPluginGles10,
       
    61 
       
    62     /** OpenGL ES 1.1 renderer. */
       
    63     EHuiRenderPluginGles11,
       
    64 
       
    65     /** OpenGL ES 2.0 renderer. */
       
    66     EHuiRenderPluginGles20
       
    67     };
       
    68 
       
    69 
       
    70 /**
       
    71  * Specific rendering features allowed by a plugin.
       
    72  */
       
    73 enum THuiRenderPluginAllow
       
    74     {
       
    75     /** The rendering plugin supports 3D projection and allows visuals to use
       
    76         the 3D projection mode. */
       
    77     EHuiRenderPluginAllow3DProjection,
       
    78 
       
    79     /** The rendering plugin supports bilinear filtering without considerable
       
    80         performance penalty. */
       
    81     EHuiRenderPluginAllowBilinearFilter,
       
    82 
       
    83     /** The rendering plugin supports a multitexturing mode where two textures
       
    84         are interpolated by an arbitrary factor. */
       
    85     EHuiRenderPluginAllowTextureModeInterpolate,
       
    86     
       
    87     /** The rendering plugin allows using pBuffer surfaces for texture preloading */
       
    88     EHuiRenderPluginAllowPBufferSurfaces,
       
    89     
       
    90     /** The rendering plugin allows to preserve buffer content after 
       
    91         eglswapbuffers has been called */
       
    92     EHuiRenderPluginAllowSwapBufferPreserve,
       
    93     
       
    94     /** The rendering plugin allows using pBuffer surfaces for cached visual drawing */
       
    95     EHuiRenderPluginAllowVisualPBufferSurfaces
       
    96     };
       
    97 
       
    98 
       
    99 /**
       
   100  * The common base class for all Hitchcock rendering plugins (renderers).
       
   101  *
       
   102  * For example defines factory methods for creating render specific
       
   103  * implementations for toolkit's resources, such as meshes, graphics
       
   104  * context, textures and the texture manager.
       
   105  *
       
   106  * Rendering plugins are internal to the toolkit.
       
   107  */
       
   108 class CHuiRenderPlugin : public CHuiRenderPluginBase
       
   109     {
       
   110 public:
       
   111 
       
   112     /**
       
   113      * Destructor.
       
   114      */
       
   115     IMPORT_C virtual ~CHuiRenderPlugin();
       
   116 
       
   117 
       
   118     /* Methods. */
       
   119 
       
   120     /**
       
   121      * Determines the identifier of the renderer.
       
   122      */
       
   123     IMPORT_C THuiRenderPluginId Id() const;
       
   124 
       
   125     /**
       
   126      * Determines if the renderer allows the usage of a specific
       
   127      * rendering feature or technique.
       
   128      *
       
   129      * @param aAllow  Feature to check.
       
   130      *
       
   131      * @return True, if allowed.
       
   132      */
       
   133     IMPORT_C virtual TBool Allows(THuiRenderPluginAllow aAllow) const;
       
   134 
       
   135     /**
       
   136      * Creates a new rendering surface for a HUITK display.
       
   137      *
       
   138      * @param aDisplay  Display.
       
   139      */
       
   140     IMPORT_C virtual MHuiRenderSurface* CreateRenderSurfaceL(CHuiDisplay& aDisplay);
       
   141 
       
   142     /**
       
   143      * Creates a new instance of a HUITK graphics context.
       
   144      */
       
   145     IMPORT_C virtual CHuiGc* CreateGcL();
       
   146 
       
   147     /**
       
   148      * Creates a new instance of a texture manager.
       
   149      */
       
   150     IMPORT_C virtual CHuiTextureManager* CreateTextureManagerL(CHuiEnv& aEnv);
       
   151 
       
   152     /**
       
   153      * Creates a new instance of an effects engine.
       
   154      */
       
   155     IMPORT_C virtual CHuiFxEngine* CreateEffectsEngineL();
       
   156 
       
   157     /**
       
   158      * Creates a new instance of font manager. The created font manager instance has
       
   159      * to be freed by the caller. This is used to manage all font instances in Hitchcock UI Toolkit.
       
   160      */
       
   161     IMPORT_C virtual THuiFontManager* CreateFontManagerL() const;
       
   162     
       
   163     /**
       
   164      * Creates a new instance of a texture.
       
   165      *
       
   166      * @param aExistingTexture  Handle to an existing named texture object.
       
   167      *                          The returned CHuiTexture will take ownership
       
   168      *                          of the handle's texture object.
       
   169      */
       
   170     IMPORT_C virtual CHuiTexture* CreateTextureL(const THuiTextureHandle* aExistingTexture = 0);
       
   171 
       
   172     /**
       
   173      * Creates a new instance of a texture, and pushes it on the cleanup stack.
       
   174      */
       
   175     IMPORT_C virtual CHuiTexture* CreateTextureLC(const THuiTextureHandle* aExistingTexture = 0);
       
   176 
       
   177     /**
       
   178      * Creates a new instance of a mesh.
       
   179      *
       
   180      * @param aMeshType  CHuiMesh derived concrete mesh type.
       
   181      *
       
   182      * @return  Concrete implementation of CHuiMesh.
       
   183      */
       
   184     IMPORT_C virtual CHuiMesh* CreateMeshL(THuiMeshType aMeshType);
       
   185 
       
   186     /**
       
   187      * Creates a new instance of a text mesh.
       
   188      */
       
   189     IMPORT_C virtual CHuiTextMesh* CreateTextMeshL() = 0;
       
   190 
       
   191     /**
       
   192      * Creates a new instance of a curve path.
       
   193      */
       
   194     IMPORT_C virtual CHuiCurvePath* CreateCurvePathL();
       
   195 
       
   196     /**
       
   197      * Deletes a named texture object. Named texture objects are owned
       
   198      * by the graphics API itself.
       
   199      */
       
   200     IMPORT_C virtual void DeleteNamedTexture(TUint aName);
       
   201 
       
   202     /**
       
   203      * Notifies this render plugin of a change in current display count.
       
   204      *
       
   205      * @param aCount The current count of displays existing in the HuiToolkit environment.
       
   206      */
       
   207     IMPORT_C virtual void NotifyDisplayCountL(TUint aCount);
       
   208 
       
   209     /**
       
   210      * Releases render plugin resources. Release all resources that can restored
       
   211      * later independently by render plugin. Might release for example render surfaces.
       
   212      *
       
   213      * The actual behaviour depends on the inherited class.
       
   214      *
       
   215      * @see RestoreL()
       
   216      */
       
   217     IMPORT_C virtual void Release();
       
   218 
       
   219     /**
       
   220      * Restores render plugin resources. Restores all resources released in Release().
       
   221      *
       
   222      * The actual behaviour depends on the inherited class.
       
   223      *
       
   224      * @see Release()
       
   225      */
       
   226     IMPORT_C virtual void RestoreL();
       
   227     
       
   228     /**
       
   229      * Enables off screen bitmap mode 
       
   230      */
       
   231     IMPORT_C virtual void EnableOffScreenBitmapL(TInt aFlags);
       
   232 
       
   233     /**
       
   234      * Disables off screen bitmap mode 
       
   235      */
       
   236     IMPORT_C virtual void DisableOffScreenBitmap();
       
   237 
       
   238     /**
       
   239      * Gets the pointer to off screen bitmap 
       
   240      */
       
   241     IMPORT_C virtual CFbsBitmap* OffScreenBitmap() const;
       
   242 	
       
   243     /**
       
   244      * Updates the latest frame to the off screen bitmap
       
   245      */
       
   246     IMPORT_C virtual void UpdateOffScreenBitmapL(CHuiDisplay& aDisplay);
       
   247 
       
   248     /**
       
   249      * Draws the off screen bitmap to the window
       
   250      */
       
   251     IMPORT_C virtual void DrawOffScreenBitmapToWindowL(CHuiDisplay& aDisplay);
       
   252 
       
   253     /**
       
   254      * Creates a new instance of a canvas graphics context.
       
   255      */
       
   256     IMPORT_C virtual CHuiCanvasGc* CreateCanvasGcL();
       
   257     
       
   258     /**
       
   259      * Adds flags to render plugin, which can be used e.g. in GC to determine
       
   260      * if the state has to be restored somehow. Each renderer has it's own flags 
       
   261      */
       
   262     IMPORT_C virtual void AddRestoreStateFlags(TInt aFlags);
       
   263     
       
   264     /**
       
   265      * Returns the changed state flags
       
   266      */
       
   267     IMPORT_C virtual TInt GetRestoreStateFlags();
       
   268     
       
   269     /**
       
   270      * Clears the state flags
       
   271      */
       
   272     IMPORT_C virtual void ClearRestoreStateFlags();
       
   273     
       
   274 protected:
       
   275 
       
   276     /* Constructors. */
       
   277 
       
   278     /**
       
   279      * Default constructor.
       
   280      */
       
   281     IMPORT_C CHuiRenderPlugin(THuiRenderPluginId aId);
       
   282 
       
   283 protected: // New methods
       
   284     
       
   285     /**
       
   286      * Provides expandability, helps keeping the binary compatibility. Since virtual
       
   287      * table is now exported and this class is dll derivable and the implementation
       
   288      * is more difficult to change, hence this method, which can provide additional
       
   289      * extension APIs.
       
   290      * 
       
   291      * @param aExtensionUid     UID, which is being used for recognizing the extension
       
   292      * @param aExtensionParams  Return pointer to the extension API, once recognized from the extension uid
       
   293      */
       
   294     IMPORT_C virtual void RenderPluginExtension(const TUid& aExtensionUid, TAny** aExtensionParams);
       
   295     
       
   296 private:
       
   297 
       
   298     /** Identifier of the plugin. */
       
   299     THuiRenderPluginId iId;
       
   300 
       
   301     /** Spare member to help keeping binary compatibility, since HuiRenderPlugin
       
   302         is now dll derivable **/
       
   303     TInt iSpare;
       
   304     };
       
   305 
       
   306 
       
   307 #endif // __HUIENV_H__