Asposecpplib
System::Drawing::Region Class Reference

Represents the interior of a graphic shape. Objects of this class should only be allocated using System::MakeObject() function. Never create instance of this type on stack or using operator new, as it will result in runtime errors and/or assertion faults. Always wrap this class into System::SmartPtr pointer and use this pointer to pass it to functions as argument. More...

Inherits System::Object.

Public Member Functions

 Region ()
 Constructs a new instance of Region class. More...
 
 Region (const RectangleF &rect)
 Constructs a new instance of Region class that represents a region defined by the specified rectangle. More...
 
 Region (const Rectangle &rect)
 Constructs a new instance of Region class that represents a region defined by the specified rectangle. More...
 
 Region (const SharedPtr< Drawing2D::GraphicsPath > &path)
 Constructs a new instance of Region class that represents a region defined by the specified path. More...
 
 Region (const SkPath &path)
 
 Region (const SharedPtr< Drawing2D::RegionData > &region_data)
 Constructs a new instance of Region class that represents a region defined by the specified RegionData object. More...
 
virtual ~Region ()
 Destructor. More...
 
ArrayPtr< RectangleFGetRegionScans (const SharedPtr< Drawing2D::Matrix > &matrix) const
 Returns an array of RectangleF structures that approximate this Region after the specified matrix transformation is applied. More...
 
RectangleF GetBounds (const SharedPtr< Graphics > &graphics) const
 Gets a RectangleF structure that represents a rectangle that bounds this Region on the drawing surface of a Graphics object. More...
 
void Union (const RectangleF &rect)
 Replaces the region represented by the current object with the result of union operation of this region and a region defined by the specified rectangle. More...
 
void Union (const Rectangle &rect)
 Replaces the region represented by the current object with the result of union of this region and a region defined by the specified rectangle. More...
 
void Union (const SharedPtr< Drawing2D::GraphicsPath > &path)
 Replaces the region represented by the current object with the result of union of this region and a region defined by the specified path. More...
 
void Union (const SharedPtr< Region > &region)
 Replaces the region represented by the current object with the result of union of this region and and the specified region. More...
 
SharedPtr< RegionClone () const
 Returns a copy of the current object. More...
 
void Intersect (const RectangleF &rect)
 Replaces the region represented by the current object with the result of intersection of this region and a region defined by the specified rectangle. More...
 
void Intersect (const Rectangle &rect)
 Replaces the region represented by the current object with the result of intersection of this region and a region defined by the specified rectangle. More...
 
void Intersect (const SharedPtr< Drawing2D::GraphicsPath > &path)
 Replaces the region represented by the current object with the result of intersection of this region and a region defined by the specified path. More...
 
void Intersect (const SharedPtr< Region > &region)
 Replaces the region represented by the current object with the result of intersection of this region and the specified region. More...
 
void Exclude (const RectangleF &rect)
 Replaces the region represented by the current object with the result of exclusion of the region defined by the specified rectange from it. More...
 
void Exclude (const Rectangle &rect)
 Replaces the region represented by the current object with the result of exclusion of the region defined by the specified rectange from it. More...
 
void Exclude (const SharedPtr< Drawing2D::GraphicsPath > &path)
 Replaces the region represented by the current object with the result of exclusion of the region defined by the specified path from it. More...
 
void Exclude (const SharedPtr< Region > &region)
 Replaces the region represented by the current object with the result of exclusion of the specified region from it. More...
 
void Translate (int dx, int dy)
 Moves the coordinates of the region by the specified amount. More...
 
void Translate (float dx, float dy)
 Moves the coordinates of the region by the specified amount. More...
 
void Transform (const SharedPtr< Drawing2D::Matrix > &matrix)
 Transforms this region by the specified matrix. More...
 
void Transform (const SkMatrix &matrix)
 Transforms this region by the specified matrix. More...
 
void Complement (const RectangleF &rect)
 Replaces the region represented by the current object with the portion of the region defined by the specified recangle that does not intersect with this region. More...
 
void Complement (const Rectangle &rect)
 Replaces the region represented by the current object with the portion of the region defined by the specified recangle that does not intersect with this region. More...
 
