Class: Wx::Region

Inherits:
GDIObject show all
Defined in:
lib/wx/doc/gen/region.rb

Overview

Note:

This class is untracked and should not be derived from nor instances extended!

A 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. Predefined objects/pointers:

  • NullRegion

Category: Data Structures, Graphics Device Interface (GDI)

See Also:

Instance Method Summary collapse

Methods inherited from GDIObject

#clone, #dup

Methods inherited from Object

#clone, #dup, #is_same_as, #un_share

Constructor Details

#initializeWx::Region #initialize(x, y, width, height) ⇒ Wx::Region #initialize(topLeft, bottomRight) ⇒ Wx::Region #initialize(rect) ⇒ Wx::Region #initialize(region) ⇒ Wx::Region #initialize(points, fillStyle = Wx::PolygonFillMode::ODDEVEN_RULE) ⇒ Wx::Region #initialize(bmp) ⇒ Wx::Region #initialize(bmp, transColour, tolerance = 0) ⇒ Wx::Region

Returns a new instance of Region.

Overloads:

  • #initializeWx::Region

    Default constructor.

    This constructor creates an invalid, or null, object, i.e. calling IsOk() on it returns false and #is_empty returns true.

  • #initialize(x, y, width, height) ⇒ Wx::Region

    Constructs a rectangular region with the given position and size.

    Parameters:

    • x (Integer)
    • y (Integer)
    • width (Integer)
    • height (Integer)
  • #initialize(topLeft, bottomRight) ⇒ Wx::Region

    Constructs a rectangular region from the top left point and the bottom right point.

    Parameters:

    • topLeft (Array(Integer, Integer), Wx::Point)
    • bottomRight (Array(Integer, Integer), Wx::Point)
  • #initialize(rect) ⇒ Wx::Region

    Constructs a rectangular region a Wx::Rect object.

    Parameters:

  • #initialize(region) ⇒ Wx::Region

    Copy constructor, uses Reference Counting.

    Parameters:

  • #initialize(points, fillStyle = Wx::PolygonFillMode::ODDEVEN_RULE) ⇒ Wx::Region

    Constructs a region corresponding to the polygon made of n points in the provided array.

    fillStyle parameter may have values PolygonFillMode::WINDING_RULE or PolygonFillMode::ODDEVEN_RULE.

    Parameters:

  • #initialize(bmp) ⇒ Wx::Region

    Constructs a region using a bitmap.

    See #union for more details.

    Parameters:

  • #initialize(bmp, transColour, tolerance = 0) ⇒ Wx::Region

    Constructs a region using the non-transparent pixels of a bitmap.

    See #union for more details.

    Parameters:



114
# File 'lib/wx/doc/gen/region.rb', line 114

def initialize(*args) end

Instance Method Details

#clearvoid

This method returns an undefined value.

Clears the current region.

The object becomes invalid, or null, after being cleared.



120
# File 'lib/wx/doc/gen/region.rb', line 120

def clear; end

#contains(x, y) ⇒ Wx::RegionContain #contains(pt) ⇒ Wx::RegionContain #contains(x, y, width, height) ⇒ Wx::RegionContain #contains(rect) ⇒ Wx::RegionContain

Overloads:



166
# File 'lib/wx/doc/gen/region.rb', line 166

def contains(*args) end

#convert_to_bitmapWx::Bitmap

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

This method can’t be used for invalid region.

Returns:



172
# File 'lib/wx/doc/gen/region.rb', line 172

def convert_to_bitmap; end

#get_boxWx::Rect Also known as: box

Returns the outer bounds of the region.

This method returns 0-sized bounding box for invalid regions.

Returns:



48
# File 'lib/wx/doc/gen/region.rb', line 48

def get_box; end

#intersect(x, y, width, height) ⇒ Boolean #intersect(rect) ⇒ Boolean #intersect(region) ⇒ Boolean

Overloads:

  • #intersect(x, y, width, height) ⇒ Boolean

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

    This method always fails, i.e. returns false, if this region is invalid but may nevertheless be safely used even in this case. true if successful, false otherwise.

    Remark:

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

    Parameters:

    • x (Integer)
    • y (Integer)
    • width (Integer)
    • height (Integer)

    Returns:

    • (Boolean)
  • #intersect(rect) ⇒ Boolean

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

    This method always fails, i.e. returns false, if this region is invalid but may nevertheless be safely used even in this case. true if successful, false otherwise.

    Remark:

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

    Parameters:

    Returns:

    • (Boolean)
  • #intersect(region) ⇒ Boolean

    Finds the intersection of this region and another region.

    This method always fails, i.e. returns false, if this region is invalid but may nevertheless be safely used even in this case. true if successful, false otherwise.

    Remark:

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

    Parameters:

    Returns:

    • (Boolean)


216
# File 'lib/wx/doc/gen/region.rb', line 216

def intersect(*args) end

#is_emptyBoolean Also known as: empty?

Returns true if the region is empty, false otherwise.

Always returns true if the region is invalid.

Returns:

  • (Boolean)


222
# File 'lib/wx/doc/gen/region.rb', line 222

def is_empty; end

#is_equal(region) ⇒ Boolean Also known as: equal?

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

If both this region and region are both invalid, they are considered to be equal.

Parameters:

Returns:

  • (Boolean)


230
# File 'lib/wx/doc/gen/region.rb', line 230

def is_equal(region) end

#offset(x, y) ⇒ Boolean #offset(pt) ⇒ Boolean

Overloads:

  • #offset(x, y) ⇒ Boolean

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

    This method can’t be called if the region is invalid as it doesn’t make sense to offset it then. Attempts to do it will result in assert failure. true if successful, false otherwise (the region is unchanged then).

    Parameters:

    • x (Integer)
    • y (Integer)

    Returns:

    • (Boolean)
  • #offset(pt) ⇒ Boolean

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

    This method can’t be called if the region is invalid as it doesn’t make sense to offset it then. Attempts to do it will result in assert failure. true if successful, false otherwise (the region is unchanged then).

    Parameters:

    Returns:

    • (Boolean)


66
# File 'lib/wx/doc/gen/region.rb', line 66

def offset(*args) end

#subtract(rect) ⇒ Boolean #subtract(region) ⇒ Boolean

Overloads:

  • #subtract(rect) ⇒ Boolean

    Subtracts a rectangular region from this region.

    This method always fails, i.e. returns false, if this region is invalid but may nevertheless be safely used even in this case. true if successful, false otherwise.

    Remark:

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

    Parameters:

    Returns:

    • (Boolean)
  • #subtract(region) ⇒ Boolean

    Subtracts a region from this region.

    This method always fails, i.e. returns false, if this region is invalid but may nevertheless be safely used even in this case. true if successful, false otherwise.

    Remark:

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

    Parameters:

    Returns:

    • (Boolean)


259
# File 'lib/wx/doc/gen/region.rb', line 259

def subtract(*args) end

#union(x, y, width, height) ⇒ Boolean #union(rect) ⇒ Boolean #union(region) ⇒ Boolean #union(bmp) ⇒ Boolean #union(bmp, transColour, tolerance = 0) ⇒ Boolean

Overloads:

  • #union(x, y, width, height) ⇒ Boolean

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

    This method can be used even if this region is invalid and has the natural behaviour in this case, i.e. makes this region equal to the given rectangle. true if successful, false otherwise.

    Remark:

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

    Parameters:

    • x (Integer)
    • y (Integer)
    • width (Integer)
    • height (Integer)

    Returns:

    • (Boolean)
  • #union(rect) ⇒ Boolean

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

    This method can be used even if this region is invalid and has the natural behaviour in this case, i.e. makes this region equal to the given rectangle. true if successful, false otherwise.

    Remark:

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

    Parameters:

    Returns:

    • (Boolean)
  • #union(region) ⇒ Boolean

    Finds the union of this region and another region.

    This method can be used even if this region is invalid and has the natural behaviour in this case, i.e. makes this region equal to the given region. true if successful, false otherwise.

    Remark:

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

    Parameters:

    Returns:

    • (Boolean)
  • #union(bmp) ⇒ Boolean

    Finds the union of this region and the non-transparent pixels of a bitmap.

    The bitmap’s mask is used to determine transparency. If the bitmap doesn’t have a mask, the bitmap’s full dimensions are used. true if successful, false otherwise.

    Remark:

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

    Parameters:

    Returns:

    • (Boolean)
  • #union(bmp, transColour, tolerance = 0) ⇒ Boolean

    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. true if successful, false otherwise.

    Remark:

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

    Parameters:

    Returns:

    • (Boolean)


331
# File 'lib/wx/doc/gen/region.rb', line 331

def union(*args) end

#xor(x, y, width, height) ⇒ Boolean #xor(rect) ⇒ Boolean #xor(region) ⇒ Boolean

Overloads:

  • #xor(x, y, width, height) ⇒ Boolean

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

    This method can be used even if this region is invalid and has the natural behaviour in this case, i.e. makes this region equal to the given rectangle. true if successful, false otherwise.

    Remark:

    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.

    Parameters:

    • x (Integer)
    • y (Integer)
    • width (Integer)
    • height (Integer)

    Returns:

    • (Boolean)
  • #xor(rect) ⇒ Boolean

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

    This method can be used even if this region is invalid and has the natural behaviour in this case, i.e. makes this region equal to the given rectangle. true if successful, false otherwise.

    Remark:

    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.

    Parameters:

    Returns:

    • (Boolean)
  • #xor(region) ⇒ Boolean

    Finds the Xor of this region and another region.

    This method can be used even if this region is invalid and has the natural behaviour in this case, i.e. makes this region equal to the given region. true if successful, false otherwise.

    Remark:

    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.

    Parameters:

    Returns:

    • (Boolean)


375
# File 'lib/wx/doc/gen/region.rb', line 375

def xor(*args) end