Region
public final class Region
Region describes the set of pixels used to clip Canvas. Region is compact,
efficiently storing a single integer rectangle, or a run length encoded array
of rectangles. Region may reduce the current Canvas clip, or may be drawn as
one or more integer rectangles. Region iterator returns the scan lines or
rectangles contained by it, optionally intersecting a bounding rectangle.
-
Constructs an empty
Region.Regionis set to empty bounds at (0, 0) with zero width and height.Declaration
Swift
public init() -
Constructs a copy of an existing region. Copy constructor makes two regions identical by value. Internally, region and the returned result share pointer values. The underlying
Rectarray is copied when modified. Creating aRegioncopy is very efficient and never allocates memory.Regionare always copied by value from the interface; the underlying shared pointers are not exposed.Declaration
Swift
public init(region: Region)Parameters
regionRegionto copy by value -
Undocumented
Declaration
Swift
public convenience init(rect: IRect) -
Undocumented
Declaration
Swift
public convenience init(path: Path) -
Constructs a rectangular
Regionmatching the bounds of rect. If rect is empty, constructs empty and returns false.Declaration
Swift
@discardableResult public func setRect(_ rect: IRect) -> BoolParameters
rectbounds of constructed
RegionReturn Value
true if rect is not empty
-
Constructs
Regionto match outline of path within clip. Returns false if constructedRegionis empty. ConstructedRegiondraws the same pixels as path through clip when anti-aliasing is disabled.Declaration
Swift
public func setPath(_ path: Path, clip: Region)Parameters
pathPathproviding outlineclipRegioncontaining pathReturn Value
true if constructed
Regionis not empty -
Set this region to the area described by the path, clipped to the current region.
Declaration
Swift
public func setPath(_ path: Path)Parameters
pathThe replacement path.
Return Value
true if constructed
Regionis not empty -
Replaces
Regionwith the result ofRegionop rect. Returns true if replacedRegionis not empty.Declaration
Swift
public func op(rect: IRect, op: RegionOperation) -> BoolParameters
rectIRectoperandopoperator to apply
Return Value
false if result is empty
-
Replaces
Regionwith the result ofRegionop rgn. Returns true if replacedRegionis not empty.Declaration
Swift
public func op(region: Region, op: RegionOperation) -> BoolParameters
rgnRegionoperandopoperator to apply
Return Value
false if result is empty
-
Undocumented
Declaration
Swift
public func op(path: Path, op inop: RegionOperation) -> Bool -
Returns true if
Regionintersects other. Returns false if either other orRegionis empty, or do not intersect.Declaration
Swift
public func intersects(region: Region) -> BoolParameters
otherRegionto intersectReturn Value
true if other and
Regionhave area in common
View on GitHub
Install in Dash
Region Class Reference