1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
//! *Lulz on demand!*
//!
//! This here `rofl` crate, aptly named, is capable of the extraordinary feat
//! of putting text on images. And not just still images: it does cover animated GIFs as well!
//!
//! In other words, the crate can be used to create _memes_,
//! which purists generally refer to as _image macros_.
//!
//! # Much example
//!
//! ```rust
//! extern crate rofl;
//!
//! # use std::error::Error;
//! # use std::io::Write;
//! # use std:: fs;
//! #
//! # fn zoidberg() -> Result<(), Box<Error>> {
//! let engine = rofl::Engine::new("data/templates", "data/fonts");
//! let image_macro = rofl::ImageMacro {
//! template: "zoidberg".into(),
//! captions: vec![
//! rofl::Caption::text_at(rofl::VAlign::Top, "Need an example?"),
//! rofl::Caption::text_at(rofl::VAlign::Bottom, "Why not Zoidberg?"),
//! ],
//! ..rofl::ImageMacro::default()
//! };
//! let output = engine.caption(image_macro)?;
//!
//! let mut file = fs::OpenOptions::new().write(true).open("zoidberg.png")?;
//! file.write_all(&*output)?;
//! # Ok(())
//! # }
//! ```
//!
//! # Very concepts
//!
//! To create memes, you need two types of media resources (in addition to impeccable wit):
//!
//! * _templates_ -- named images & animated GIFs that we can put text on
//! * _fonts_ to render the text with (like `"Impact"` or `"Comic Sans"`)
//!
//! Those resources have to be provided to the captioning [`Engine`](struct.Engine.html).
//!
//! In the simple above, they are just files contained within some directories.
//! If you're doing something more complicated --
//! like a website where users can upload their own images --
//! you can implement your own [`Loader`s](trait.Loader.html) for templates or even fonts.
//!
//! A meme is defined by [the `ImageMacro` structure](struct.ImageMacro.html).
//! These can be deserialized from JSON or query strings if desired.
//!
//! # Wow
//!
//! Go forth and meme!
extern crate color_quant;
extern crate conv;
extern crate css_color_parser;
extern crate derive_error;
extern crate enum_derive;
extern crate gif;
extern crate gif_dispose;
extern crate glob;
extern crate image;
extern crate itertools;
extern crate lazy_static;
extern crate log;
extern crate lru_cache;
extern crate macro_attr;
extern crate maplit;
extern crate mime;
extern crate newtype_derive;
extern crate num;
extern crate rand;
extern crate regex;
extern crate rusttype;
extern crate serde;
extern crate serde_derive;
extern crate time;
extern crate try_opt;
extern crate unicode_normalization;
extern crate unreachable;
extern crate serde_json;
extern crate serde_qs;
extern crate serde_test;
extern crate spectral;
pub use *;
pub use *;
pub use *;
pub use ;