All Projects → jimsynz → vivid.ex

jimsynz / vivid.ex

Licence: MIT license
Vivid is a simple 2D rendering library written in Elixir.

Programming Languages

elixir
2628 projects

Projects that are alternatives of or similar to vivid.ex

Procedural-Shape-Generation
An Unity package, enabling user to generate shapes by scripting.
Stars: ✭ 19 (-29.63%)
Mutual labels:  shape, 2d
FrameSystem
WPF通用权限开发框架
Stars: ✭ 40 (+48.15%)
Mutual labels:  frame
SNKRX
A replayable arcade shooter where you control a snake of heroes.
Stars: ✭ 1,067 (+3851.85%)
Mutual labels:  2d
learn-dlang
Learn D programming language by creating games!
Stars: ✭ 42 (+55.56%)
Mutual labels:  2d
codec
Encode keys, values and range options, with built-in or custom encodings.
Stars: ✭ 27 (+0%)
Mutual labels:  buffer
SegCaps
A Clone version from Original SegCaps source code with enhancements on MS COCO dataset.
Stars: ✭ 62 (+129.63%)
Mutual labels:  2d
go-disk-buffer
This package helps to work with huge amount of data, which cannot be stored in RAM
Stars: ✭ 39 (+44.44%)
Mutual labels:  buffer
dotweb-start
dotweb-start
Stars: ✭ 24 (-11.11%)
Mutual labels:  frame
rectangle-pack
A general purpose, deterministic bin packer designed to conform to any two or three dimensional use case.
Stars: ✭ 60 (+122.22%)
Mutual labels:  2d
VXA-OS
Most complete and secure free 2D online game creation tool from RPG Maker.
Stars: ✭ 14 (-48.15%)
Mutual labels:  2d
raylib-py
A Python binding for the great C library raylib.
Stars: ✭ 147 (+444.44%)
Mutual labels:  2d
TransformUtils.jl
Lie groups and algebra with some quaternions
Stars: ✭ 18 (-33.33%)
Mutual labels:  2d
SupperShape
🏡替代Shape和Selector和Layer-list的xml,减小apk体积
Stars: ✭ 57 (+111.11%)
Mutual labels:  shape
Sight
A spatial search μlibrary powered by GameplayKit 👾
Stars: ✭ 27 (+0%)
Mutual labels:  2d
SkeletonMatching
This repository implements skeleton matching algorithm.
Stars: ✭ 30 (+11.11%)
Mutual labels:  shape
CutAndDisplace
Boundary Element MATLAB code. Modelling faults and deformation
Stars: ✭ 40 (+48.15%)
Mutual labels:  2d
UnityGameTemplate
Template with all necessary stuff taken care, just create your games main features.
Stars: ✭ 221 (+718.52%)
Mutual labels:  2d
Fractal Engine
WIP 3D game engine with editor and other stuff
Stars: ✭ 152 (+462.96%)
Mutual labels:  2d
game-map-editor
game-map-editor
Stars: ✭ 17 (-37.04%)
Mutual labels:  2d
2d-diffusion-limited-aggregation-experiments
Visual experiments exploring diffusion-limited aggregation (DLA) as a 2D morphogenesis tool.
Stars: ✭ 41 (+51.85%)
Mutual labels:  2d

Vivid

Build Status Inline docs

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.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].