void Complement (const SharedPtr< Drawing2D::GraphicsPath > &path)
 Replaces the region represented by the current object with the portion of the region defined by the specified path that does not intersect with this region. More...
 
void Complement (const SharedPtr< Region > &region)
 Replaces the region represented by the current object with the portion of the specified region that does not intersect with this region. More...
 
void Xor (const RectangleF &rect)
 Replaces the region represented by the current object with the portions of this region and the region defined by the specified recangle that do not intersect. More...
 
void Xor (const Rectangle &rect)
 Replaces the region represented by the current object with the portions of this region and the region defined by the specified recangle that do not intersect. More...
 
void Xor (const SharedPtr< Drawing2D::GraphicsPath > &path)
 Replaces the region represented by the current object with the portions of this region and the region defined by the specified path that do not intersect. More...
 
void Xor (const SharedPtr< Region > &region)
 Replaces the region represented by the current object with the portions of this region and the specified region that do not intersect. More...
 
bool Equals (SharedPtr< Object > obj) override
 Compares the current and specified object using C# Object.Equals semantics. More...
 
bool Equals (const SharedPtr< Region > &r, const SharedPtr< Graphics > &g)
 Determines whether the specified region is identical to the region represented by the current object on the specified drawing surface. More...
 
bool IsEmpty (const SharedPtr< Graphics > &g) const
 Determines wheter the region represented by the current object has empty interior on the specified drawing surface. More...
 
bool IsInfinite (const SharedPtr< Graphics > &g) const
 Determines wheter the region represented by the current object has infinite interior on the specified drawing surface. More...
 
bool IsVisible (const Point &point) const
 Determines if the specified point is contained within the region represented by the current object. More...
 
bool IsVisible (const PointF &point) const
 Determines if the specified point is contained within the region represented by the current object. More...
 
bool IsVisible (const Rectangle &rect)
 Determines if any portion the specified rectangle is contained within the region represented by the current object. More...
 
bool IsVisible (const RectangleF &rect)
 Determines if any portion the specified rectangle is contained within the region represented by the current object. More...
 
bool IsVisible (const Point &point, const SharedPtr< Graphics > &graphics) const
 Determines if the specified point is contained within the region represented by the current object using the specified graphics. More...
 
bool IsVisible (const PointF &point, const SharedPtr< Graphics > &graphics) const
 Determines if the specified point is contained within the region represented by the current object using the specified graphics. More...
 
bool IsVisible (const Rectangle &rect, const SharedPtr< Graphics > &graphics)
 Determines if any portion the specified rectangle is contained within the region represented by the current object using the specified graphics. More...
 
bool IsVisible (const RectangleF &rect, const SharedPtr< Graphics > &graphics)
 Determines if any portion the specified rectangle is contained within the region represented by the current object using the specified graphics. More...
 
bool IsVisible (float x, float y) const
 Determines if the specified point is contained within the region represented by the current object. More...
 
bool IsVisible (float x, float y, const SharedPtr< Graphics > &graphics) const
 Determines if the specified point is contained within the region represented by the current object using the specified graphics. More...
 
void Dispose ()
 Releases all operating system resources acquired by the current object. More...
 
void MakeInfinite ()
 Initializes this region object to an infinite interior. More...
 
void MakeEmpty ()
 Initializes the current object to empty interior. More...
 
SharedPtr< Drawing2D::RegionDataGetRegionData () const
 Returns a RegionData object containing data that defines the region represented by the current object. More...
 
- Public Member Functions inherited from System::Object
 Object ()
 Creates object. Initializes all internal data structures. More...
 
virtual ~Object ()
 Destroys object. Frees all internal data structures. More...
 
 Object (Object const &x)
 Copy constructor. Doesn't copy anything, really, just initializes new object and enables copy constructing subclasses. More...
 
Objectoperator= (Object const &x)
 Assignment operator. Doesn't copy anything, really, just initializes new object and enables copy constructing subclasses. More...
 
ObjectSharedRefAdded ()
 Increments shared reference count. Shouldn't be called directly; instead, use smart pointers or ThisProtector. More...
 
int SharedRefRemovedSafe ()
 Decrements and returns shared reference count. Shouldn't be called directly; instead, use smart pointers or ThisProtector. More...
 
