Latest 0.0.2
Homepage https://github.com/DevinShine/Porygon
License MIT
Platforms ios 8.0, requires ARC
Frameworks UIKit
Authors

Porygon







codebeat badge

Porygon is a library for generate low-poly style images. It’s algorithm is based on this paper and  Polyvia. The Delaunay algorithm used is this library.

如果你看的懂中文,你可以看我的这篇文章,里面会介绍实现的思路。

Effect

Detail

  • Get the edge points
    • Use Sobel to find the edge vertices and randomly take a few vertices
    • Generate random vertices using Poisson samples
    • Merge these vertices
  • Use Delaunay to form a number of triangles
  • Get the color from the center of the triangle and fill the color

Requirements

  • iOS 6.0+
  • Xcode 7.0+

Installation

CocoaPods

  1. Add pod 'Porygon' to your Podfile.
  2. Run pod install or pod update.
  3. Import <Porygon/Porygon.h>.

Manually

  1. Download all the files in the Sources subdirectory.
  2. Add the source files to your Xcode project.
  3. Link with required frameworks:
    • UIKit
  4. Import DVSPorygon.h.

Useage

Easy use

DVSPorygon *porygon = [[DVSPorygon alloc] init];
UIImage * lowPolyImage = [porygon lowPolyWithImage:[UIImage imageNamed:@"camera"]]; // get low poly image

Configuration parameters

DVSPorygon *porygon = [[DVSPorygon alloc] init];
// edge vertex count
porygon.vertexCount = 10000;
// randomly add the number of vertices
porygon.randomCount = 200;
// show wireframe effects
porygon.isWireframe = true;
UIImage * lowPolyImage = [porygon lowPolyWithImage:[UIImage imageNamed:@"camera"]]; // get low poly image

License

Porygon is provided under the MIT license. See LICENSE file for details.

Latest podspec

{
    "name": "Porygon",
    "version": "0.0.2",
    "summary": "Generate low-poly style images.",
    "description": "Porygon is a library for generate low-poly style images.",
    "homepage": "https://github.com/DevinShine/Porygon",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "DevinShine": "[email protected]"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/DevinShine/Porygon.git",
        "tag": "0.0.2"
    },
    "source_files": "Sources/*.{h,m,c}",
    "public_header_files": "Sources/*.h",
    "frameworks": "UIKit",
    "requires_arc": true
}

Pin It on Pinterest

Share This