agg 0.1.0

High-quality 2D graphics engine based on Anti-grain Geometry
Documentation
  • Coverage
  • 36.44%
    176 out of 483 items documented7 out of 335 items with examples
  • Size
  • Source code size: 10.34 MB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 9.32 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • Homepage
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • savage13

agg

A Rust port of Anti-Grain Geometry

A High Fidelity and Quality 2D Graphics Rendering Engine

Usage

Add this to your Cargo.toml:

[dependencies]
agg = "0.1.0"

Example

Little Black Triangle

use agg::PixelData;
use agg::Render;

// Create a blank image 10x10 pixels
let pix = agg::Pixfmt::<agg::Rgb8>::new(100,100);
let mut ren_base = agg::RenderingBase::new(pix);
ren_base.clear(agg::Rgba8::white());

// Draw a polygon from (10,10) - (50,90) - (90,10)
let mut ras = agg::RasterizerScanline::new();
ras.move_to_d(10.0, 10.0);
ras.line_to_d(50.0, 90.0);
ras.line_to_d(90.0, 10.0);

// Render the line to the image
let mut ren = agg::RenderingScanlineAASolid::with_base(&mut ren_base);
ren.color(&agg::Rgba8::black());
agg::render_scanlines(&mut ras, &mut ren);

// Save the image to a file
agg::ppm::write_ppm(&ren_base.pixeldata(), 100,100,
                    "little_black_triangle.ppm").unwrap();

Features

  • Anti-Aliased Drawing

  • Sub-pixel Accuracy

  • Rendering of Arbitrary Polygons

  • Text/Font Rendering (through with Freetype)

  • Performance ? (to be determined)

Complexity

Quoting the original C++ library:

Anti-Grain Geometry is not a solid graphic library and it's not very easy to use. I consider AGG as a "tool to create other tools". It means that there's no "Graphics" object or something like that, instead, AGG consists of a number of loosely coupled algorithms that can be used together or separately. All of them have well defined interfaces and absolute minimum of implicit or explicit dependencies.

License

This version was ported from agg-2.4 (BSD 3-Clause) and is released under the BSD 2-Clause License.