svgtopt/gfx2d/inc/GfxGradientPaint.h
changeset 46 88edb906c587
equal deleted inserted replaced
-1:000000000000 46:88edb906c587
       
     1 /*
       
     2 * Copyright (c) 2002 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:  Graphics Extension Library source file
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef GFXGRADIENTPAINT_H
       
    20 #define GFXGRADIENTPAINT_H
       
    21 
       
    22 #include <e32std.h>
       
    23 #include <fbs.h>
       
    24 
       
    25 #include "GfxPaint.h"
       
    26 #include "GfxAffineTransform.h"
       
    27 
       
    28 #include <VG/openvg.h>
       
    29 
       
    30 //
       
    31 #include "VGRenderer.h"
       
    32 const TUint16 KuserSpaceOnUse = 0;
       
    33 const TUint16 KobjectBoundingBox = 1;
       
    34 const TUint16 KspreadMethodPad = 0; //SVG_GRADIENT_PAD;
       
    35 const TUint16 KspreadMethodReflect = 1; //SVG_GRADIENT_REFLECT;
       
    36 const TUint16 KspreadMethodRepeat= 2; //SVG_GRADIENT_REPEAT;
       
    37 
       
    38 /**
       
    39  * This class holds stop color information for gradient.
       
    40  *
       
    41  *  @lib Gfx2D.lib
       
    42  *  @since 1.0
       
    43  */
       
    44 class TSvgStopData
       
    45 	{
       
    46 	public:
       
    47 		TFloatFixPt iOffset;
       
    48 		TUint32 iStopColor;
       
    49 		TFloatFixPt iStopOpacity;
       
    50 	};
       
    51 
       
    52 /**
       
    53  * This class provides the common properties and methods for linear and radial gradient.
       
    54  *
       
    55  *  @lib Gfx2D.lib
       
    56  *  @since 1.0
       
    57  */
       
    58 class TGfxGradientPaint : public MGfxPaint
       
    59     {
       
    60     public:
       
    61         /**
       
    62          * Constructor.
       
    63          *
       
    64          * @since 1.0
       
    65          * @return
       
    66          */
       
    67 		 TGfxGradientPaint();
       
    68 		 ~TGfxGradientPaint();
       
    69 
       
    70 
       
    71 
       
    72 
       
    73 		void SetFill(VGPaint aFillPaint, TGfxRectangle2D& aBBox, TFloatFixPt aOpacity,void* GfxContext);
       
    74 
       
    75 		TUint16 iGradientUnits;
       
    76 		TUint16 iSpreadMethod;
       
    77 		SVGMatrix2x3 iGradientTransform;
       
    78 		RArray<TSvgStopData>  *iStopData;
       
    79 
       
    80 		VGPaint	iFillPaint;
       
    81 
       
    82     };
       
    83 
       
    84 /**
       
    85  *
       
    86  *
       
    87  *  @lib Gfx2D.lib
       
    88  *  @since 1.0
       
    89  */
       
    90 class TGfxLinearGradientPaint : public TGfxGradientPaint
       
    91     {
       
    92     public:
       
    93         /**
       
    94          * Constructor.
       
    95          *
       
    96          * @since 1.0
       
    97          * @return
       
    98          */
       
    99          TGfxLinearGradientPaint();
       
   100     public:
       
   101         /**
       
   102          *
       
   103          *
       
   104          * @since 1.0
       
   105          * @param aRect : rectangle to iterator through.
       
   106          * @param aTransform : transform to apply.
       
   107          * @return
       
   108          */
       
   109         TUint32 GetColor() {return KGfxColorLinearGradient;}
       
   110 
       
   111 
       
   112 
       
   113 
       
   114 		 void SetFill(VGPaint aFillPaint, TGfxRectangle2D& aBBox, TFloatFixPt aOpacity,void* GfxContext);
       
   115 		TFloatFixPt iX1, iY1, iX2, iY2;
       
   116     };
       
   117 
       
   118 /**
       
   119  *
       
   120  *
       
   121  *  @lib Gfx2D.lib
       
   122  *  @since 1.0
       
   123  */
       
   124 class TGfxRadialGradientPaint : public TGfxGradientPaint
       
   125     {
       
   126     public:
       
   127         /**
       
   128          * Constructor.
       
   129          *
       
   130          * @since 1.0
       
   131          * @return
       
   132          */
       
   133          TGfxRadialGradientPaint();
       
   134 
       
   135         /**
       
   136          * Constructor.
       
   137          *
       
   138          * @since 1.0
       
   139          * @param aRect : rectangle to iterator through.
       
   140          * @param aTransform : transform to apply.
       
   141          * @return
       
   142          */
       
   143         TUint32 GetColor() {return KGfxColorRadialGradient;}
       
   144 
       
   145 
       
   146 
       
   147 
       
   148 		 void SetFill(VGPaint aFillPaint, TGfxRectangle2D& aBBox, TFloatFixPt aOpacity,void* GfxContext);
       
   149 		TFloatFixPt iCx, iCy, iR, iFx, iFy;
       
   150     };
       
   151 
       
   152 #endif /* GFXGRADIENTPAINT_H */