PhotoEditModel

@available(iOS 9.0, *)
public struct PhotoEditModel : Equatable

A PhotoEditModel holds information about any modification that should be applied to an image.

  • Information about the adjustments that should be applied to an image.

    Declaration

    Swift

    public var adjustmentModel: AdjustmentModel
  • Information about the effect that should be applied to an image.

    Declaration

    Swift

    public var effectFilterModel: EffectFilterModel
  • Information about the focus that should be applied to an image.

    Declaration

    Swift

    public var focusModel: FocusModel
  • Information about the overlay that should be applied to an image.

    Declaration

    Swift

    public var overlayModel: OverlayModel
  • Information about the sprites that should be added to an image.

    Declaration

    Swift

    public var spriteModels: [SpriteModel]
  • Information about the transform that should be applied to an image.

    Declaration

    Swift

    public var transformModel: TransformModel
  • Whether auto enhancement is enabled for an image.

    Declaration

    Swift

    public var isAutoEnhancementEnabled: Bool
  • Deserializes a PhotoEditModel using the given data. If the serialized data does not contain an image object, a reference size must be provided. If there are serialized input dimensions but a reference size is passed regardless, the reference size takes precedence over the deserialized size.

    Declaration

    Swift

    public init?(serializedData data: Data, referenceSize: CGSize?)

    Parameters

    data

    The data to deserialize.

    referenceSize

    A size that the deserialized data should refer to when denormalizing normalized values.

  • Deserializes a PhotoEditModel using the given data. If the serialized data does not contain an image object, a reference size larger than CGSize.zero must be provided. If there are serialized input dimensions but a reference size larger than CGSize.zero is passed regardless, the reference size takes precedence over the deserialized size.

    Declaration

    Swift

    public init?(serializedData data: Data, referenceSize: CGSize)

    Parameters

    data

    The data to deserialize.

    referenceSize

    A size that the deserialized data should refer to when denormalizing normalized values or CGSize.zero.

  • Serializes this model into a storable representation by encoding all currently applied tools.

    Declaration

    Swift

    public func serialized(with photo: Photo, includeImageData: Bool) -> Data?

    Parameters

    photo

    A photo that this serialization references. This is needed to preserve certain aspect ratios.

    includeImageData

    Whether to also include the image data as a base64 encoded JPEG in the serialized model.

    Return Value

    The serialized model as bytes or nil, if the serialization failed.

  • Searches for a SpriteModel with the given UUID.

    Declaration

    Swift

    public func spriteModel(with uuid: UUID) -> (Int, SpriteModel)?

    Parameters

    uuid

    The UUID of the sprite model to search for.

    Return Value

    A tuple with the index of the sprite model within the sprite model array and the sprite model if it is found, nil otherwise.