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