uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiTextureHandle.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 THuiTextureHandle. THuiTextureHandle is a 
       
    15 *                handle to a named texture object. It does not have ownership 
       
    16 *                of the texture object.
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 
       
    22 #ifndef __HUITEXTUREHANDLE_H__
       
    23 #define __HUITEXTUREHANDLE_H__
       
    24 
       
    25 
       
    26 #include <uiacceltk/HuiSegmentedTexture.h>
       
    27 #include <uiacceltk/HuiShadowedTexture.h>
       
    28 
       
    29 
       
    30 /**
       
    31  * Handle to a single-segment texture object. Only used for referencing existing
       
    32  * textures. Destroying the handle does not affect the texture object itself.
       
    33  */
       
    34 NONSHARABLE_CLASS(THuiTextureHandle) : public MHuiTexture, 
       
    35                           public MHuiSegmentedTexture
       
    36     {
       
    37 public:
       
    38 
       
    39     /** Constructors and destructor. */
       
    40 
       
    41     /** @beginAPI */
       
    42 
       
    43     /**
       
    44      * Constructor.
       
    45      */
       
    46     IMPORT_C THuiTextureHandle();
       
    47 
       
    48     /**
       
    49      * Constructs a texture handle.
       
    50      * @see Set()
       
    51      */
       
    52     IMPORT_C THuiTextureHandle(TUint aName,
       
    53                                const TSize& aSize,
       
    54                                const TSize& aTextureSize);
       
    55 
       
    56     
       
    57     /* Methods. */
       
    58     
       
    59     /**
       
    60      * Determines if this is a null handle.
       
    61      *
       
    62      * @return  ETrue, if this is a null handle.
       
    63      */
       
    64     IMPORT_C TBool IsNull() const;
       
    65     
       
    66     IMPORT_C TBool HasContent() const;
       
    67     
       
    68     /**
       
    69      * Releases the texture object that the handle references.
       
    70      */
       
    71     IMPORT_C void Release();
       
    72 
       
    73     /**
       
    74      * Sets the handle's texture name, logical size and texture size. This is
       
    75      * equivalent to calling SetName(), SetSize(), and SetTextureSize().
       
    76      *
       
    77      * @param aName  Assigns texture name of this handle. For example, with
       
    78      * OpenGL ES renderer, this will be the texture name generated
       
    79      * with glGenTextures().
       
    80      * @param aSize  The logical size of this texture.
       
    81      * @param aSize  The actual texture size of this texture.
       
    82      */
       
    83     IMPORT_C void Set(TUint aName, const TSize& aSize, const TSize& aTextureSize);
       
    84 
       
    85     /** 
       
    86      * Sets the name of the named texture object that this handle refers to. 
       
    87      *
       
    88      * @param aName  Name of the texture object.
       
    89      */
       
    90     IMPORT_C void SetName(TUint aName);
       
    91     
       
    92     /** 
       
    93      * Sets the logical size of the texture object this handle refers to.
       
    94      *
       
    95      * @param aSize  Logical size.
       
    96      */
       
    97     IMPORT_C void SetSize(const TSize& aSize);
       
    98     
       
    99     /** 
       
   100      * Sets the actual size of the texture object this handle refers to.
       
   101      * For example, with OpenGL ES, this is the size of the texture object
       
   102      * itself, which is limited to powers of two.
       
   103      *
       
   104      * @param aTextureSize  Texture size.
       
   105      */
       
   106     IMPORT_C void SetTextureSize(const TSize& aTextureSize);
       
   107     
       
   108     
       
   109 public:
       
   110 
       
   111     /* Implementation of MHuiTexture. */
       
   112     
       
   113     IMPORT_C virtual MHuiSegmentedTexture* SegmentedTexture();
       
   114 
       
   115     IMPORT_C virtual const MHuiSegmentedTexture* SegmentedTexture() const;
       
   116 
       
   117     IMPORT_C virtual MHuiShadowedTexture* ShadowedTexture();
       
   118 
       
   119     IMPORT_C virtual const MHuiShadowedTexture* ShadowedTexture() const;
       
   120 
       
   121 	IMPORT_C virtual TBool TextureChanged() const;
       
   122 	
       
   123 	IMPORT_C virtual void TextureClearChanged() const;    
       
   124 
       
   125     /* Implementation of MHuiSegmentedTexture. */
       
   126 
       
   127     IMPORT_C TUint Name() const;
       
   128     
       
   129     IMPORT_C TSize Size() const;
       
   130     
       
   131     IMPORT_C TInt SegmentCount() const;
       
   132 
       
   133     IMPORT_C TUint SegmentName(TInt aSegment) const;
       
   134 
       
   135     IMPORT_C TSize SegmentSize(TInt aSegment) const;
       
   136 
       
   137     IMPORT_C TSize SegmentTextureSize(TInt aSegment) const;
       
   138 
       
   139     IMPORT_C TPoint SegmentOffset(TInt aSegment) const;
       
   140 
       
   141 protected:
       
   142     
       
   143     IMPORT_C void TextureExtension(const TUid& aExtensionUid, TAny** aExtensionParameters);
       
   144     
       
   145 public:
       
   146 
       
   147     /** Name of the GL texture. */
       
   148     TUint iName;
       
   149 
       
   150     /** Logical size of this texture. */
       
   151     TSize iSize;
       
   152 
       
   153     /** Real size of the GL texture object. */
       
   154     TSize iTextureSize;
       
   155 
       
   156     };
       
   157 
       
   158 
       
   159 #endif // __HUITEXTUREHANDLE_H__