Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/oleh-zayats/legofy
Turn any image into lego block grid.
https://github.com/oleh-zayats/legofy
image image-processing ios ios-swift lego legofy swift swift-4
Last synced: about 1 month ago
JSON representation
Turn any image into lego block grid.
- Host: GitHub
- URL: https://github.com/oleh-zayats/legofy
- Owner: oleh-zayats
- License: mit
- Created: 2017-12-14T22:35:01.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-11-14T11:04:21.000Z (about 5 years ago)
- Last Synced: 2024-09-29T00:21:43.717Z (about 2 months ago)
- Topics: image, image-processing, ios, ios-swift, lego, legofy, swift, swift-4
- Language: Swift
- Size: 23.8 MB
- Stars: 8
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Legofy
![License](https://img.shields.io/badge/Licence-MIT-blue.svg)
![Platform](https://img.shields.io/badge/Platform-iOS-green.svg)
![Language](https://img.shields.io/badge/language-swift%204.0-orange.svg)
![Dependencies](https://img.shields.io/badge/Dependencies-None-lightgray.svg)![alt text](https://github.com/oleh-zayats/Legofy/blob/master/Examples/Legofy.png)
# Installation:
1. Install using [CocoaPods](https://cocoapods.org):
Add the following line to the project's Podfile:
```pod 'Legofy'```
run ```pod install```2. Manually:
Drag Classes folder to your project directory and add brick images from Resources into Assets folder of the project.# How To Use:
Import module:
```swift
import Legofy
```
Initialize service:
```swift
let legofyService = LegofyService(sourceImage: srcImage, brickSize: 50.0, brickType: .legoV2)
```
Setup delegate:
```swift
legofyService?.delegate = self
```Use isPercentProgressEnabled to get progress in percents instaed of default Float value
```swift
legofyService?.isPercentProgressEnabled = true
```Brick types available:
```swift
enum BrickType {
case clean, legoV1, legoV2, legoV3, custom(UIImage)
}
```Blend modes available:
```swift
enum BlendMode {
case multiply, hardLight, colorBurn, difference
}
```Call 'generateImage' to generate image:
```swift
legofyService?.generateImage()
```Or 'generateBrickTileImages' to generate brick tiles and positions (columns/rows):
```swift
legofyService?.generateBrickTileImages()
```## Check out the project in 'Demo' folder.
Don't forget to run ```pod install``` in Demo directory ^^
![alt text](https://github.com/oleh-zayats/Legofy/blob/master/Examples/Legofy.gif)