Classes | Public Member Functions | Static Public Member Functions | Friends

nsRegion Class Reference

Implementation of regions. More...

#include <nsRegion.h>

Collaboration diagram for nsRegion:

List of all members.

Classes

struct  nsRectFast
struct  RgnRect

Public Member Functions

 nsRegion ()
 nsRegion (const nsRect &aRect)
 nsRegion (const nsRegion &aRegion)
 ~nsRegion ()
nsRegionoperator= (const nsRect &aRect)
nsRegionoperator= (const nsRegion &aRegion)
nsRegionAnd (const nsRegion &aRgn1, const nsRegion &aRgn2)
nsRegionAnd (const nsRegion &aRegion, const nsRect &aRect)
nsRegionAnd (const nsRect &aRect, const nsRegion &aRegion)
nsRegionAnd (const nsRect &aRect1, const nsRect &aRect2)
nsRegionOr (const nsRegion &aRgn1, const nsRegion &aRgn2)
nsRegionOr (const nsRegion &aRegion, const nsRect &aRect)
nsRegionOr (const nsRect &aRect, const nsRegion &aRegion)
nsRegionOr (const nsRect &aRect1, const nsRect &aRect2)
nsRegionXor (const nsRegion &aRgn1, const nsRegion &aRgn2)
nsRegionXor (const nsRegion &aRegion, const nsRect &aRect)
nsRegionXor (const nsRect &aRect, const nsRegion &aRegion)
nsRegionXor (const nsRect &aRect1, const nsRect &aRect2)
nsRegionSub (const nsRegion &aRgn1, const nsRegion &aRgn2)
nsRegionSub (const nsRegion &aRegion, const nsRect &aRect)
nsRegionSub (const nsRect &aRect, const nsRegion &aRegion)
nsRegionSub (const nsRect &aRect1, const nsRect &aRect2)
PRBool Contains (const nsRect &aRect) const
PRBool Contains (const nsRegion &aRgn) const
PRBool Intersects (const nsRect &aRect) const
void MoveBy (PRInt32 aXOffset, PRInt32 aYOffset)
void MoveBy (nsPoint aPt)
void SetEmpty ()
PRBool IsEmpty () const
PRBool IsComplex () const
PRBool IsEqual (const nsRegion &aRegion) const
PRUint32 GetNumRects () const
const nsRectGetBounds () const
nsRegion ConvertAppUnitsRoundOut (PRInt32 aFromAPP, PRInt32 aToAPP) const
nsRegion ConvertAppUnitsRoundIn (PRInt32 aFromAPP, PRInt32 aToAPP) const
nsIntRegion ToOutsidePixels (nscoord aAppUnitsPerPixel) const
nsRect GetLargestRectangle (const nsRect &aContainingRect=nsRect()) const
 Gets the largest rectangle contained in the region.
void SimplifyOutward (PRUint32 aMaxRects)
 Make sure the region has at most aMaxRects by adding area to it if necessary.
void SimplifyInward (PRUint32 aMaxRects)
 Make sure the region has at most aMaxRects by removing area from it if necessary.
void SimpleSubtract (const nsRect &aRect)
 Efficiently try to remove a rectangle from this region.
void SimpleSubtract (const nsRegion &aRegion)
 Efficiently try to remove a region from this region.

Static Public Member Functions

static nsresult InitStatic ()
 Initialize any static data associated with nsRegion.
static void ShutdownStatic ()
 Deinitialize static data.

Friends

class nsRegionRectIterator
class RgnRectMemoryAllocator

Detailed Description

Implementation of regions.

A region is represented as circular double-linked list of nsRegion::RgnRect structures. Rectangles in this list do not overlap and are sorted by (y, x) coordinates.

nsRegions use nscoord coordinates and nsRects.


Constructor & Destructor Documentation

nsRegion::nsRegion (  )  [inline]
nsRegion::nsRegion ( const nsRect aRect  )  [inline]
nsRegion::nsRegion ( const nsRegion aRegion  )  [inline]
nsRegion::~nsRegion (  )  [inline]

Member Function Documentation

