MediaEditPreviewController
@available(iOS 9.0, *)
@objcMembers
@objc(PESDKMediaEditPreviewController)
open class MediaEditPreviewController : ViewController
extension MediaEditPreviewController: UIScrollViewDelegate
extension MediaEditPreviewController: GLKViewDelegate
extension MediaEditPreviewController: MTKViewDelegate
extension MediaEditPreviewController: SpriteViewControllerDelegate
The MediaEditPreviewController
is responsible for previewing changes to visual media and
displaying the asset in a scrollable container. It’s an abstract base class used by
PhotoEditPreviewController
and VideoEditPreviewController
. You should not instantiate this
class directly.
-
The scroll view that hosts the preview view.
Declaration
Swift
open private(set) lazy var previewViewScrollingContainer: UIScrollView { get set }
-
The preview view that renders the preview image.
Declaration
Swift
open private(set) lazy var previewView: UIView { get set }
-
Whether zooming should be enabled.
Declaration
Swift
open var allowsPreviewImageZoom: Bool
-
An object that acts as a delegate.
Declaration
Swift
open weak var delegate: MediaEditPreviewControllerDelegate?
-
The photo edit model that is currently being rendered.
Declaration
Swift
open var photoEditModel: PhotoEditModel { get set }
-
The
UIImage
object used in the preview. This is the resized version of the original photo. Setting this also generates the matchingCIImage
object, seebaseWorkCIImage
.Declaration
Swift
open var baseWorkUIImage: UIImage? { get set }
-
The
CIImage
object used in the preview. This is the resized version of the original photo.Declaration
Swift
open private(set) var baseWorkCIImage: CIImage? { get }
-
The renderer that is being used to render the image.
Declaration
Swift
public let renderer: PhotoEditRenderer
-
The
SpriteViewController
that is displayed above the preview to manage sprites.Declaration
Swift
open private(set) lazy var spriteViewController: SpriteViewController { get set }
-
The
AssetManager
that this view controller can use to set and get assets.Declaration
Swift
open var assetManager: AssetManager?
-
The
AssetCatalog
that is associated with this view controller.Declaration
Swift
public var assetCatalog: AssetCatalog { get set }
-
The
UndoController
that handles undo/redo for this controller.Declaration
Swift
open var undoController: UndoController?
-
This closure is called with
false
when the view controller starts loading its base image and is called again withtrue
when loading has finished. This should be used to display a progress indicator and disable user interaction.Declaration
Swift
open var loadingProgressClosure: ((Bool) -> Void)?
-
Creates a new
MediaEditPreviewController
object.Declaration
Swift
public convenience init(photoEditModel: PhotoEditModel = PhotoEditModel())
Parameters
photoEditModel
The photo edit model to apply to the asset.
-
Creates a new
MediaEditPreviewController
object.Declaration
Swift
public init(renderer: PhotoEditRenderer, photoEditModel: PhotoEditModel)
Parameters
renderer
The renderer to use to render changes.
photoEditModel
The photo edit model to apply to the asset.
-
Loads a still base image to display in the preview.
Declaration
Swift
open func loadBaseImage(_ completion: @escaping (UIImage?) -> Void)
Parameters
completion
A closure to execute when loading is finished.
-
Updates the state of the renderer and triggers a rerender if necessary.
Declaration
Swift
open func updateRenderer()
-
An image vendor that provides this preview controller’s images, if an image vendor is used.
Declaration
Swift
open var imageVendor: ImageVendor? { get }
-
Updates the attached asset manager’s image of the drawn brush.
Declaration
Swift
public func updateBrush(onlyIfMissing: Bool = false)
Parameters
onlyIfMissing
If
false
the image will only be added if it doesn’t exist in the asset manager yet.
-
Updates the layout of the preview. This must be called whenever a new tool is presented above the preview.
Declaration
Swift
open func updateLayout()
-
Updates the insets of the preview. This must be called whenever a new tool is presented above the preview.
Declaration
Swift
open func updateInsets(animated: Bool)
Parameters
animated
Whether this change should be animated or not.
-
Triggers a rerender of the preview.
Declaration
Swift
open func updatePreview()
-
Calculates the maximum size of the preview image for the given screen. It is the longer side of the given screen multiplied with the screen’s scale factor.
Declaration
Swift
open func workImageSize(for screen: UIScreen) -> CGSize
Parameters
screen
The screen to calculate the size for.
Return Value
The maximum size of the preview image.