OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
owl::TRegion Class Reference

TRegion, derived from TGdiObject, represents GDI abstract shapes or regions. More...

#include <owl/gdiobjec.h>

Inheritance diagram for owl::TRegion:
owl::TGdiBase

Public Types

enum  TEllipse { Ellipse }
 Defines the class-specific constant Ellipse, used to distinguish the ellipse constructor from the rectangle copy constructor. More...
 
typedef HRGN THandle
 TRegion encapsulates an HRGN.
 

Public Member Functions

 TRegion ()
 The default constructor creates an empty TRegion object.
 
 TRegion (HRGN handle, TAutoDelete autoDelete=NoAutoDelete)
 Creates a TRegion object and sets the Handle data member to the given borrowed handle.
 
 TRegion (const TRegion &region)
 This public copy constructor creates a copy of the given TRegion object as in:
 
 TRegion (const TRect &rect)
 Creates a region object from the given TRect object as in:
 
 TRegion (const TRect &e, TEllipse)
 Creates the elliptical TRegion object that inscribes the given rectangle E.
 
 TRegion (const TRect &rect, const TSize &corner)
 Creates a rounded rectangular TRegion object from the given rect corner.
 
 TRegion (const TPoint *points, int count, int fillMode)
 Creates a filled TRegion object from the polygons given by points and fillMode.
 
 TRegion (const TPoint *points, const int *polyCounts, int count, int fillMode)
 Creates a filled TRegion object from the poly-polygons given by points and fillMode.
 
template<size_t N>
 TRegion (const TPoint(&points)[N], int fillMode)
 Creates a filled TRegion object from the polygon given by an array of points and fillMode.
 
template<size_t N>
 TRegion (const TPoint *points, const int(&polyCounts)[N], int fillMode)
 Creates a filled TRegion object from the poly-polygons given by points and fillMode.
 
 ~TRegion ()
 
void SetRectRgn (const TRect &rect)
 Creates a rectangle of the size given by rect.
 
HRGN GetHandle () const
 Returns the handle of the region with type HREGION.
 
 operator HRGN () const
 Typecast operator.
 
auto Release () -> HRGN
 Returns the encapsulated handle of the region and relinquishes ownership.
 
bool operator== (const TRegion &other) const
 Returns true if the regions are identical (equal in size and shape).
 
bool operator!= (const TRegion &other) const
 Returns true if this region is not equal to the other region.
 
bool Contains (const TPoint &point) const
 Returns true if this region contains the given point.
 
bool Touches (const TRect &rect) const
 Returns true if this region touches the given rectangle.
 
int GetRgnBox (TRect &box) const
 Finds the bounding rectangle (the minimum rectangle containing this region).
 
TRect GetRgnBox () const
 Returns the bounding rectangle of the region.
 
TRegionoperator= (const TRegion &source)
 Assigns the source region to this region.
 
TRegionoperator+= (const TSize &delta)
 Adds the given delta to each point of this region to displace (translate) it by delta.x and delta.y.
 
TRegionoperator-= (const TSize &delta)
 Subtracts the given delta from each point of this region to displace (translate) it by -delta.x and -delta.y.
 
TRegionoperator-= (const TRegion &source)
 Creates a "difference" region consisting of all parts of this region that are not parts of the source region.
 
TRegionoperator&= (const TRegion &source)
 Creates the intersection of this region with the given source region and returns a reference to the result.
 
TRegionoperator&= (const TRect &source)
 Creates the intersection of this region with the given rectangle, and returns a reference to the result.
 
TRegionoperator|= (const TRegion &source)
 Creates the union of this region and the given source region , and returns a reference to the result.
 
TRegionoperator|= (const TRect &source)
 Creates the union of this region and the given rectangle, and returns a reference to the result.
 
TRegionoperator^= (const TRegion &source)
 Creates the exclusive-or of this region and the given source region.
 
TRegionoperator^= (const TRect &source)
 Creates the exclusive-or of this region and the given rectangle.
 

Detailed Description

TRegion, derived from TGdiObject, represents GDI abstract shapes or regions.

TRegion can construct region objects with various shapes. Several operators are provided for combining and comparing regions.

Definition at line 581 of file gdiobjec.h.

Member Typedef Documentation

◆ THandle

TRegion encapsulates an HRGN.

Definition at line 585 of file gdiobjec.h.

Member Enumeration Documentation

◆ TEllipse

Defines the class-specific constant Ellipse, used to distinguish the ellipse constructor from the rectangle copy constructor.

