SkRegion Class Reference

#include <SkRegion.h>

Collaboration diagram for SkRegion:
Collaboration graph
[legend]

List of all members.

Classes

class  Cliperator
class  Iterator
class  Spanerator

Public Types

enum  { kRunTypeSentinel = 0x7FFFFFFF }
enum  Op {
  kDifference_Op, kIntersect_Op, kUnion_Op, kXOR_Op,
  kReverseDifference_Op, kReplace_Op
}
typedef int32_t RunType

Public Member Functions

 SkRegion ()
 SkRegion (const SkRegion &)
 SkRegion (const SkIRect &)
 ~SkRegion ()
SkRegionoperator= (const SkRegion &)
bool set (const SkRegion &src)
void swap (SkRegion &)
bool isEmpty () const
bool isRect () const
bool isComplex () const
const SkIRectgetBounds () const
bool getBoundaryPath (SkPath *path) const
bool setEmpty ()
bool setRect (const SkIRect &)
bool setRect (int32_t left, int32_t top, int32_t right, int32_t bottom)
bool setRegion (const SkRegion &)
bool setPath (const SkPath &, const SkRegion &clip)
bool intersects (const SkIRect &) const
bool intersects (const SkRegion &) const
bool contains (int32_t x, int32_t y) const
bool contains (const SkIRect &) const
bool contains (const SkRegion &) const
bool quickContains (const SkIRect &r) const
bool quickContains (int32_t left, int32_t top, int32_t right, int32_t bottom) const
bool quickReject (const SkIRect &rect) const
bool quickReject (const SkRegion &rgn) const
void translate (int dx, int dy)
void translate (int dx, int dy, SkRegion *dst) const
bool op (const SkIRect &rect, Op op)
bool op (int left, int top, int right, int bottom, Op op)
bool op (const SkRegion &rgn, Op op)
bool op (const SkIRect &rect, const SkRegion &rgn, Op)
bool op (const SkRegion &rgn, const SkIRect &rect, Op)
bool op (const SkRegion &rgna, const SkRegion &rgnb, Op op)
uint32_t flatten (void *buffer) const
uint32_t unflatten (const void *buffer)
 SkDEBUGCODE (void dump() const ;) SkDEBUGCODE(void validate() const
 SkDEBUGCODE (static void UnitTest();) SkDEBUGCODE(bool debugSetRuns(const RunType runs[]

Public Attributes

int count

Friends

class android::Region
struct RunHead
class Iterator
class Spanerator
class SkRgnBuilder
class SkFlatRegion
int operator== (const SkRegion &a, const SkRegion &b)
int operator!= (const SkRegion &a, const SkRegion &b)

Detailed Description

The SkRegion class encapsulates the geometric region used to specify clipping areas for drawing.

Definition at line 37 of file SkRegion.h.


Member Typedef Documentation

typedef int32_t SkRegion::RunType

Definition at line 39 of file SkRegion.h.


Member Enumeration Documentation

anonymous enum
Enumerator:
kRunTypeSentinel 

Definition at line 40 of file SkRegion.h.

The logical operations that can be performed when combining two regions.

Enumerator:
kDifference_Op 

subtract the op region from the first region

kIntersect_Op 

intersect the two regions

kUnion_Op 

union (inclusive-or) the two regions

kXOR_Op 

exclusive-or the two regions

kReverseDifference_Op 

subtract the first region from the op region

kReplace_Op 

replace the dst region with the op region

Definition at line 198 of file SkRegion.h.


Constructor & Destructor Documentation

SkRegion::SkRegion (  ) 
SkRegion::SkRegion ( const SkRegion  ) 
SkRegion::SkRegion ( const SkIRect  )  [explicit]
SkRegion::~SkRegion (  ) 

Member Function Documentation

bool SkRegion::contains ( const SkRegion  )  const

Return true if the specified region is completely inside the region. This works for simple (rectangular) and complex regions, and always returns the correct result. Note: if either region is empty, contains() returns false.

bool SkRegion::contains ( const SkIRect  )  const

Return true if the specified rectangle is completely inside the region. This works for simple (rectangular) and complex regions, and always returns the correct result. Note: if either this region or the rectangle is empty, contains() returns false.

bool SkRegion::contains ( int32_t  x,
int32_t  y 
) const

Return true if the specified x,y coordinate is inside the region.

uint32_t SkRegion::flatten ( void *  buffer  )  const

Write the region to the buffer, and return the number of bytes written. If buffer is NULL, it still returns the number of bytes.

bool SkRegion::getBoundaryPath ( SkPath path  )  const

Returns true if the region is non-empty, and if so, sets the specified path to the boundary(s) of the region.

const SkIRect& SkRegion::getBounds (  )  const [inline]

Return the bounds of this region. If the region is empty, returns an empty rectangle.

Definition at line 79 of file SkRegion.h.

bool SkRegion::intersects ( const SkRegion  )  const

Returns true if the specified region has a non-empty intersection with this region.

bool SkRegion::intersects ( const SkIRect  )  const

Returns true if the specified rectangle has a non-empty intersection with this region.

bool SkRegion::isComplex (  )  const [inline]

Return true if this region consists of more than 1 rectangular area

Definition at line 75 of file SkRegion.h.

bool SkRegion::isEmpty (  )  const [inline]

Return true if this region is empty

Definition at line 71 of file SkRegion.h.

bool SkRegion::isRect (  )  const [inline]

Return true if this region is a single, non-empty rectangle

Definition at line 73 of file SkRegion.h.

bool SkRegion::op ( const SkRegion rgna,
const SkRegion rgnb,
Op  op 
)

Set this region to the result of applying the Op to the specified regions: this = (rgna op rgnb). Return true if the resulting region is non-empty.

bool SkRegion::op ( const SkRegion rgn,
const SkIRect rect,
Op   
)

Set this region to the result of applying the Op to the specified region and rectangle: this = (rgn op rect). Return true if the resulting region is non-empty.

bool SkRegion::op ( const SkIRect rect,
const SkRegion rgn,
Op   
)

Set this region to the result of applying the Op to the specified rectangle and region: this = (rect op rgn). Return true if the resulting region is non-empty.

bool SkRegion::op ( const SkRegion rgn,
Op  op 
) [inline]

Set this region to the result of applying the Op to this region and the specified region: this = (this op rgn). Return true if the resulting region is non-empty.

Definition at line 228 of file SkRegion.h.

bool SkRegion::op ( int  left,
int  top,
int  right,
int  bottom,
Op  op 
) [inline]

Set this region to the result of applying the Op to this region and the specified rectangle: this = (this op rect). Return true if the resulting region is non-empty.

Definition at line 218 of file SkRegion.h.

bool SkRegion::op ( const SkIRect rect,
Op  op 
) [inline]

Set this region to the result of applying the Op to this region and the specified rectangle: this = (this op rect). Return true if the resulting region is non-empty.

Definition at line 212 of file SkRegion.h.

SkRegion& SkRegion::operator= ( const SkRegion  ) 
bool SkRegion::quickContains ( int32_t  left,
int32_t  top,
int32_t  right,
int32_t  bottom 
) const [inline]

Return true if this region is a single rectangle (not complex) and the specified rectangle is contained by this region. Returning false is not a guarantee that the rectangle is not contained by this region, but return true is a guarantee that the rectangle is contained by this region.

Definition at line 155 of file SkRegion.h.

bool SkRegion::quickContains ( const SkIRect r  )  const [inline]

Return true if this region is a single rectangle (not complex) and the specified rectangle is contained by this region. Returning false is not a guarantee that the rectangle is not contained by this region, but return true is a guarantee that the rectangle is contained by this region.

Definition at line 145 of file SkRegion.h.

bool SkRegion::quickReject ( const SkRegion rgn  )  const [inline]

Return true if this region, or rgn, is empty, or if their bounds do not intersect. Returning false is not a guarantee that they intersect, but returning true is a guarantee that they do not.

Definition at line 180 of file SkRegion.h.

bool SkRegion::quickReject ( const SkIRect rect  )  const [inline]

Return true if this region is empty, or if the specified rectangle does not intersect the region. Returning false is not a guarantee that they intersect, but returning true is a guarantee that they do not.

Definition at line 170 of file SkRegion.h.

bool SkRegion::set ( const SkRegion src  )  [inline]

Replace this region with the specified region, and return true if the resulting region is non-empty.

Definition at line 59 of file SkRegion.h.

bool SkRegion::setEmpty (  ) 

Set the region to be empty, and return false, since the resulting region is empty

bool SkRegion::setPath ( const SkPath ,
const SkRegion clip 
)

Set this region to the area described by the path, clipped. Return true if the resulting region is non-empty. This produces a region that is identical to the pixels that would be drawn by the path (with no antialiasing) with the specified clip.

bool SkRegion::setRect ( int32_t  left,
int32_t  top,
int32_t  right,
int32_t  bottom 
)

If left < right and top < bottom, set this region to that rectangle and return true, otherwise set this region to empty and return false.

bool SkRegion::setRect ( const SkIRect  ) 

If rect is non-empty, set this region to that rectangle and return true, otherwise set this region to empty and return false.

bool SkRegion::setRegion ( const SkRegion  ) 

Set this region to the specified region, and return true if it is non-empty.

SkRegion::SkDEBUGCODE ( static void UnitTest();   )  const
SkRegion::SkDEBUGCODE ( void dump() const ;   )  const
void SkRegion::swap ( SkRegion  ) 

Swap the contents of this and the specified region. This operation is gauarenteed to never fail.

void SkRegion::translate ( int  dx,
int  dy,
SkRegion dst 
) const

Translate the region by the specified (dx, dy) amount, writing the resulting region into dst. Note: it is legal to pass this region as the dst parameter, effectively translating the region in place. If dst is null, nothing happens.

void SkRegion::translate ( int  dx,
int  dy 
) [inline]

Translate the region by the specified (dx, dy) amount.

Definition at line 187 of file SkRegion.h.

uint32_t SkRegion::unflatten ( const void *  buffer  ) 

Initialized the region from the buffer, returning the number of bytes actually read.


Friends And Related Function Documentation

friend class android::Region [friend]

Definition at line 323 of file SkRegion.h.

friend class Iterator [friend]

Definition at line 344 of file SkRegion.h.

int operator!= ( const SkRegion a,
const SkRegion b 
) [friend]

Definition at line 52 of file SkRegion.h.

int operator== ( const SkRegion a,
const SkRegion b 
) [friend]
friend struct RunHead [friend]

Definition at line 343 of file SkRegion.h.

friend class SkFlatRegion [friend]

Definition at line 347 of file SkRegion.h.

friend class SkRgnBuilder [friend]

Definition at line 346 of file SkRegion.h.

friend class Spanerator [friend]

Definition at line 345 of file SkRegion.h.


Member Data Documentation

Definition at line 312 of file SkRegion.h.


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

Generated on Tue Oct 20 11:03:42 2009 for Skia by  doxygen 1.6.1