GSKQuadrangle

@interface GSKQuadrangle : NSObject

Represents a quadrangular area of the photo, generally the document for which to correct the perspective.

A quadrangle should always be expressed in the coordinates of the up image

A normalized quadrangle: corners expressed in fraction of the image dimensions.

  • Given a normalized Quadrangle, returns a new quadrangle expressed in the given size coordinates

    Declaration

    Objective-C

    - (nonnull GSKQuadrangle *)scaleForSize:(CGSize)size;

    Swift

    func scale(for size: CGSize) -> GSKQuadrangle
  • Given a quadrangle expressed in the given size coordinates, returns a new quadrangle with normalized coordinates.

    Declaration

    Objective-C

    - (nonnull GSKQuadrangle *)normalizedWithSize:(CGSize)size;

    Swift

    func normalized(with size: CGSize) -> GSKQuadrangle
  • Given a quadrangle detected on a oriented image, this returns the quadrangle that would have been detected if once the image was rotated according to its orientation.

    IMPORTANT: this should only be applied to a normalized quadrangle

    Declaration

    Objective-C

    - (nonnull GSKQuadrangle *)rotatedForUpOrientation:
        (UIImageOrientation)orientation;

    Swift

    func rotated(forUp orientation: UIImage.Orientation) -> GSKQuadrangle
  • Converts the quadrangle back to not take in account an image orientation

    Declaration

    Objective-C

    - (nonnull GSKQuadrangle *)rotatedWithoutOrientation:
        (UIImageOrientation)orientation;

    Swift

    func rotatedWithoutOrientation(_ orientation: UIImage.Orientation) -> GSKQuadrangle
  • Ensures corners have their coordinates within [0, 1]

    Declaration

    Objective-C

    - (nonnull GSKQuadrangle *)sanitized;

    Swift

    func sanitized() -> GSKQuadrangle