int RemovedSharedRefs (int count)
 Decreases shared reference count by specified value. More...
 
Detail::SmartPtrCounter * WeakRefAdded ()
 Increments weak reference count. Shouldn't be called directly; instead, use smart pointers or ThisProtector. More...
 
void WeakRefRemoved ()
 Decrements weak reference count. Shouldn't be called directly; instead, use smart pointers or ThisProtector. More...
 
Detail::SmartPtrCounter * GetCounter ()
 Gets reference counter data structure associated with the object. More...
 
int SharedCount () const
 Gets current value of shared reference counter. More...
 
void Lock ()
 Implements C# lock() statement locking. Call directly or use LockContext sentry object. More...
 
void Unlock ()
 Implements C# lock() statement unlocking. Call directly or use LockContext sentry object. More...
 
virtual bool Equals (ptr obj)
 Compares objects using C# Object.Equals semantics. More...
 
virtual int32_t GetHashCode () const
 Analog of C# Object.GetHashCode() method. Enables hashing of custom objects. More...
 
virtual String ToString () const
 Analog of C# Object.ToString() method. Enables converting custom objects to string. More...
 
virtual ptr MemberwiseClone () const
 Analog of C# Object.MemberwiseClone() method. Enables cloning custom types. More...
 
virtual const TypeInfoGetType () const
 Gets actual type of object. Analog of C# System.Object.GetType() call. More...
 
virtual bool Is (const TypeInfo &targetType) const
 Check if object represents an instance of type described by targetType. Analog of C# 'is' operator. More...
 
virtual void SetTemplateWeakPtr (uint32_t argument)
 Set n'th template argument a weak pointer (rather than shared). Allows switching pointers in containers to weak mode. More...
 
virtual bool FastCast (const Details::FastRttiBase &helper, void **out_ptr) const
 For internal purposes only. More...
 
template<>
bool ReferenceEquals (String const &str, std::nullptr_t)
 Specialization of Object::ReferenceEquals for case of string and nullptr. More...
 
template<>
bool ReferenceEquals (String const &str1, String const &str2)
 Specialization of Object::ReferenceEquals for case of strings. More...
 

Additional Inherited Members

- Public Types inherited from System::Object
typedef SmartPtr< Objectptr
 Alias for smart pointer type. More...
 
- Static Public Member Functions inherited from System::Object
static bool ReferenceEquals (ptr const &objA, ptr const &objB)
 Compares objects by reference. More...
 
template<typename T >
static std::enable_if<!IsSmartPtr< T >::value, bool >::type ReferenceEquals (T const &objA, T const &objB)
 Compares objects by reference. More...
 
template<typename T >
static std::enable_if<!IsSmartPtr< T >::value, bool >::type ReferenceEquals (T const &objA, std::nullptr_t)
 Reference-compares value type object with nullptr. More...
 
template<typename T1 , typename T2 >
static std::enable_if< IsSmartPtr< T1 >::value &&IsSmartPtr< T2 >::value, bool >::type Equals (T1 const &objA, T2 const &objB)
 Compares reference type objects in C# style. More...
 
template<typename T1 , typename T2 >
static std::enable_if<!IsSmartPtr< T1 >::value &&!IsSmartPtr< T2 >::value, bool >::type Equals (T1 const &objA, T2 const &objB)
 Compares value type objects in C# style. More...
 
static const TypeInfoType ()
 Implements C# typeof(System.Object) construct. More...
 
template<>
bool Equals (float const &objA, float const &objB)
 Emulates C#-style floating point comparison where two NaNs are considered equal even though according to IEC 60559:1989 NaN is not equal to any value, including NaN. More...
 
template<>
bool Equals (double const &objA, double const &objB)
 Emulates C#-style floating point comparison where two NaNs are considered equal even though according to IEC 60559:1989 NaN is not equal to any value, including NaN. More...
 

Detailed Description

Represents the interior of a graphic shape. Objects of this class should only be allocated using System::MakeObject() function. Never create instance of this type on stack or using operator new, as it will result in runtime errors and/or assertion faults. Always wrap this class into System::SmartPtr pointer and use this pointer to pass it to functions as argument.

