jimsynz / vivid_png

PNG Generation support for vivid.

Home Page:https://code.harton.nz/james/vivid_png

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Vivid.PNG

Build Status Hex.pm

Vivid.PNG adds PNG generating support to Vivid, a 2D rendering library implemented 100% in Elixir with no dependencies.

Accessing on GitHub

This repository is mirrored to GitHub from it's home on harton.dev. Feel free to raise issues, etc, on GitHub.

Installation

Vivid.PNG is available in Hex, the package can be installed by adding vivid_png to your list of dependencies in mix.exs:

def deps do
  [
    {:vivid_png, "~> 0.2.0"}
  ]
end

Documentation for the latest release can be found on HexDocs and for the main branch on docs.harton.nz.

Github Mirror

This repository is mirrored on Github from it's primary location on my Forgejo instance. Feel free to raise issues and open PRs on Github.

License

Source code is licensed under the terms of the MIT license, the text of which is included in the LICENSE file in this distribution.

Status

use Vivid
alias Vivid.PNG

frame  = Frame.init(300,200)
text   = Font.line("seems to work")
         |> Transform.fill(frame)
         |> Transform.center(frame)
         |> Transform.apply
circle = Circle.init(Point.init(100, 100), 50)
box    = Box.init(Point.init(250,150), Point.init(275, 175))

frame
|> Frame.push(text,   RGBA.black)
|> Frame.push(circle, RGBA.init(1,0,0,0.5))
|> Frame.push(box,    RGBA.init(0,0,1, 0.75))
|> PNG.to_png("example.png")

example.png

About

PNG Generation support for vivid.

https://code.harton.nz/james/vivid_png

License:MIT License


Languages

Language:Elixir 100.0%