Skip to content
This repository has been archived by the owner on Dec 31, 2023. It is now read-only.
/ iMage Public archive

Multiplatform image renderer for MacOS and iOS.

License

Notifications You must be signed in to change notification settings

MakeupStudio/iMage

Repository files navigation

iMage

Multiplatform image renderer for MacOS and iOS.

Inspired by EricaSadun and UIGraphicsImageRenderer

Usage

For the best experience use it with Pallete

import iMage
import Palette
let redCirlce = IMage.render(in: someview.bounds) { let ctx = $0.cgContext 
    let ctx = $0.cgContext!
    ctx.setFillColor(.init(.white))
    ctx.fill(rect)
    ctx.addEllipse(in: rect.insetBy(dx: 10, dy: 10))
    ctx.setFillColor(.init(Color<RGB>.red.with(alpha: 0.7)))
    ctx.fillPath()
}

Installation

Add the package to Your SwiftPM package dependencies:

.package(url: "https://github.com/makeupstudio/iMage.git", from: "1.0.0")

then add iMage dependency to your target.

Examples