Enumerator
Ellipse 

Definition at line 596 of file gdiobjec.h.

Constructor & Destructor Documentation

◆ TRegion() [1/10]

owl::TRegion::TRegion ( )

The default constructor creates an empty TRegion object.

ShouldDelete is set to true.

Definition at line 26 of file region.cpp.

References owl::TGdiBase::CheckValid(), owl::TGdiBase::Handle, and WARNX.

◆ TRegion() [2/10]

owl::TRegion::TRegion ( HRGN handle,
TAutoDelete autoDelete = NoAutoDelete )

Creates a TRegion object and sets the Handle data member to the given borrowed handle.

The ShouldDelete data member defaults to false, ensuring that the borrowed handle is not deleted when the C++ object is destroyed. HRGN is the data type representing the handle to an abstract shape.

Definition at line 39 of file region.cpp.

◆ TRegion() [3/10]

owl::TRegion::TRegion ( const TRegion & source)

This public copy constructor creates a copy of the given TRegion object as in:

TRegion, derived from TGdiObject, represents GDI abstract shapes or regions.
Definition gdiobjec.h:581

Definition at line 51 of file region.cpp.

References owl::TGdiBase::CheckValid(), owl::TGdiBase::Handle, and WARNX.

◆ TRegion() [4/10]

owl::TRegion::TRegion ( const TRect & rect)

Creates a region object from the given TRect object as in:

TRegion()
The default constructor creates an empty TRegion object.
Definition region.cpp:26

Definition at line 67 of file region.cpp.

References owl::TGdiBase::CheckValid(), owl::TGdiBase::Handle, and WARNX.

◆ TRegion() [5/10]

owl::TRegion::TRegion ( const TRect & rect,
TRegion::TEllipse  )

Creates the elliptical TRegion object that inscribes the given rectangle E.

The TEllipse argument distinguishes this constructor from the TRegion(const TRect& rect) constructor.

Definition at line 79 of file region.cpp.

References owl::TGdiBase::CheckValid(), owl::TGdiBase::Handle, and WARNX.

◆ TRegion() [6/10]

owl::TRegion::TRegion ( const TRect & rect,
const TSize & corner )

Creates a rounded rectangular TRegion object from the given rect corner.

Definition at line 89 of file region.cpp.

References owl::TGdiBase::CheckValid(), owl::TGdiBase::Handle, and WARNX.

◆ TRegion() [7/10]

owl::TRegion::TRegion ( const TPoint * points,
int count,
int fillMode )

Creates a filled TRegion object from the polygons given by points and fillMode.

Definition at line 100 of file region.cpp.

◆ TRegion() [8/10]

owl::TRegion::TRegion ( const TPoint * points,
const int * polyCounts,
int count,
int fillMode )

Creates a filled TRegion object from the poly-polygons given by points and fillMode.

The 'points' argument should point into an array of points for all the polygons, and polyCounts should point into an array containing the number of points in each polygon. The 'count' argument should specify the number of polygons.

Definition at line 119 of file region.cpp.

◆ TRegion() [9/10]

template<size_t N>
owl::TRegion::TRegion ( const TPoint(&) points[N],
int fillMode )
inline

Creates a filled TRegion object from the polygon given by an array of points and fillMode.

Definition at line 607 of file gdiobjec.h.

◆ TRegion() [10/10]

template<size_t N>
owl::TRegion::TRegion ( const TPoint * points,
const int(&) polyCounts[N],
int fillMode )
inline

Creates a filled TRegion object from the poly-polygons given by points and fillMode.

The 'points' argument should point into an array of points for all the polygons, and polyCounts should contain the number of points in each polygon.

Definition at line 616 of file gdiobjec.h.

◆ ~TRegion()

owl::TRegion::~TRegion ( )

Member Function Documentation

◆ Contains()

bool owl::TRegion::Contains ( const TPoint & point) const
inline

Returns true if this region contains the given point.

Definition at line 1466 of file gdiobjec.h.

References GetHandle().

◆ GetHandle()

HRGN owl::TRegion::GetHandle ( ) const
inline

Returns the handle of the region with type HREGION.

Definition at line 1417 of file gdiobjec.h.

References owl::TGdiBase::Handle.

◆ GetRgnBox() [1/2]

TRect owl::TRegion::GetRgnBox ( ) const
inline

Returns the bounding rectangle of the region.

Definition at line 1494 of file gdiobjec.h.

References GetHandle(), and GetRgnBox().

◆ GetRgnBox() [2/2]

