svgtopt/VGRenderer/PseudoVG/inc/PseodoVGRendererImpl.h
changeset 0 d46562c3d99d
child 22 9be6eed35a80
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:  CPseodoVGRendererImpl header file
       
    15  *
       
    16 */
       
    17 
       
    18 #ifndef PSEODOVGRENDERERIMPL_H
       
    19 #define PSEODOVGRENDERERIMPL_H
       
    20 
       
    21 // INCLUDES
       
    22 #include <e32std.h>
       
    23 #include <e32base.h>
       
    24 #include <VG/vgu.h>
       
    25 #include <platform/vg/vgcontext_symbian.h>
       
    26 
       
    27 #include "PseudoVG.h"
       
    28 #include "MVGRendererImpl.h"
       
    29 #include "NVGIconHeader.h"
       
    30 #ifdef VGRENDERER_LOG
       
    31 #include<flogger.h>   
       
    32 #endif
       
    33 
       
    34 /**
       
    35  *  CPseodoVGRendererImpl
       
    36  * 
       
    37  */
       
    38 class CPseodoVGRendererImpl : public CBase, public  MVGRendererImpl
       
    39     {
       
    40     static const TUint KMAJOR_VERSION;
       
    41     static const TUint KMINOR_VERSION;
       
    42     static const TUint KBUILD_VERSION;
       
    43     
       
    44 public:
       
    45     // Constructors and destructor
       
    46 
       
    47     /**
       
    48      * Destructor.
       
    49      */
       
    50     ~CPseodoVGRendererImpl();
       
    51 
       
    52     /**
       
    53      * Two-phased constructor.
       
    54      */
       
    55     static CPseodoVGRendererImpl* NewL();
       
    56 
       
    57     /**
       
    58      * Two-phased constructor.
       
    59      */
       
    60     static CPseodoVGRendererImpl* NewLC();
       
    61     
       
    62     virtual TVersion GetVersion() const;
       
    63     virtual const TDesC GetName() const;
       
    64     virtual void vgClear(TInt x, TInt y, TInt width, TInt height);
       
    65     virtual void vgSeti(TInt type, TInt value);
       
    66     virtual void vgSetf (TInt type, TReal32 value);
       
    67     virtual void vgSetfv(TInt type, TInt count, const TReal32 * values);
       
    68     virtual void vgSetiv(TInt type, TInt count, const TInt * values);
       
    69     virtual void vgSetParameteri(TUint handle, TInt paramType, TInt value);      
       
    70     virtual void vgSetParameterf(TUint handle,TInt paramType,TReal32 value);
       
    71     virtual void vgSetParameterfv(TUint object,TInt paramType,TInt count, const TReal32 * values);
       
    72     virtual TInt vgGeti(TInt type);                                                                    
       
    73     virtual void vgSetColor(TUint paint, TUint rgba);
       
    74     virtual void vgSetPaint(TUint paint, TUint paintModes);                        
       
    75     virtual TUint vgCreatePaint();
       
    76     virtual TUint vgCreatePath(TInt pathFormat, TInt datatype, TReal32 scale, TReal32 bias,
       
    77             TInt segmentCapacityHint, TInt coordCapacityHint, TInt capabilities);
       
    78     virtual void vgLoadMatrix(const TReal32 * m);
       
    79     virtual void vgMultMatrix(const TReal32 * m);
       
    80     virtual void vgLoadIdentity();
       
    81     virtual void vgScale(TReal32 sx, TReal32 sy);
       
    82     virtual void vgRotate(TReal32 angle);
       
    83     virtual void vgTranslate(TReal32 tx, TReal32 ty);
       
    84     virtual void vgReadPixels(void * data, TInt dataStride,TInt dataFormat,TInt sx, TInt sy,TInt width, TInt height);
       
    85     virtual void vgWritePixels(const void * data, TInt dataStride, TInt dataFormat,
       
    86                 TInt dx, TInt dy, TInt width, TInt height);
       
    87     virtual void vgAppendPathData(TUint path,TInt numSegments,
       
    88                                                 const TUint8 * pathSegments,
       
    89                                                 const void * pathData);                                  
       
    90     virtual void vgDrawPath(TUint path, TUint paintModes);
       
    91     virtual void vgClearPath(TUint path, TUint capabilities);
       
    92     virtual TInt vguRect(TUint path,
       
    93                                         TReal32 x, TReal32 y,
       
    94                                         TReal32 width, TReal32 height);
       
    95     virtual  TInt vguEllipse(TUint path,
       
    96                                            TReal32 cx, TReal32 cy,
       
    97                                            TReal32 width, TReal32 height);
       
    98     virtual TInt vguRoundRect(TUint path, TReal32 x, TReal32 y,
       
    99                                             TReal32 width, TReal32 height, TReal32 arcWidth, TReal32 arcHeight);
       
   100     virtual TInt vguLine(TUint path,TReal32 x0, TReal32 y0,TReal32 x1, TReal32 y1); 
       
   101     virtual void DumpToLogFile();
       
   102     virtual void CloseLogFile();    
       
   103     virtual TUint vgCreateImage(TInt format, TInt width, TInt height, TInt allowedQuality);
       
   104     virtual void vgGetPixels(TUint dst, TInt dx, TInt dy, TInt sx, TInt sy, TInt width, TInt height);        
       
   105     virtual void vgDrawImage(TUint image);
       
   106     virtual void vgClearImage(TUint image, TInt x, TInt y, TInt width, TInt height);
       
   107     virtual void vgImageSubData(TUint image, const void * data, TInt dataStride,
       
   108                 TInt dataFormat, TInt x, TInt y, TInt width, TInt height);
       
   109     virtual void vgMask(TUint mask, TInt operation, TInt x, TInt y, TInt width, TInt height);
       
   110     virtual void vgDestroyImage(TUint aHandle);
       
   111     virtual void vgDestroyPaint(TUint aHandle);        
       
   112     virtual void vgDestroyPath(TUint aHandle);
       
   113     virtual void ToggleReset();
       
   114     virtual void vgFlush();
       
   115     virtual TInt vgGetError();
       
   116     virtual MVGSurfaceImpl* CreateVGSurfaceL(TInt aOption);
       
   117     
       
   118     const TPtr8 GetEncodedData()
       
   119         {
       
   120         return iEncodedData->Des();
       
   121         }
       
   122     const TPtrC8 TLVEncodedData() const
       
   123             {
       
   124             const TPtr8 ptr=iEncodedData->Des();
       
   125             const TPtrC8 data(const_cast<unsigned char*>(ptr.Ptr()+ KIconHeaderLength), ptr.Length() - KIconHeaderLength);
       
   126             return data;
       
   127             }
       
   128     
       
   129     void EmptyEncodedData();
       
   130     TInt AddCommand(TInt aType, TUint8 * aValue, TInt aLength);
       
   131     void SetCommonHeader(const TDesC8& aHeader);
       
   132     void SetMaskFlag(TBool aVal = ETrue);
       
   133         
       
   134 private:
       
   135 
       
   136     /**
       
   137      * Constructor for performing 1st stage construction
       
   138      */
       
   139     CPseodoVGRendererImpl();
       
   140 
       
   141     /**
       
   142      * EPOC default constructor for performing 2nd stage construction
       
   143      */
       
   144     void ConstructL();
       
   145 
       
   146     void WriteHeader();
       
   147     
       
   148     TUint8 GetPathCoordianteSize(TUint8 aHandle);
       
   149     
       
   150     TInt EncodeInt8(TUint8 aVal);
       
   151     
       
   152     TInt EncodeInt16(TUint16 aVal);
       
   153     
       
   154     TInt EncodeInt32(TUint32 aVal);
       
   155     
       
   156     TInt EncodeReal32(TReal32 aVal);
       
   157     
       
   158     TInt EncodeReal64(TReal64 aVal);
       
   159     
       
   160     TInt EncodeData(const TAny *aData, TUint aLength);
       
   161     
       
   162     TInt ExpandEncodedData(TUint aNewLength);
       
   163     
       
   164     HBufC8 *            iEncodedData;
       
   165     TUint               iPaintHandleCount;
       
   166     TUint               iPathHandleCount;
       
   167     TUint               iHandle;
       
   168     static const TUint  ENCODEDDATALENGTH;
       
   169     static const TUint  ENCODEDDATAGRANULARITY;
       
   170     TInt                iCommonHeaderLength;
       
   171     const TUint8* iCommonHeader;
       
   172     
       
   173     //Command specific logging methods
       
   174 #ifdef VGRENDERER_LOG
       
   175     RFileLogger iLog;//logs    
       
   176     void LogvgSeti(VGParamType type, VGint fvalue,TInt cmdsize);
       
   177     void LogvgSetf (VGParamType type, VGfloat fvalue,TInt cmdsize);
       
   178     void LogvgSetParameteri(VGHandle handle, VGint paramType, VGint pvalue,TInt cmdsize,TInt Lpvalue);		
       
   179     void LogvgSetPaint(VGPaint paint, VGbitfield paintModes,TInt cmdsize,TInt Lpvalue);                        
       
   180     void LogvgDrawPath(VGbitfield paintModes,int cmdsize);
       
   181 #endif
       
   182     };
       
   183 
       
   184 #endif // PSEODOVGRENDERERIMPL_H