Giter VIP home page Giter VIP logo

asyncgraphics's Introduction

AsyncGraphics

AsyncGraphics is a Swift package for working with images and video with async / await. The core type is simply just called Graphic and it's like an image, tho backed by a MTLTexture and comes with a lot of content and effects.

Documentation

Documentation (DocC)

The documentation contains a list of all content and effects that can be created with the Graphic type. It also contains articles about setting up a live camera feed and editing video.

Content

Import an image, video or live stream a camera feed.

Create color, text, rectangle, circle, polygon gradient, noise, particles and more.

Effects

Effects include resize, blend with various blending modes, translate, rotate, scale, mirror, stack, brightness, contrast, invert, opacity, monochrome, saturation, hue, tint, channel mix, blur, rainbow blur, displace, edge, clamp, cross, corner pin, chroma key a green screen.

Metal

There is also the option to write high level metal code in AsyncGraphics. No need to setup a pipeline.

Install

.package(url: "https://github.com/heestand-xyz/AsyncGraphics", from: "0.8.0")

Example

A live camera feed.

import SwiftUI
import AsyncGraphics

struct ContentView: View {
    
    @State private var graphic: Graphic?
    
    var body: some View {
        ZStack {
            if let graphic {
                GraphicView(graphic: graphic)
            }
        }
        .task {
            for await cameraGraphic in try! Graphic.camera(.front) {
                graphic = cameraGraphic
            }
        }
    }
}

Color

Colors are represented with the PixelColor type.
import PixelColor to create custom colors with hex values.

PixelColor on GitHub.

Image

Images are represented with TMImage.
This is a multi platform type alias to UIImage and NSImage.
import TextureMap for extra multi platform methods like .pngData() for macOS.

TextureMap on GitHub.

About

AsyncGraphics is a work in progress project, there is more features to come! Feel free to submit a PR!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.