svgtopt/gfx2d/src/GfxGeom/GfxRectangle2D.cpp
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 source file
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "GfxRectangle2D.h"
       
    20 #include "GfxRectangleIteratorP.h"
       
    21 
       
    22 
       
    23 // ---------------------------------------------------------------------------
       
    24 // Constructor
       
    25 // ---------------------------------------------------------------------------
       
    26 // --------------------------------------------------------------------------
       
    27 //  TGfxRectangle2D::TGfxRectangle2D()
       
    28 // ---------------------------------------------------------------------------
       
    29  TGfxRectangle2D::TGfxRectangle2D()
       
    30     {
       
    31     }
       
    32 
       
    33 // --------------------------------------------------------------------------
       
    34 //  TGfxRectangle2D::TGfxRectangle2D( const TFloatFixPt& aX,
       
    35 // ---------------------------------------------------------------------------
       
    36  TGfxRectangle2D::TGfxRectangle2D( const TFloatFixPt& aX,
       
    37                                            const TFloatFixPt& aY,
       
    38                                            const TFloatFixPt& aWidth,
       
    39                                            const TFloatFixPt& aHeight )
       
    40     : TGfxRectangularShape( aX,
       
    41                             aY,
       
    42                             aWidth,
       
    43                             aHeight )
       
    44     {
       
    45     }
       
    46 
       
    47 // --------------------------------------------------------------------------
       
    48 //  TGfxRectangle2D::TGfxRectangle2D( const TGfxRectangle2D& aRect )
       
    49 // ---------------------------------------------------------------------------
       
    50  TGfxRectangle2D::TGfxRectangle2D( const TGfxRectangle2D& aRect )
       
    51 	:TGfxRectangularShape(aRect.iX,
       
    52 							aRect.iY,
       
    53 							aRect.iWidth,
       
    54 							aRect.iHeight)
       
    55 	{
       
    56     }
       
    57 
       
    58 // --------------------------------------------------------------------------
       
    59 //  TBool TGfxRectangle2D::Intersects( const TGfxRectangle2D& aRect )
       
    60 // ---------------------------------------------------------------------------
       
    61  TBool TGfxRectangle2D::Intersects( const TGfxRectangle2D& aRect )
       
    62     {
       
    63     return  ( !( aRect.iX + aRect.iWidth < iX ||
       
    64                  iX + iWidth < aRect.iX ||
       
    65                  aRect.iY + aRect.iHeight < iY ||
       
    66                  iY + iHeight < aRect.iY ) );
       
    67     }
       
    68 
       
    69 // --------------------------------------------------------------------------
       
    70 //  TBool TGfxRectangle2D::Contains( TGfxPoint2D aPoint )
       
    71 // ---------------------------------------------------------------------------
       
    72  TBool TGfxRectangle2D::Contains( TGfxPoint2D aPoint )
       
    73     {
       
    74     return ( iX <= aPoint.iX &&
       
    75              aPoint.iX <= ( iX + iWidth ) &&
       
    76              iY <= aPoint.iY &&
       
    77              aPoint.iY <= ( iY + iHeight ) );
       
    78     }
       
    79 
       
    80 
       
    81 // --------------------------------------------------------------------------
       
    82 //  void TGfxRectangle2D::GetPathIteratorL( TGfxAffineTransform* aAt,
       
    83 // ---------------------------------------------------------------------------
       
    84  void TGfxRectangle2D::GetPathIteratorL( TGfxAffineTransform* aAt,
       
    85                                                  CGfxPathIterator*& aPitr )
       
    86     {
       
    87     aPitr = new ( ELeave ) CGfxRectangleIteratorP( this, aAt );
       
    88     }
       
    89 
       
    90 // --------------------------------------------------------------------------
       
    91 //  void TGfxRectangle2D::GetPathIteratorL( TGfxAffineTransform* aAt,
       
    92 // ---------------------------------------------------------------------------
       
    93  void TGfxRectangle2D::GetPathIteratorL( TGfxAffineTransform* aAt,
       
    94                                                  TInt /* aLimit */,
       
    95                                                  CGfxPathIterator*& aPitr )
       
    96     {
       
    97     aPitr = new ( ELeave ) CGfxRectangleIteratorP( this, aAt );
       
    98     }
       
    99 
       
   100 // --------------------------------------------------------------------------
       
   101 //  void TGfxRectangle2D::operator==( const TGfxRectangle2D& aRect ) const;
       
   102 // ---------------------------------------------------------------------------
       
   103  TInt TGfxRectangle2D::operator==( const TGfxRectangle2D& aRect ) const
       
   104 {
       
   105 	return (iX == aRect.iX && iY == aRect.iY && iWidth == aRect.iWidth && iHeight == aRect.iHeight);
       
   106 }
       
   107 
       
   108 // --------------------------------------------------------------------------
       
   109 //  void TGfxRectangle2D::operator!=( const TGfxRectangle2D& aRect ) const;
       
   110 // ---------------------------------------------------------------------------
       
   111  TInt TGfxRectangle2D::operator!=( const TGfxRectangle2D& aRect ) const
       
   112 {
       
   113 	return (!(iX == aRect.iX && iY == aRect.iY && iWidth == aRect.iWidth && iHeight == aRect.iHeight));
       
   114 }