svgtopt/gfx2d/inc/GfxImageTransformer.h
changeset 0 d46562c3d99d
equal deleted inserted replaced
-1:000000000000 0:d46562c3d99d
       
     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 header file
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef GFXIMAGETRANSFORMER_H
       
    20 #define GFXIMAGETRANSFORMER_H
       
    21 
       
    22 #include <e32std.h>
       
    23 #include <fbs.h>
       
    24 #include <bitstd.h>
       
    25 
       
    26 #include "GfxFloatFixPt.h"
       
    27 #include "GfxAffineTransform.h"
       
    28 #include "GfxRenderingHints.h"
       
    29 #include "GfxRectangle2D.h"
       
    30 #include "GfxPoint2D.h"
       
    31 #include "GfxColor.h"
       
    32 
       
    33 
       
    34 class CVGRenderer;
       
    35 
       
    36 /**
       
    37  * Class to perform transformation on an image.
       
    38  *
       
    39  *  @lib Gfx2D.lib
       
    40  *  @since 1.0
       
    41  */
       
    42 class TGfxImageTransformer
       
    43     {
       
    44     public:
       
    45 
       
    46         /**
       
    47          * Contructor.
       
    48          *
       
    49          * @since 1.0
       
    50          * @param aTransform : transform to apply.
       
    51          * @param aInterpolation : image interpolation
       
    52          * @return
       
    53          */
       
    54                             TGfxImageTransformer( TGfxAffineTransform* aTransform, CVGRenderer * aRenderer);
       
    55 
       
    56 
       
    57         /**
       
    58          * Draw the source image onto the destination with the transformation defined by
       
    59          * this object, blending with the alpha value.
       
    60          *
       
    61          * @since 1.0
       
    62          * @param aSrc : source image
       
    63          * @param aPoint : origin point of the text rectangle.
       
    64          * @param aDst : destination image buffer.
       
    65          * @param aDstWidth : destination image width.
       
    66          * @param aDstHeight : destination image height.
       
    67          * @param aAlpha : blending alpha value.
       
    68          * @param aClipRect :
       
    69          * @param aReverse : ETrue if copying image from aDst to aSrc.
       
    70          *                   This is a special case and used to copy background image to text box.
       
    71          *                   EFalse is for regular use.
       
    72          * @return
       
    73          */
       
    74          void               Draw( CFbsBitmap* aSrc,
       
    75                                           const TGfxPoint2D& p,
       
    76 										  TUint32* aDst,
       
    77 										  TInt aDstWidth,
       
    78 										  TInt aDstHeight,
       
    79 										  TUint8 aAlpha,
       
    80                                           TGfxColor aTransparentColor,
       
    81 										  const TRect& aClipRect,
       
    82 										  TBool aReverse = EFalse
       
    83 										  );
       
    84 
       
    85         /**
       
    86          * Draw the source image onto the destination with the transformation defined by
       
    87          * this object.  Uses the alpha bits of the EColor16MU to blend.  Only EColor16MU mode
       
    88          * for aSrc is allowed.
       
    89          *
       
    90          * @since 1.0
       
    91          * @param aSrc : source image
       
    92          * @param aPoint : origin point of the text rectangle.
       
    93          * @param aDst : destination image buffer.
       
    94          * @param aDstWidth : destination image width.
       
    95          * @param aDstHeight : destination image height.
       
    96          * @param aClipRect :
       
    97          * @param aReverse : ETrue if copying image from aDst to aSrc.
       
    98          *                   This is a special case and used to copy background image to text box.
       
    99          *                   EFalse is for regular use.
       
   100          * @return
       
   101          */
       
   102          void               Draw( CFbsBitmap* aSrc,
       
   103                                           const TGfxPoint2D& p,
       
   104 										  TUint32* aDst,
       
   105 										  TInt aDstWidth,
       
   106 										  TInt aDstHeight,
       
   107 										  const TRect& aClipRect
       
   108 										  );
       
   109 
       
   110 
       
   111         /**
       
   112          * Get the bounding box for the given image once transformed.
       
   113          *
       
   114          * @since 1.0
       
   115          * @param aSrc : source image
       
   116          * @param aOffset : offset.
       
   117          * @return
       
   118          */
       
   119          TGfxRectangle2D    GetTransformedBound( CFbsBitmap* aSrc,
       
   120                                                          const TGfxPoint2D& aOffset );
       
   121         /**
       
   122          * Draw the source image onto the destination with the transformation defined by
       
   123          * this object, blending with the alpha value. When aReverse is ETrue, do the reverse.
       
   124          *
       
   125          * @since 1.0
       
   126          * @param aSrc : source image
       
   127          * @param aPoint : origin point of the text rectangle.
       
   128          * @param aDstWidth : destination image width.
       
   129          * @param aDstHeight : destination image height.
       
   130          * @param aClipRect :
       
   131          * @param aReverse : ETrue if copying image from aDst to aSrc.
       
   132          *                   This is a special case and used to copy background image to text box.
       
   133          *                   EFalse is for regular use.
       
   134          * @return
       
   135          */
       
   136          void       ImageBlend( CFbsBitmap* aSrc,
       
   137                                           const TGfxPoint2D& p,
       
   138 										  TInt aDstWidth,
       
   139 										  TInt aDstHeight,
       
   140 										  const TRect& aClipRect,
       
   141 										  TBool aReverse = EFalse
       
   142 										  );
       
   143 
       
   144         /**
       
   145          * Compute scanline starting/end position for the rectangle.
       
   146          *
       
   147          * @since 1.0
       
   148          * @param y : current rectangle's height
       
   149          * @param rect : rectangle that needs to be computed.
       
   150          * @param north : transformed corner.
       
   151          * @param west :  transformed corner.
       
   152          * @param east :  transformed corner.
       
   153          * @param south :  transformed corner.
       
   154          * @param xstart : computed x coordinates for start position
       
   155          * @param xend : computed x coordinates for end position
       
   156          *
       
   157          * @return none
       
   158          */
       
   159         void ComputeXPositions(TFloatFixPt y, TRect rect, TGfxPoint2D north, TGfxPoint2D west,
       
   160             TGfxPoint2D east, TGfxPoint2D south, TInt& xstart, TInt& xend);
       
   161 
       
   162         /**
       
   163          * compute coordinates from transformed 4 points.
       
   164          *
       
   165          * @since 1.0
       
   166          *
       
   167          * @return none
       
   168          */
       
   169         void SortCoordinates(TGfxPoint2D& origin, TGfxPoint2D& top,
       
   170             TGfxPoint2D& north, TGfxPoint2D& south, TGfxPoint2D& right,
       
   171             TGfxPoint2D& east, TGfxPoint2D& west, TGfxPoint2D& corner,
       
   172             TGfxPoint2D aP, const TInt srcWidth, const TInt srcHeight);
       
   173 
       
   174     private:
       
   175 
       
   176         TGfxAffineTransform*        iTransform;
       
   177         CVGRenderer *           iVgRenderer;
       
   178     };
       
   179 
       
   180 #endif      // GFXIMAGETRANSFORMER_H