/Legofy

Turn any image into lego block grid.

Primary LanguageSwiftMIT LicenseMIT

Legofy

License Platform Language Dependencies

alt text

Installation:

  1. Install using CocoaPods:
    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:

import Legofy

Initialize service:

let legofyService = LegofyService(sourceImage: srcImage, brickSize: 50.0, brickType: .legoV2)

Setup delegate:

legofyService?.delegate = self

Use isPercentProgressEnabled to get progress in percents instaed of default Float value

legofyService?.isPercentProgressEnabled = true

Brick types available:

enum BrickType {
    case clean, legoV1, legoV2, legoV3, custom(UIImage)
}

Blend modes available:

enum BlendMode {
    case multiply, hardLight, colorBurn, difference
}

Call 'generateImage' to generate image:

legofyService?.generateImage()

Or 'generateBrickTileImages' to generate brick tiles and positions (columns/rows):

legofyService?.generateBrickTileImages() 

Check out the project in 'Demo' folder.

Don't forget to run pod install in Demo directory ^^
alt text