Constructor & Destructor Documentation

◆ Region() [1/6]

System::Drawing::Region::Region ( )

Constructs a new instance of Region class.

◆ Region() [2/6]

System::Drawing::Region::Region ( const RectangleF rect)

Constructs a new instance of Region class that represents a region defined by the specified rectangle.

Parameters
rectA rectangle that defines the region

◆ Region() [3/6]

System::Drawing::Region::Region ( const Rectangle rect)

Constructs a new instance of Region class that represents a region defined by the specified rectangle.

Parameters
rectA rectangle that defines the region

◆ Region() [4/6]

System::Drawing::Region::Region ( const SharedPtr< Drawing2D::GraphicsPath > &  path)

Constructs a new instance of Region class that represents a region defined by the specified path.

Parameters
pathA path that defines the region

◆ Region() [5/6]

System::Drawing::Region::Region ( const SkPath &  path)

◆ Region() [6/6]

System::Drawing::Region::Region ( const SharedPtr< Drawing2D::RegionData > &  region_data)

Constructs a new instance of Region class that represents a region defined by the specified RegionData object.

Parameters
region_dataA RegionData object that defines the region

◆ ~Region()

virtual System::Drawing::Region::~Region ( )
virtual

Destructor.

Member Function Documentation

◆ Clone()

SharedPtr<Region> System::Drawing::Region::Clone ( ) const

Returns a copy of the current object.

◆ Complement() [1/4]

void System::Drawing::Region::Complement ( const Rectangle rect)

Replaces the region represented by the current object with the portion of the region defined by the specified recangle that does not intersect with this region.

Parameters
rectA rectangle that defines a region to complement

◆ Complement() [2/4]

void System::Drawing::Region::Complement ( const RectangleF rect)

Replaces the region represented by the current object with the portion of the region defined by the specified recangle that does not intersect with this region.

Parameters
rectA rectangle that defines a region to complement

◆ Complement() [3/4]

void System::Drawing::Region::Complement ( const SharedPtr< Drawing2D::GraphicsPath > &  path)

Replaces the region represented by the current object with the portion of the region defined by the specified path that does not intersect with this region.

Parameters
pathA path that defines a region to complement

◆ Complement() [4/4]

void System::Drawing::Region::Complement ( const SharedPtr< Region > &  region)

Replaces the region represented by the current object with the portion of the specified region that does not intersect with this region.

Parameters
regionA region to complement

◆ Dispose()

void System::Drawing::Region::Dispose ( )
inline

Releases all operating system resources acquired by the current object.

◆ Equals() [1/2]

bool System::Drawing::Region::Equals ( const SharedPtr< Region > &  r,
const SharedPtr< Graphics > &  g 
)

Determines whether the specified region is identical to the region represented by the current object on the specified drawing surface.

Parameters
rThe region to compare this region with
gA drawing surface
Returns
True if the interior of the specified region is identical to the interior of the region represented by the current objcet when the transformation associated with the g parameter is applied; otherwise - false

◆ Equals() [2/2]

bool System::Drawing::Region::Equals ( SharedPtr< Object obj)
override

Compares the current and specified object using C# Object.Equals semantics.

Parameters
objObject to compare current one to.
Returns
True if objects are considered equal and false otherwise.

◆ Exclude() [1/4]

void System::Drawing::Region::Exclude ( const Rectangle rect)

Replaces the region represented by the current object with the result of exclusion of the region defined by the specified rectange from it.

Parameters
rectA rectangle that defines a region to exclude

◆ Exclude() [2/4]

void System::Drawing::Region::Exclude ( const RectangleF rect)

Replaces the region represented by the current object with the result of exclusion of the region defined by the specified rectange from it.

Parameters
rectA rectangle that defines a region to exclude

◆ Exclude() [3/4]

void System::Drawing::Region::Exclude ( const SharedPtr< Drawing2D::GraphicsPath > &  path)

Replaces the region represented by the current object with the result of exclusion of the region defined by the specified path from it.

Parameters
pathA path that defines a region to exclude

◆ Exclude() [4/4]

void System::Drawing::Region::Exclude ( const SharedPtr< Region > &  region)

Replaces the region represented by the current object with the result of exclusion of the specified region from it.

