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
//! A collection of utilities for working with Riichi Mahjong player hands.
//!
//! This currently includes:
//! * Hand representation object
//! * Parser that allows to quickly create a hand using human-readable string,
//! such as `123m456p_7*77z`
//! * Renderer that allows to draw a hand to a raster image (along with a few
//! ready-to-use sets of tile images)
//!
//! ## Feature flags
//! By default, all the crate features are enabled. You can disable some of them
//! on demand to save on the compilation time and resulting library size.
//!
//! * `raster-renderer` - renderer for hands that outputs raster images
//! * `fluffy-stuff-tile-sets` - ready-to-use tile sets based on FluffyStuff's
//! work. Greatly increases build time
//! * `martin-persson-tile-sets` - ready-to-use tile sets based on Martin
//! Persson's work
//!
//! ## Example
//! ```
//! use riichi_hand::parser::HandParser;
//! use riichi_hand::raster_renderer::fluffy_stuff_tile_sets::YELLOW_FLUFFY_STUFF_TILE_SET;
//! use riichi_hand::raster_renderer::{RasterRenderer, RenderOptions};
//!
//! let hand = HandParser::parse("123m123p123sEESS").unwrap();
//! let image = RasterRenderer::render(&hand, &*YELLOW_FLUFFY_STUFF_TILE_SET, RenderOptions::default()).unwrap();
//! image.save("hand.png").unwrap();
//! # std::fs::remove_file("hand.png").unwrap();
//! ```
pub use *;
pub use image;
/// Hand parser that is able to convert string representation of a hand (e.g.
/// `123m456p_7*77z`) into [Hand] instance
/// Module that renders [Hand] instance into raster images
/// Constant objects that represent all valid tiles
/// Storing the number of han and fu, and calculating winning points