package vg

  1. Overview
  2. Docs
Declarative 2D vector graphics for OCaml

Install

Dune Dependency

Authors

Maintainers

Sources

vg-0.8.1.tbz
sha256=edef622ba351e54de2abe28774c57ec47a63c93d3f5b1a9b2d04a15fb2deacb1
md5=abde3e78212f155365b4a81e07ed83bf

Description

Vg is an OCaml module for declarative 2D vector graphics. In Vg, images are values that denote functions mapping points of the cartesian plane to colors. The module provides combinators to define and compose these values.

Renderers for PDF, SVG and the HTML canvas are distributed with the module. An API allows to implement new renderers.

Vg depends only on Gg. The SVG renderer has no dependency, the PDF renderer depends on Uutf and Otfm, the HTML canvas renderer depends on js_of_ocaml. Vg and its renderers are distributed under the BSD3 license.

README

Vg — Declarative 2D vector graphics for OCaml

Release 0.8.1

Vg is an OCaml module for declarative 2D vector graphics. In Vg, images are values that denote functions mapping points of the cartesian plane to colors. The module provides combinators to define and compose these values.

Renderers for PDF, SVG and the HTML canvas are distributed with the module. An API allows to implement new renderers.

Vg depends only on Gg. The SVG renderer has no dependency, the PDF renderer depends on Uutf and Otfm, the HTML canvas renderer depends on js_of_ocaml. Vg and its renderers are distributed under the BSD3 license.

Home page: http://erratique.ch/software/vg
Contact: Daniel Bünzli <daniel.buenzl i@erratique.ch>

Installation

Vg can be installed with opam:

opam install vg                        # SVG renderer only
opam install uutf otfm js_of_ocaml vg  # all renderers

If you don't use opam consult the opam file for build instructions and a complete specification of the dependencies.

Documentation

The documentation and API reference is automatically generated by ocamldoc from the interfaces. It can be consulted online and there is a generated version in the doc directory of the distribution.

Sample programs and images

A database of sample images can be found in the db directory. An online rendering of the database is available here.

Sample programs are located in the test directory of the distribution. They can be built with:

ocamlbuild -use-ocamlfind tests.otarget

The resulting binaries are in _build/test :

  • min_pdf.native, minimal example to render an image to a PDF file.

  • min_svg.native, minimal example to render an image to an SVG file.

  • min_htmlc.byte, minimal example to render with the HTML canvas.

  • rsvg.native, renders images of the Vg image database to SVG files.

  • rpdf.native, renders images of the Vg image database to PDF files.

  • rhtmlc.html and rhtmlc.byte can be processed with js_of_ocaml, the resulting webapp renders images of the Vg image database with the HTML canvas, PDF and SVG renderers.

  • vecho.native, like echo(1) but produces a PDF file on stdout, the font file can be specified, invoke with -help for options.

  • fglyphs.native, renders a font's glyphs to a PDF file (without using Vg's glyph API).

Dependencies (4)

  1. ocamlbuild build
  2. gg >= "0.9.0"
  3. ocamlfind
  4. ocaml >= "4.01.0" & < "4.06.0"

Dev Dependencies

None

Conflicts (2)

  1. js_of_ocaml >= "3.0"
  2. uutf > "0.9.4"
OCaml

Innovation. Community. Security.