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
extern crate gdl;
extern crate time;
use gdl::{Rgb, PhotonImage, ColorScheme, diagrams, background, text};
use gdl::text::*;
use gdl::{presets, new_with_background};
use gdl::elements::*;
use time::PreciseTime;
use gdl::resize::webfunc;
fn main() {
let start = PreciseTime::now();
let yellow = Rgb { r: 255, g:226, b: 98};
let mut img = new_with_background(800, 800, &yellow);
presets::text_banner(&mut img, "The Lemonade Co.", "Making great lemonade since 2002.");
gdl::helpers::save_image(img, "output_graphic1.png");
let end = PreciseTime::now();
println!("Took {} seconds to create Graphic 1.", start.to(end));
let mut alleyway = gdl::helpers::open_image("examples/input_images/city_square.jpg");
let white = Rgb { r: 255, g: 255, b: 255};
draw_text(&mut alleyway, "Visit", 230, 270, "BebasKai", 140.0, &white);
draw_text(&mut alleyway, "Stockholm", 230, 390, "BebasKai", 140.0, &white);
gdl::helpers::save_image(alleyway, "output_graphic2.png");
let end = PreciseTime::now();
println!("Took {} seconds to create Graphic 2.", start.to(end));
let mut night = gdl::helpers::open_image("examples/input_images/drive.jpg");
let white = Rgb { r: 255, g: 255, b: 255};
draw_vertical_text(&mut night, "BUCHAREST BY NIGHT", 0, 0, "BebasKai", 110.0, "right", &white);
gdl::helpers::save_image(night, "output_graphic3.png");
let end = PreciseTime::now();
println!("Took {} seconds to create Graphic 3.", start.to(end));
webfunc(2);
}