module gfx.canvas
pub class Canvas
pub fn save_svg(filename: str)
pub fn set_color(color?: str)
pub fn set_width(width?: int64)
fn draw_rect(x: int64, y: int64)
pub fn draw_line(x1: int64, y1: int64, x2: int64, y2: int64)
pub enum HorizontalAnchor
LeftMiddleRight
pub enum VerticalAnchor
TopMiddleBottom
module gfx.chart
Functionality to charts and plotting.
pub class Chart
pub fn to_svg(filename: str)
pub fn new_curve(name: str) -> Curve
fn get_data_bounds() -> Option
pub fn autoscale()
adjust axis to view all data!
pub fn autoscale_x()
Adjust x-axis to fit all data
pub fn autoscale_y()
Adjust y-axis to fit all data
pub fn zoom(factor: float64)
pub fn pan_x(delta: float64)
pub fn pan_y(delta: float64)
class Axis
pub fn domain() -> float64
pub fn scale(factor: float64)
pub fn pan(delta: float64)
pub class Curve
pub fn add_point(x: float64, y: float64)
pub fn get_data_bounds() -> Option
struct FRange
x_min: float64x_max: float64y_min: float64y_max: float64
struct FVal
value: float64distance: float64
fn new_fval(value: float64, approx: float64) -> FVal
fn round_to_multiple(value: float64, base: float64) -> float64
class ChartDrawer
fn to_x_pixel(value?: float64) -> int64
fn to_y_pixel(value?: float64) -> int64
fn set_width(width?: int64)
fn set_color(color?: str)
fn draw_line(x1: int64, y1: int64, x2: int64, y2: int64)
fn draw_rect(x1: int64, y1: int64, x2: int64, y2: int64)
struct Tick
value: int64text: str
module gfx.game
Game engine functions.
pub class Engine
3D engine!
pub fn set_projection_matrix(fov: float64, near: float64, far: float64)
pub fn draw_mesh(m: Mesh)
pub fn new_cube_mesh() -> Mesh
pub fn new_cylinder_mesh() -> Mesh
pub fn new_mat(rows: int64, cols: int64) -> Mat
pub fn matrix_multiply(a: Mat, b: Mat, out: Mat)
Matrix multiplication A*B
pub fn rotx(theta: float64) -> Mat
Rotation matrix around the x axis.
pub fn roty(theta: float64) -> Mat
Rotation matrix around the y axis.
pub fn rotz(theta: float64) -> Mat
Rotation matrix around the z axis.
pub struct Mat
rows: int64cols: int64m: [[float64]]
pub struct VecF
size: int64m: [float64]
pub struct Vertex
x: float64y: float64z: float64
pub struct Face
v1: int64v2: int64v3: int64
module gfx.lttb
Largest Triangle Three Bucket (LTTB) algorithm
module gfx.screen
pub fn new_screen(width: int64, height: int64) -> Screen
pub class Screen
A bitmap painter.
pub fn set_color(red: int64, green: int64, blue: int64)
pub fn clear()
Set entire screen to color.
pub fn draw_line(x1: int64, y1: int64, x2: int64, y2: int64)
Draw a line from x1,y1 to x2,y2 in the current color.
Use Bresenham's algorithm
See also: https://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm
fn draw_vertical_line(x: int64, y1: int64, y2: int64)
Vertical line
fn draw_horizontal_line(y: int64, x1: int64, x2: int64)
Horizontal line
pub fn put_pixel(x: int64, y: int64)
pub fn save_png(path: Path)
module gfx.ui