Parameters
regionA region to exclude

◆ GetBounds()

RectangleF System::Drawing::Region::GetBounds ( const SharedPtr< Graphics > &  graphics) const

Gets a RectangleF structure that represents a rectangle that bounds this Region on the drawing surface of a Graphics object.

Parameters
graphicsThe Graphics on which this Region is drawn.

◆ GetRegionData()

SharedPtr<Drawing2D::RegionData> System::Drawing::Region::GetRegionData ( ) const

Returns a RegionData object containing data that defines the region represented by the current object.

◆ GetRegionScans()

ArrayPtr<RectangleF> System::Drawing::Region::GetRegionScans ( const SharedPtr< Drawing2D::Matrix > &  matrix) const

Returns an array of RectangleF structures that approximate this Region after the specified matrix transformation is applied.

Parameters
matrixA Matrix that represents a geometric transformation to apply to the region.

◆ Intersect() [1/4]

void System::Drawing::Region::Intersect ( const Rectangle rect)

Replaces the region represented by the current object with the result of intersection of this region and a region defined by the specified rectangle.

Parameters
rectA rectangle that defines a region to intersect this region with

◆ Intersect() [2/4]

void System::Drawing::Region::Intersect ( const RectangleF rect)

Replaces the region represented by the current object with the result of intersection of this region and a region defined by the specified rectangle.

Parameters
rectA rectangle that defines a region to intersect this region with

◆ Intersect() [3/4]

void System::Drawing::Region::Intersect ( const SharedPtr< Drawing2D::GraphicsPath > &  path)

Replaces the region represented by the current object with the result of intersection of this region and a region defined by the specified path.

Parameters
pathA path that defines a region to intersect this region with

◆ Intersect() [4/4]

void System::Drawing::Region::Intersect ( const SharedPtr< Region > &  region)

Replaces the region represented by the current object with the result of intersection of this region and the specified region.

Parameters
regionA region to intersect this region with

◆ IsEmpty()

bool System::Drawing::Region::IsEmpty ( const SharedPtr< Graphics > &  g) const

Determines wheter the region represented by the current object has empty interior on the specified drawing surface.

Parameters
gA drawing surface

◆ IsInfinite()

bool System::Drawing::Region::IsInfinite ( const SharedPtr< Graphics > &  g) const

Determines wheter the region represented by the current object has infinite interior on the specified drawing surface.

Parameters
gA drawing surface

◆ IsVisible() [1/10]

bool System::Drawing::Region::IsVisible ( const Point point) const

Determines if the specified point is contained within the region represented by the current object.

Parameters
pointThe point to check

◆ IsVisible() [2/10]

bool System::Drawing::Region::IsVisible ( const Point point,
const SharedPtr< Graphics > &  graphics 
) const

Determines if the specified point is contained within the region represented by the current object using the specified graphics.

Parameters
pointThe point to check
graphicsThe graphics context

◆ IsVisible() [3/10]

bool System::Drawing::Region::IsVisible ( const PointF point) const

Determines if the specified point is contained within the region represented by the current object.

Parameters
pointThe point to check

◆ IsVisible() [4/10]

bool System::Drawing::Region::IsVisible ( const PointF point,
const SharedPtr< Graphics > &  graphics 
) const

Determines if the specified point is contained within the region represented by the current object using the specified graphics.

Parameters
pointThe point to check
graphicsThe graphics context

◆ IsVisible() [5/10]

bool System::Drawing::Region::IsVisible ( const Rectangle rect)

Determines if any portion the specified rectangle is contained within the region represented by the current object.

Parameters
rectThe rectangle to check

◆ IsVisible() [6/10]

bool System::Drawing::Region::IsVisible ( const Rectangle rect,
const SharedPtr< Graphics > &  graphics 
)

Determines if any portion the specified rectangle is contained within the region represented by the current object using the specified graphics.

Parameters
rectThe rectangle to check
graphicsThe graphics context

◆ IsVisible() [7/10]

bool System::Drawing::Region::IsVisible ( const RectangleF rect)

Determines if any portion the specified rectangle is contained within the region represented by the current object.

Parameters
rectThe rectangle to check