int owl::TRegion::GetRgnBox ( TRect & box) const
inline

Finds the bounding rectangle (the minimum rectangle containing this region).

The resulting rectangle is placed in box and the returned values are as follows:

  • COMPLEXREGION Region has overlapping borders.
  • NULLREGION Region is empty.
  • SIMPLEREGION Region has no overlapping borders.

Definition at line 1486 of file gdiobjec.h.

References GetHandle().

◆ operator HRGN()

owl::TRegion::operator HRGN ( ) const
inline

Typecast operator.

HRGN is the data type representing the handle to a physical region.

Definition at line 1435 of file gdiobjec.h.

◆ operator!=()

bool owl::TRegion::operator!= ( const TRegion & other) const
inline

Returns true if this region is not equal to the other region.

Definition at line 1458 of file gdiobjec.h.

References GetHandle().

◆ operator&=() [1/2]

TRegion & owl::TRegion::operator&= ( const TRect & source)

Creates the intersection of this region with the given rectangle, and returns a reference to the result.

Definition at line 148 of file region.cpp.

References TRegion(), and owl::TGdiBase::Handle.

◆ operator&=() [2/2]

TRegion & owl::TRegion::operator&= ( const TRegion & source)
inline

Creates the intersection of this region with the given source region and returns a reference to the result.

Definition at line 1545 of file gdiobjec.h.

References GetHandle().

◆ operator+=()

TRegion & owl::TRegion::operator+= ( const TSize & delta)
inline

Adds the given delta to each point of this region to displace (translate) it by delta.x and delta.y.

Returns a reference to the resulting region.

Definition at line 1515 of file gdiobjec.h.

References GetHandle().

◆ operator-=() [1/2]

TRegion & owl::TRegion::operator-= ( const TRegion & source)
inline

Creates a "difference" region consisting of all parts of this region that are not parts of the source region.

Returns a reference to the resulting region.

Definition at line 1535 of file gdiobjec.h.

References GetHandle().

◆ operator-=() [2/2]

TRegion & owl::TRegion::operator-= ( const TSize & delta)
inline

Subtracts the given delta from each point of this region to displace (translate) it by -delta.x and -delta.y.

Returns a reference to the resulting region.

Definition at line 1525 of file gdiobjec.h.

References GetHandle().

◆ operator=()

TRegion & owl::TRegion::operator= ( const TRegion & source)
inline

Assigns the source region to this region.

A reference to the result is returned, allowing chained assignments.

Definition at line 1505 of file gdiobjec.h.

References GetHandle().

◆ operator==()

bool owl::TRegion::operator== ( const TRegion & other) const
inline

Returns true if the regions are identical (equal in size and shape).

Definition at line 1450 of file gdiobjec.h.

References GetHandle().

◆ operator^=() [1/2]

TRegion & owl::TRegion::operator^= ( const TRect & source)

Creates the exclusive-or of this region and the given rectangle.

Returns a reference to the resulting region object.

Definition at line 170 of file region.cpp.

References TRegion(), and owl::TGdiBase::Handle.

◆ operator^=() [2/2]

TRegion & owl::TRegion::operator^= ( const TRegion & source)
inline

Creates the exclusive-or of this region and the given source region.

Returns a reference to the resulting region object.

Definition at line 1565 of file gdiobjec.h.

References GetHandle().

◆ operator|=() [1/2]

TRegion & owl::TRegion::operator|= ( const TRect & source)

Creates the union of this region and the given rectangle, and returns a reference to the result.

Definition at line 159 of file region.cpp.

References TRegion(), and owl::TGdiBase::Handle.

◆ operator|=() [2/2]

TRegion & owl::TRegion::operator|= ( const TRegion & source)
inline

Creates the union of this region and the given source region , and returns a reference to the result.

Definition at line 1555 of file gdiobjec.h.

References GetHandle().

◆ Release()

auto owl::TRegion::Release ( ) -> HRGN
inline

Returns the encapsulated handle of the region and relinquishes ownership.

Definition at line 1424 of file gdiobjec.h.

References PRECONDITION.

◆ SetRectRgn()

void owl::TRegion::SetRectRgn ( const TRect & rect)
inline

Creates a rectangle of the size given by rect.

Definition at line 1442 of file gdiobjec.h.

References GetHandle(), and SetRectRgn().

◆ Touches()

bool owl::TRegion::Touches ( const TRect & rect) const
inline

Returns true if this region touches the given rectangle.

Definition at line 1474 of file gdiobjec.h.

References GetHandle().


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