Vivid is a simple 2D rendering library written in Elixir.
Find a file
Renovate Bot f05a78d94f
All checks were successful
continuous-integration/drone/push Build is passing
chore: Configure Renovate (#5)
Welcome to [Renovate](https://github.com/renovatebot/renovate)! This is an onboarding PR to help you understand and configure settings before regular Pull Requests begin.

🚦 To activate Renovate, merge this Pull Request. To disable Renovate, simply close this Pull Request unmerged.

---
### Detected Package Files

 * `.tool-versions` (asdf)
 * `.drone.yml` (droneci)
 * `mix.exs` (mix)

### Configuration Summary

Based on the default config's presets, Renovate will:

  - Start dependency updates only once this onboarding PR is merged
  - Enable Renovate Dependency Dashboard creation.
  - Use semantic commit type `fix` for dependencies and `chore` for all others if semantic commits are in use.
  - Ignore `node_modules`, `bower_components`, `vendor` and various test/tests directories.
  - Group known monorepo packages together.
  - Use curated list of recommended non-monorepo package groupings.
  - Apply crowd-sourced package replacement rules.
  - Apply crowd-sourced workarounds for known problems with packages.
  - Use semantic prefixes for commit messages and PR titles.
  - Use `chore` as semantic commit type for commit messages and PR titles.
  - Removes rate limit for PR creation per hour.
  - Remove limit for open PRs at any time.
  - Automerge all upgrades (including `major`) if they pass tests.
  - Assign PRs to `james`.
  - Rebase existing PRs any time the base branch has been updated.
  - Raise PR when vulnerability alerts are detected.
  - Disable Renovate Dependency Dashboard creation.

🔡 Would you like to change the way Renovate is upgrading your dependencies? Simply edit the `renovate.json` in this branch with your custom config and the list of Pull Requests in the "What to Expect" section below will be updated the next time Renovate runs.

---

### What to Expect

It looks like your repository dependencies are already up-to-date and no Pull Requests will be necessary right away.

---

 Got questions? Check out Renovate's [Docs](https://docs.renovatebot.com/), particularly the Getting Started section.
If you need any further assistance then you can also [request help here](https://github.com/renovatebot/renovate/discussions).

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).

Co-authored-by: Renovate Bot <bot@harton.nz>
Reviewed-on: https://code.harton.nz/james/vivid/pulls/5
Co-authored-by: Renovate Bot <renovate@noreply.localhost>
Co-committed-by: Renovate Bot <renovate@noreply.localhost>
2023-07-27 20:35:21 +12:00
config improvement: bring code up to date and add linters, etc. 2023-07-27 18:49:47 +12:00
guides chore: change default branch to main. 2023-07-27 20:22:03 +12:00
lib improvement: bring code up to date and add linters, etc. 2023-07-27 18:49:47 +12:00
priv/hershey
test Run mix format 2018-01-19 09:06:04 +13:00
.check.exs improvement: bring code up to date and add linters, etc. 2023-07-27 18:49:47 +12:00
.drone.yml chore: remove spurios esbuild from CI. 2023-07-27 19:35:03 +12:00
.formatter.exs improvement: bring code up to date and add linters, etc. 2023-07-27 18:49:47 +12:00
.gitignore
.tool-versions improvement: bring code up to date and add linters, etc. 2023-07-27 18:49:47 +12:00
.travis.yml Update dependencies and make sure everything works with Elixir 1.5 2017-09-06 09:41:30 +12:00
CHANGELOG.md chore: release version v0.4.4 2023-07-27 18:49:47 +12:00
LICENSE
mix.exs improvement: bring code up to date and add linters, etc. 2023-07-27 18:49:47 +12:00
mix.lock improvement: bring code up to date and add linters, etc. 2023-07-27 18:49:47 +12:00
README.md chore: change default branch to main. 2023-07-27 20:22:03 +12:00
renovate.json chore: Configure Renovate (#5) 2023-07-27 20:35:21 +12:00

Vivid

Build Status

Vivid is a simple 2D rendering library.

Features

  • Supports drawing and manipulating a number of basic 2D primitives.
  • Supports filling arbitrary polygons.
  • Supports arbitrary transformations shape transformations.
  • Renders shapes onto a buffer.
  • 100% pure Elixir with no dependencies.
  • Render to PNG using vivid_png.

Demo

I implemented a simple ASCII renderer for debugging and testing purposes, so at any time you can pipe almost any Vivid struct to IO.puts and the contents of the buffer will be rendered and printed onto the screen.

Basic drawing

Frames behave as a simple collection of shapes and colours, which you can simply push on to.

use Vivid
Frame.init(10,10, RGBA.white)
|> Frame.push(Circle.init(Point.init(5,5), 4), RGBA.black)
|> IO.puts
@@@@   @@@
@@  @@@  @
@@ @@@@@ @
@ @@@@@@@
@ @@@@@@@
@ @@@@@@@
@@ @@@@@ @
@@  @@@  @
@@@@   @@@
@@@@@@@@@@

Transformations

Vivid supports a number of standards transforms which can be applied to a shape before it is added to a frame. It also makes provision for you to write your own.

use Vivid
frame = Frame.init(20, 20, RGBA.white)
shape = Box.init(Point.init(0,0), Point.init(5,5))
  |> Transform.rotate(45)
  |> Transform.fill(frame)
  |> Transform.center(frame)
  |> Transform.apply
Frame.push(frame, shape, RGBA.black)
|> IO.puts
@@@@@@@@@@ @@@@@@@@@
@@@@@@@@@ @ @@@@@@@@
@@@@@@@@ @@@ @@@@@@@
@@@@@@@ @@@@@ @@@@@@
@@@@@  @@@@@@@ @@@@@
@@@@ @@@@@@@@@@ @@@@
@@@ @@@@@@@@@@@@ @@@
@@ @@@@@@@@@@@@@@ @@
@ @@@@@@@@@@@@@@@@ @
 @@@@@@@@@@@@@@@@@@
@ @@@@@@@@@@@@@@@@ @
@@ @@@@@@@@@@@@@@ @@
@@@ @@@@@@@@@@@@ @@@
@@@@ @@@@@@@@@@ @@@@
@@@@@ @@@@@@@@@ @@@@
@@@@@@ @@@@@@@ @@@@@
@@@@@@@ @@@@@ @@@@@@
@@@@@@@@ @@@ @@@@@@@
@@@@@@@@@ @ @@@@@@@@
@@@@@@@@@@ @@@@@@@@@

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.

This distribution includes the Hershey vector font from The Hershey Fonts.

Font use restrictions:

 This distribution of the Hershey Fonts may be used by anyone for
  any purpose, commercial or otherwise, providing that:
    1. The following acknowledgements must be distributed with
      the font data:
      - The Hershey Fonts were originally created by Dr.
        A. V. Hershey while working at the U. S.
        National Bureau of Standards.
      - The format of the Font data in this distribution
        was originally created by
          James Hurt
          Cognition, Inc.
          900 Technology Park Drive
          Billerica, MA 01821
          (mit-eddie!ci-dandelion!hurt)
    2. The font data in this distribution may be converted into
      any other format *EXCEPT* the format distributed by
      the U.S. NTIS (which organization holds the rights
      to the distribution and use of the font data in that
      particular format). Not that anybody would really
      *want* to use their format... each point is described
      in eight bytes as "xxx yyy:", where xxx and yyy are
      the coordinate values as ASCII numbers.

Status

This library is now in use in several projects and seems to work well.

Future improvements include:

  • Improve Vivid.SLPFA.
  • Add transformations which can apply rotation matrices directly.
  • Add ability to composit multiple frames together.
  • Support bitmaps as a shape.