wx.Region

Inheritance diagram for wx.Region:



Description

A wx.Region represents a simple or complex region on a device context or window.

This class uses reference counting and copy-on-write internally so that assignments between two instances of this class are very cheap. You can therefore use actual objects instead of pointers without efficiency problems. If an instance of this class is changed it will create its own data internally so that other instances, which previously shared the data using the reference counting, are not affected.

Derived From

Properties Summary

Class API

Methods

__init__(x=0, y=0, width=0, height=0)

Constructs a rectangular region with the given position and size.

Parameters:

  • x (int)
  • y (int)
  • width (int)
  • height (int)

Returns:

wx.Region


Clear()
Clears the current region.

Contains(x, y)

Returns a value indicating whether the given point is contained within the region.

Parameters:

  • x (long)
  • y (long)

Returns:

int


ContainsPoint(pt)

Returns a value indicating whether the given point is contained within the region.

Parameters:


Returns:

int


ContainsRect(rect)

Returns a value indicating whether the given rectangle is contained within the region.

Parameters:


Returns:

int


ContainsRectDim(x, y, w, h)

Returns a value indicating whether the given point is contained within the region.

Parameters:

  • x (int)
  • y (int)
  • w (int)
  • h (int)

Returns:

int


ConvertToBitmap()

Convert the region to a black and white bitmap with the white pixels being inside the region.


Returns:

wx.Bitmap


GetBox()

Returns the outer bounds of the region.


Returns:

wx.Rect


Intersect(x, y, width, height)

Finds the intersection of this rectangle and another region.

Parameters:

  • x (int)
  • y (int)
  • width (int)
  • height (int)

Returns:

bool

Note

Creates the intersection of the two regions, that is, the parts which are in both regions. The result is stored in this region.


IntersectRect(rect)

Finds the intersection of this rectangle and another region.

Parameters:


Returns:

bool

Note

Creates the intersection of the two regions, that is, the parts which are in both regions. The result is stored in this region.


IntersectRegion(region)

Finds the intersection of this region and another region.

Parameters:


Returns:

bool

Note

Creates the intersection of the two regions, that is, the parts which are in both regions. The result is stored in this region.


IsEmpty()

Returns True if the region is empty, False otherwise.


Returns:

bool


IsEqual(region)

Returns True if the region is equal to, i.e. covers the same area as, another one.

Parameters:


Returns:

bool

Note

Note that if both this region and region are invalid, they are considered to be equal.


Offset(x, y)

Moves the region by the specified offsets in horizontal and vertical directions.

Parameters:

  • x (int)
  • y (int)

Returns:

bool


Subtract(x, y, width, height)

Subtracts a rectangle from this region.

Parameters:

  • x (int)
  • y (int)
  • width (int)
  • height (int)

Returns:

bool

Note

This operation combines the parts of ‘this’ region that are not part of the second region. The result is stored in this region.


SubtractRect(rect)

Subtracts a rectangle from this region.

Parameters:


Returns:

bool

Note

This operation combines the parts of ‘this’ region that are not part of the second region. The result is stored in this region.


SubtractRegion(region)

Subtracts a region from this region.

Parameters:


Returns:

bool

Note

This operation combines the parts of ‘this’ region that are not part of the second region. The result is stored in this region.


Union(x, y, width, height)

Finds the union of this region and another, rectangular region, specified using position and size.

Parameters:

  • x (int)
  • y (int)
  • width (int)
  • height (int)

Returns:

bool

Note

This operation creates a region that combines all of this region and the second region. The result is stored in this region.


UnionBitmap(bmp)

Finds the union of this region and the non-transparent pixels of a bitmap. Bitmap’s mask is used to determine transparency. If the bitmap doesn’t have a mask, solid rectangle of bitmap’s dimensions is used.

Parameters:


Returns:

bool

Note

This operation creates a region that combines all of this region and the second region. The result is stored in this region.


UnionBitmapColour(bmp, transColour, tolerance=0)

Finds the union of this region and the non-transparent pixels of a bitmap. Colour to be treated as transparent is specified in the transColour argument, along with an optional colour tolerance value.

Parameters:


Returns:

bool

Note

This operation creates a region that combines all of this region and the second region. The result is stored in this region.


UnionRect(rect)

Finds the union of this region and another, rectangular region.

Parameters:


Returns:

bool

Note

This operation creates a region that combines all of this region and the second region. The result is stored in this region.


UnionRegion(region)

Finds the union of this region and another region.

Parameters:


Returns:

bool

Note

This operation creates a region that combines all of this region and the second region. The result is stored in this region.


Xor(x, y, width, height)

Finds the Xor of this region and another region.

Parameters:

  • x (int)
  • y (int)
  • width (int)
  • height (int)

Returns:

bool

Note

This operation creates a region that combines all of this region and the second region, except for any overlapping areas. The result is stored in this region.


XorRect(rect)

Finds the Xor of this region and another, rectangular region.

Parameters:


Returns:

bool

Note

This operation creates a region that combines all of this region and the second region, except for any overlapping areas. The result is stored in this region.


XorRegion(region)

Finds the Xor of this region and another region.

Parameters:


Returns:

bool

Note

This operation creates a region that combines all of this region and the second region, except for any overlapping areas. The result is stored in this region.


Properties

Box
See GetBox