Last active
August 6, 2017 16:20
-
-
Save sparrow/ea8fc136db8037d5e4869689a9d519a8 to your computer and use it in GitHub Desktop.
This is a Swift code snippet that we used for our blog post at RubyGarage https://rubygarage.org/. To add two images with different coordinates over a third image.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let item = MediaItem(image: image) | |
let logoImage = UIImage(named: "logo") | |
let firstElement = MediaElement(image: logoImage!) | |
firstElement.frame = CGRect(x: 0, y: 0, width: logoImage!.size.width, height: logoImage!.size.height) | |
let secondElement = MediaElement(image: logoImage!) | |
secondElement.frame = CGRect(x: 300, y: 300, width: logoImage!.size.width, height: logoImage!.size.height) | |
item.add(elements: [firstElement, secondElement]) | |
let mediaProcessor = MediaProcessor() | |
mediaProcessor.processElements(item: item) { [weak self] (result, error) in | |
self?.resultImageView.image = result.image | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment