svgtopt/nvgdecoder/inc/nvgfittoviewbox.h
changeset 46 88edb906c587
equal deleted inserted replaced
-1:000000000000 46:88edb906c587
       
     1 /*
       
     2 * Copyright (c) 2008 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:  NVG Decoder header file
       
    15  *
       
    16 */
       
    17 
       
    18 #ifndef NVGFITTOVIEWBOX_H
       
    19 #define NVGFITTOVIEWBOX_H
       
    20 
       
    21  
       
    22 #include <e32std.h>
       
    23 #include <e32base.h>
       
    24 #include <VG/openvg.h>
       
    25 #include <nvg.h>
       
    26 
       
    27 
       
    28 class CNvgFitToViewBoxImpl:  public CBase
       
    29     {
       
    30 private:
       
    31     CNvgFitToViewBoxImpl();
       
    32      
       
    33      /**
       
    34           * @Purpose: 2 Phase Constructor
       
    35           * @Version
       
    36           * @parameter: None
       
    37           * @return: None
       
    38      */
       
    39      void ConstructL();
       
    40      
       
    41      /**
       
    42           * @Purpose: Destructor
       
    43           * @Version
       
    44           * @parameter: None
       
    45           * @return: None
       
    46      */
       
    47     public:
       
    48     
       
    49     /**
       
    50          * @Purpose: 2 Phase Constructor
       
    51          * @Version
       
    52          * @parameter: None
       
    53          * @return: None
       
    54     */
       
    55     static CNvgFitToViewBoxImpl*    NewL();
       
    56     
       
    57     /**
       
    58          * @Purpose: 2 Phase Constructor
       
    59          * @Version
       
    60          * @parameter: None
       
    61          * @return: None
       
    62     */
       
    63     static CNvgFitToViewBoxImpl*    NewLC();
       
    64     
       
    65     /**
       
    66          * @Purpose: Constructor
       
    67          * @Version
       
    68          * @parameter: None
       
    69          * @return: None
       
    70     */
       
    71  
       
    72     virtual ~CNvgFitToViewBoxImpl();
       
    73     
       
    74      /**
       
    75          * @Purpose: Setter function for viewbox    
       
    76          * @Version:    
       
    77          * @parameter:  TRect which will be the viewbox for the content
       
    78          * @return: None
       
    79     */
       
    80     inline void SetViewBox(TReal avbX, TReal avbY,TReal avbW,TReal avbH);
       
    81     
       
    82     /**
       
    83          * @Purpose: Setter function for Aligning
       
    84          * @Version
       
    85          * @parameter: Indicates to fit the viewport in the viewbox
       
    86          * @return: None
       
    87     */
       
    88     inline void SetAlign(TNvgAlignStatusType aAlignStatus);
       
    89     
       
    90     /**
       
    91          * @Purpose: Setter function for MeetorSlice
       
    92          * @Version
       
    93          * @parameter: Indicates whether to streach or slice the content
       
    94          * @return: None
       
    95     */
       
    96     inline void SetScaling(TNvgMeetOrSliceType aMeetSlice);    
       
    97     
       
    98     /**
       
    99          * @Purpose: Setter function for Transformation matrix
       
   100          * @Version
       
   101          * @parameter: The first two rows of the transformation matrix
       
   102          * @return: None
       
   103     */
       
   104     inline void SetTransform(TReal aM00,TReal aM01,TReal aM02,TReal aM10,TReal aM11,TReal aM12);
       
   105     
       
   106     
       
   107     /**
       
   108          * @Purpose: Update the transformation matrix for Translating the 
       
   109                      Contnet
       
   110          * @Version
       
   111          * @parameter: Translation components by aX, aY 
       
   112                        coordinates
       
   113          * @return: None
       
   114     */
       
   115     inline void Translate(TReal aX, TReal aY);
       
   116     
       
   117     /**
       
   118          * @Purpose: Update the transformation matrix for 
       
   119                      Scaling the Contnet
       
   120          * @Version
       
   121          * @parameter: Scaling factors Sx, Sy
       
   122          * @return: None
       
   123     */
       
   124     inline void Scale(TReal aX, TReal aY);
       
   125     
       
   126    /**
       
   127          * @Purpose: Calculating the transfomation matrix to 
       
   128                      carry out the viewport to viewbox 
       
   129                      transformation
       
   130          * @Version
       
   131          * @parameter: The viewport which is to be transformed
       
   132                        If viewbox is not defined, set the size of the viewbox 
       
   133          * @return: None
       
   134     */
       
   135     void SetWindowViewportTrans( TRect aViewPort, TSize aSize );
       
   136     
       
   137         
       
   138     void Concatenate(TReal aMatrix[]);
       
   139         
       
   140     void Concatenate(TReal aM00, TReal aM01, TReal aM02, TReal aM10, TReal aM11, TReal aM12);
       
   141 
       
   142 public:        
       
   143     // viewbox to viewport transformation matrix
       
   144     TReal iM00;
       
   145     TReal iM01;
       
   146     TReal iM02;
       
   147     TReal iM10;
       
   148     TReal iM11;
       
   149     TReal iM12;
       
   150     
       
   151     //The viewBox onto which the content will be drawn
       
   152     TReal   ivbX;
       
   153     TReal   ivbY;
       
   154     TReal   ivbW;
       
   155     TReal   ivbH;
       
   156     
       
   157     //Indicate that the content has a viewbox defined
       
   158     TBool iViewBoxDefined;
       
   159     
       
   160     //Define how to fit the content into the viewport
       
   161     TNvgAlignStatusType iAlign;
       
   162     
       
   163     //Weather to streach or clip the content to fit it into the viewbox       |
       
   164     TNvgMeetOrSliceType iMeetSlice;
       
   165     };
       
   166     
       
   167 #include "nvgfittoviewbox.inl"
       
   168 #endif
       
   169 //----------------------------EndOfFile-----------------------