Structure
Size
public struct Size : Equatable
A Size
represents dimensions in a two-dimensional plane.
Relationships
Conforms To
Equatable
Initializers
init()
public init()
Create a new Size
of (width:0, height:0)
init(width:height:)
public init(width:Int, height:Int)
Creates a new Size
from the specified parameters
Parameters
Name | Type | Description |
---|---|---|
width | Int |
The x-axis extent |
height | Int |
The y-axis extent |
Properties
width
public var width : Int
The x-axis extent
height
public var height : Int
The y-axis extent
zero
static public let zero
The size (width:0, height:0)
aspectRatio
public var aspectRatio : Double
The aspect ratio of this size (width / height).
center
public var center : Point
The Point
located at the center between the origin (x:0, y:0)
and the point located at size
Methods
enlarge(by:)
public mutating func enlarge(by change:Int)
Enlarges both dimenisions by the amount specified (negative numbers reduce the dimensions)
Parameters
Name | Type | Description |
---|---|---|
change | Int |
The amount by which to increase both dimensions |
Operators
==
static public func == (lhs:Size, rhs:Size) -> Bool
Equivalence operator for two Size
s