2017-01-12 08:40:31 +13:00
# Vivid.PNG
2024-03-06 20:02:54 +13:00
[![Build Status ](https://drone.harton.dev/api/badges/james/vivid_png/status.svg?ref=refs/heads/main )](https://drone.harton.dev/james/vivid_png)
[![Hex.pm ](https://img.shields.io/hexpm/v/vivid_png.svg )](https://hex.pm/packages/vivid_png)
2023-07-27 20:08:44 +12:00
2023-08-19 19:22:09 +12:00
`Vivid.PNG` adds PNG generating support to [Vivid ](https://hex.pm/packages/vivid ),
2017-01-12 08:40:31 +13:00
a 2D rendering library implemented 100% in Elixir with no dependencies.
2023-08-19 19:22:09 +12:00
## Accessing on GitHub
2024-03-06 20:02:54 +13:00
This repository is [mirrored to GitHub ](https://github.com/jimsynz/vivid_png.ex ) from it's home on [harton.dev ](https://harton.dev/james/vivid_png ). Feel free to raise issues, etc, on GitHub.
2023-08-19 19:22:09 +12:00
2017-01-12 08:40:31 +13:00
## Installation
2024-03-06 20:02:54 +13:00
`Vivid.PNG` is [available in Hex ](https://hex.pm/packages/vivid_png ), the
package can be installed by adding `vivid_png` to your list of dependencies in
`mix.exs` :
2017-01-12 08:40:31 +13:00
```elixir
def deps do
2024-03-06 20:02:54 +13:00
[
{:vivid_png, "~> 0.2.0"}
]
2017-01-12 08:40:31 +13:00
end
```
2024-03-06 20:02:54 +13:00
Documentation for the latest release can be found on
[HexDocs ](https://hexdocs.pm/vivid_png ) and for the `main` branch on
[docs.harton.nz ](https://docs.harton.nz/james/vivid_png ).
## Github Mirror
This repository is mirrored [on Github ](https://github.com/jimsynz/vivid_png )
2024-03-08 14:48:05 +13:00
from it's primary location [on my Forgejo instance ](https://harton.dev/james/vivid_png ).
2024-03-06 20:02:54 +13:00
Feel free to raise issues and open PRs on Github.
2017-01-12 08:40:31 +13:00
## 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.
2017-01-12 08:55:58 +13:00
## Status
```elixir
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")
2017-01-12 08:58:06 +13:00
```
2024-02-05 15:16:32 +13:00
![example.png ](https://harton.dev/james/vivid_png/raw/branch/main/example.png )