CropAspect
@objcMembers
@objc(PESDKCropAspect)
open class CropAspect : NSObject
The CropAspect
class is used to specify the available crop aspect ratios for the
TransformToolController
.
-
Declaration
Swift
public convenience init(width: CGFloat, height: CGFloat, rotatable: Bool)
Parameters
width
The width of the aspect ratio.
height
The height of the aspect ratio.
rotatable
Whether this crop aspect can be rotated by tapping on it in the transform tool.
-
Creates a new instance of
CropAspect
with a custom localized name. Usually the aspect ratio will be used as the name, but with this initializer it is possible to use a different name such asSquare
instead of1.0
.Declaration
Swift
public convenience init(width: CGFloat, height: CGFloat, localizedName: String)
Parameters
width
The width of the aspect ratio.
height
The height of the aspect ratio.
localizedName
The custom localized name for this aspect ratio.
-
Creates a new instance of
CropAspect
with a custom localized name. Usually the aspect ratio will be used as the name, but with this initializer it is possible to use a different name such asSquare
instead of1.0
.Declaration
Swift
public init(width: CGFloat, height: CGFloat, localizedName: String, rotatable: Bool)
Parameters
width
The width of the aspect ratio.
height
The height of the aspect ratio.
localizedName
The custom localized name for this aspect ratio.
rotatable
Whether this crop aspect can be rotated by tapping on it in the transform tool.
-
The width of the aspect ratio.
Declaration
Swift
public let width: CGFloat
-
The height of the aspect ratio.
Declaration
Swift
public let height: CGFloat
-
The localized name of the aspect ratio.
Declaration
Swift
public let localizedName: String
-
Whether this crop aspect can be rotated by tapping on it in the transform tool.
Declaration
Swift
public let isRotatable: Bool
-
The calculated ratio (i.e.
width / height
).Declaration
Swift
open var ratio: CGFloat { get }
-
Calculates the width for a given height.
Declaration
Swift
open func width(forHeight height: CGFloat) -> CGFloat
Parameters
height
The height to calculate the matching width for.
Return Value
The width for the given height.
-
Calculates the height for a given width.
Declaration
Swift
open func height(forWidth width: CGFloat) -> CGFloat
Parameters
width
The width to calculate the matching height for.
Return Value
The height for the given width.
-
Creates the reversed aspect ratio.
Declaration
Swift
open var inversed: CropAspect { get }