Code Monkey home page Code Monkey logo

swift-blend2d's Introduction

SwiftBlend2D

Platform Build Status
macOS Build Status
Linux Build Status
Windows Build Status

Work-in-progress Swift bindings for Blend2D. This project makes use of the original source code of Blend2D and is in no way associated or supported by Blend2D.

For a brief report of what APIs are available in Swift, please check the status page.

Requirements

Xcode 13.0 / Swift 5.4.3

Sample usage

Taken from sample1 from the samples library.

let img = BLImage(width: 480, height: 480, format: .prgb32)

// Attach a rendering context into `img`.
let ctx = BLContext(image: img)!

// Clear the image.
ctx.compOp = .sourceCopy
ctx.fillAll()

// Fill some path.
let path = BLPath()

path.moveTo(x: 26, y: 31)
path.cubicTo(x1: 642, y1: 132, x2: 587, y2: -136, x3: 25, y3: 464)
path.cubicTo(x1: 882, y1: 404, x2: 144, y2: 267, x3: 27, y3: 31)

ctx.compOp = .sourceOver
ctx.setFillStyleRgba32(0xFFFFFFFF)
ctx.fillPath(path)

// Detach the rendering context from `img`.
ctx.end()

// Let's use some built-in codecs provided by Blend2D.
let codec = BLImageCodec(builtInCodec: .bmp)

try img.writeToFile("bl-getting-started-1.bmp", codec: codec)

This should create an image in the current working directory like so:

Sample 1

There are more examples that reproduce each sample from Blend2D's homepage within that file.

License

The source code for SwiftBlend2D is distributed under the MIT license.

The incorporated source code from Blend2D is licensed under the zlib license.

swift-blend2d's People

Contributors

cs-luiz-silva avatar luizzak avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

swift-blend2d's Issues

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.