Crate kodak

source · []
Expand description

Kodak is a crate for image creation and manipulation. It aims to be easy to use, fast and well-documented.

Kodak makes use of chaining API methods, like seen in functional programming languages. A typical piece of Kodak code might look like this:

// Add a white border around an image.
extern crate kodak;
use kodak::*;

let border_width = 16;

let src_img = Image::load_png("assets/olle_voader.png").unwrap();
let new_img = Image::blank(src_img.get_dimensions().expand(2 * border_width))
    .fill(Colour::WHITE)
    .overlay(src_img, Loc { x: border_width, y: border_width });
new_img.save_png("assets/olle_koader.png");

Structs

A struct to represent colours

This struct is used to indicate dimensions of an image.

The Image struct is at the heart of Kodak. You’ll be using functions on this 95% of the time.

This struct is used to indicate locations on an image.

This struct is used to indicate a region, specified by a top-left Loc and a Dim.