◆ IsVisible() [8/10]

bool System::Drawing::Region::IsVisible ( const RectangleF rect,
const SharedPtr< Graphics > &  graphics 
)

Determines if any portion the specified rectangle is contained within the region represented by the current object using the specified graphics.

Parameters
rectThe rectangle to check
graphicsThe graphics context

◆ IsVisible() [9/10]

bool System::Drawing::Region::IsVisible ( float  x,
float  y 
) const

Determines if the specified point is contained within the region represented by the current object.

Parameters
xThe X coordinate of the point to check
yThe Y coordinate of the point to check

◆ IsVisible() [10/10]

bool System::Drawing::Region::IsVisible ( float  x,
float  y,
const SharedPtr< Graphics > &  graphics 
) const

Determines if the specified point is contained within the region represented by the current object using the specified graphics.

Parameters
xThe X coordinate of the point to check
yThe Y coordinate of the point to check
graphicsThe graphics context

◆ MakeEmpty()

void System::Drawing::Region::MakeEmpty ( )

Initializes the current object to empty interior.

◆ MakeInfinite()

void System::Drawing::Region::MakeInfinite ( )

Initializes this region object to an infinite interior.

◆ Transform() [1/2]

void System::Drawing::Region::Transform ( const SharedPtr< Drawing2D::Matrix > &  matrix)

Transforms this region by the specified matrix.

Parameters
matrixTransformation matrix

◆ Transform() [2/2]

void System::Drawing::Region::Transform ( const SkMatrix &  matrix)

Transforms this region by the specified matrix.

Parameters
matrixTransformation matrix

◆ Translate() [1/2]

void System::Drawing::Region::Translate ( float  dx,
float  dy 
)

Moves the coordinates of the region by the specified amount.

Parameters
dxSpecifies the amount to move the region by horizontally
dySpecifies the amount to move the region by vertically

◆ Translate() [2/2]

void System::Drawing::Region::Translate ( int  dx,
int  dy 
)

Moves the coordinates of the region by the specified amount.

Parameters
dxSpecifies the amount to move the region by horizontally
dySpecifies the amount to move the region by vertically

◆ Union() [1/4]

void System::Drawing::Region::Union ( const Rectangle rect)

Replaces the region represented by the current object with the result of union of this region and a region defined by the specified rectangle.

Parameters
rectA rectangle that defines a region to unite this region with

◆ Union() [2/4]

void System::Drawing::Region::Union ( const RectangleF rect)

Replaces the region represented by the current object with the result of union operation of this region and a region defined by the specified rectangle.

Parameters
rectA rectangle that defines a region to unite this region with

◆ Union() [3/4]

void System::Drawing::Region::Union ( const SharedPtr< Drawing2D::GraphicsPath > &  path)

Replaces the region represented by the current object with the result of union of this region and a region defined by the specified path.

Parameters
pathA path that defines a region to unite this region with

◆ Union() [4/4]

void System::Drawing::Region::Union ( const SharedPtr< Region > &  region)

Replaces the region represented by the current object with the result of union of this region and and the specified region.

Parameters
regionA region to unite this region with

◆ Xor() [1/4]

void System::Drawing::Region::Xor ( const Rectangle rect)

Replaces the region represented by the current object with the portions of this region and the region defined by the specified recangle that do not intersect.

Parameters
rectA rectangle that defines a region to xor with the region represented by the current object

◆ Xor() [2/4]

void System::Drawing::Region::Xor ( const RectangleF rect)

Replaces the region represented by the current object with the portions of this region and the region defined by the specified recangle that do not intersect.

Parameters
rectA rectangle that defines a region to xor with the region represented by the current object

◆ Xor() [3/4]

void System::Drawing::Region::Xor ( const SharedPtr< Drawing2D::GraphicsPath > &  path)

Replaces the region represented by the current object with the portions of this region and the region defined by the specified path that do not intersect.

Parameters
pathA path that defines a region to xor with the region represented by the current object

◆ Xor() [4/4]

void System::Drawing::Region::Xor ( const SharedPtr< Region > &  region)

Replaces the region represented by the current object with the portions of this region and the specified region that do not intersect.

Parameters
regionA region to xor with the region represented by the current object