nsRegion& nsRegion::And ( const nsRegion aRgn1,
const nsRegion aRgn2 
)
nsRegion& nsRegion::And ( const nsRegion aRegion,
const nsRect aRect 
)
nsRegion& nsRegion::And ( const nsRect aRect,
const nsRegion aRegion 
) [inline]
nsRegion& nsRegion::And ( const nsRect aRect1,
const nsRect aRect2 
) [inline]
PRBool nsRegion::Contains ( const nsRect aRect  )  const
PRBool nsRegion::Contains ( const nsRegion aRgn  )  const
nsRegion nsRegion::ConvertAppUnitsRoundIn ( PRInt32  aFromAPP,
PRInt32  aToAPP 
) const
nsRegion nsRegion::ConvertAppUnitsRoundOut ( PRInt32  aFromAPP,
PRInt32  aToAPP 
) const
const nsRect& nsRegion::GetBounds (  )  const [inline]
nsRect nsRegion::GetLargestRectangle ( const nsRect aContainingRect = nsRect()  )  const

Gets the largest rectangle contained in the region.

Parameters:
aContainingRect if non-empty, we choose a rectangle that maximizes the area intersecting with aContainingRect (and break ties by then choosing the largest rectangle overall)
PRUint32 nsRegion::GetNumRects (  )  const [inline]
static nsresult nsRegion::InitStatic (  )  [static]

Initialize any static data associated with nsRegion.

PRBool nsRegion::Intersects ( const nsRect aRect  )  const
PRBool nsRegion::IsComplex (  )  const [inline]
PRBool nsRegion::IsEmpty (  )  const [inline]
PRBool nsRegion::IsEqual ( const nsRegion aRegion  )  const
void nsRegion::MoveBy ( PRInt32  aXOffset,
PRInt32  aYOffset 
) [inline]
void nsRegion::MoveBy ( nsPoint  aPt  ) 
nsRegion& nsRegion::operator= ( const nsRegion aRegion  )  [inline]
nsRegion& nsRegion::operator= ( const nsRect aRect  )  [inline]
nsRegion& nsRegion::Or ( const nsRect aRect,
const nsRegion aRegion 
) [inline]
nsRegion& nsRegion::Or ( const nsRegion aRegion,
const nsRect aRect 
)
nsRegion& nsRegion::Or ( const nsRect aRect1,
const nsRect aRect2 
) [inline]
nsRegion& nsRegion::Or ( const nsRegion aRgn1,
const nsRegion aRgn2 
)
void nsRegion::SetEmpty (  )  [inline]
static void nsRegion::ShutdownStatic (  )  [static]

Deinitialize static data.

void nsRegion::SimpleSubtract ( const nsRect aRect  ) 

Efficiently try to remove a rectangle from this region.

The actual area removed could be some sub-area contained by the rectangle (even possibly nothing at all).

We remove all rectangles that are contained by aRect.

void nsRegion::SimpleSubtract ( const nsRegion aRegion  ) 

Efficiently try to remove a region from this region.

The actual area removed could be some sub-area contained by aRegion (even possibly nothing at all).

We remove all rectangles of this region that are contained by a rectangle of aRegion.

void nsRegion::SimplifyInward ( PRUint32  aMaxRects  ) 

Make sure the region has at most aMaxRects by removing area from it if necessary.

The simplified region will be a subset of the original region.

void nsRegion::SimplifyOutward ( PRUint32  aMaxRects  ) 

Make sure the region has at most aMaxRects by adding area to it if necessary.

The simplified region will be a superset of the original region. The simplified region's bounding box will be the same as for the current region.

nsRegion& nsRegion::Sub ( const nsRect aRect,
const nsRegion aRegion 
) [inline]
nsRegion& nsRegion::Sub ( const nsRect aRect1,
const nsRect aRect2 
) [inline]
nsRegion& nsRegion::Sub ( const nsRegion aRgn1,
const nsRegion aRgn2 
)
nsRegion& nsRegion::Sub ( const nsRegion aRegion,
const nsRect aRect 
)
nsIntRegion nsRegion::ToOutsidePixels ( nscoord  aAppUnitsPerPixel  )  const
nsRegion& nsRegion::Xor ( const nsRect aRect1,
const nsRect aRect2 
) [inline]
nsRegion& nsRegion::Xor ( const nsRect aRect,
const nsRegion aRegion 
) [inline]
nsRegion& nsRegion::Xor ( const nsRegion aRegion,
const nsRect aRect 
)
nsRegion& nsRegion::Xor ( const nsRegion aRgn1,
const nsRegion aRgn2 
)

Friends And Related Function Documentation

friend class nsRegionRectIterator [friend]
friend class RgnRectMemoryAllocator [friend]

The documentation for this class was generated from the following file: