A Region represents a simple or complex region on a device context or window. It uses reference counting, so copying and assignment operations are fast.
Region.new(Integer x, Integer y, Integer width,
Integer height)
Constructs a rectangular region with the given position and size.
Region.new(Point topLeft, Point bottomRight)
Constructs a rectangular region from the top left point and the bottom right point.
Region.new(Rect rect)
Constructs a rectangular region a Rect object.
Region.new(Region region)
Constructs a region by copying another region.
Region.new(Integer n, Point points,
Integer fillStyle = WINDING_RULE)
Constructs a region corresponding to the polygon made of n points in the
provided array. fillStyle parameter may have values
WINDING_RULE or ODDEVEN_RULE.
NB: This constructor is only implemented for Win32 and GTK+ Widgets ports.
Region.new(Bitmap bmp)
Region.new(Bitmap bmp, Colour transColour, Integer tolerance = 0)
Constructs a region using the non-transparent pixels of a bitmap. See Union for more details.
destructor()
Destructor.
clear()
Clears the current region.
Integer contains(Integer x, Integer y)
Integer contains(Point pt)
Returns a false or true value indicating whether the given point is contained within the region.
Integer contains(Rect rect)
Integer contains(Integer x, Integer y,
Integer width, Integer height)
Returns a false or true value indicating whether the given rectangle is contained within the region.
All these methods test whether a given point or rectangle is contained
with the region. If the point or rectangle is completely outside the
rectangle, returns false. If the point or rectangle is contained,
returns an integer (which will be true in Ruby).
If testing a Rectangle the return value will distinguish between a
wholly-contained rectangle (which will return value equal to
Wx::IN_REGION) and a partly overlapping rectangle (which will have a
return value of Wx::PART_REGION). Note that on Windows, this
distinction is not made; the return value will always be false or
Wx::IN_REGION)
Bitmap convert_to_bitmap()
Convert the region to a black and white bitmap with the white pixels being inside the region.
Rect get_box()
Returns the outer bounds of the region.
Boolean intersect(Integer x, Integer y, Integer width,
Integer height)
Finds the intersection of this region and another, rectangular region, specified using position and size.
Boolean intersect(Rect rect)
Finds the intersection of this region and another, rectangular region.
Boolean intersect(Region region)
Finds the intersection of this region and another region.
true if successful, false otherwise.
Creates the intersection of the two regions, that is, the parts which are in both regions. The result is stored in this region.
Boolean is_empty()
Returns true if the region is empty, false otherwise.
Boolean subtract(Rect rect)
Subtracts a rectangular region from this region.
Boolean subtract(Region region)
Subtracts a region from this region.
true if successful, false otherwise.
This operation combines the parts of ‘this’ region that are not part of the second region. The result is stored in this region.
Boolean offset(Integer x, Integer y)
Moves the region by the specified offsets in horizontal and vertical directions.
true if successful, false otherwise (the region is unchanged then).
Boolean union(Integer x, Integer y, Integer width,
Integer height)
Finds the union of this region and another, rectangular region, specified using position and size.
Boolean union(Rect rect)
Finds the union of this region and another, rectangular region.
Boolean union(Region region)
Finds the union of this region and another region.
Boolean union(Bitmap 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.
Boolean union(Bitmap bmp, Colour transColour,
Integer 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.
true if successful, false otherwise.
This operation creates a region that combines all of this region and the second region. The result is stored in this region.
Boolean xor(Integer x, Integer y, Integer width,
Integer height)
Finds the Xor of this region and another, rectangular region, specified using position and size.
Boolean xor(Rect rect)
Finds the Xor of this region and another, rectangular region.
Boolean xor(Region region)
Finds the Xor of this region and another region.
true if successful, false otherwise.
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.
operator $=$(Region region)
Copies region by reference counting.
[This page automatically generated from the Textile source at Thu May 01 00:50:43 +0100 2008]