Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include modules vs using let bindings #108

Merged
merged 3 commits into from
Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 4 additions & 34 deletions lib/joy.ml
Original file line number Diff line number Diff line change
@@ -1,39 +1,9 @@
let context = Context.context

type 'a point = 'a Shape.point
type shape = Shape.shape
type shapes = Shape.shapes
type transformation = Transform.transformation
include Shape
include Transform
include Color

type color = Color.color
(** Three-tuple representing a 24-bit RGB color *)
let context = Context.context

let black = Color.black
let white = Color.white
let red = Color.red
let green = Color.green
let blue = Color.blue
let yellow = Color.yellow
let transparent = Color.transparent
let opaque = Color.opaque
let point = Shape.point
let circle = Shape.circle
let rectangle = Shape.rectangle
let polygon = Shape.polygon
let ellipse = Shape.ellipse
let line = Shape.line
let complex = Shape.complex
let with_stroke = Shape.with_stroke
let with_fill = Shape.with_fill
let no_stroke = Shape.no_stroke
let no_fill = Shape.no_fill
let rotate = Transform.rotate
let scale = Transform.scale
let translate = Transform.translate
let compose = Transform.compose
let repeat = Transform.repeat
let map_fill = Transform.map_fill
let map_stroke = Transform.map_stroke
let set_line_width = Context.set_line_width

let init ?(background = Color.white) ?(line_width = 2) ?(size = (500, 500))
Expand Down
1 change: 1 addition & 0 deletions lib/render.ml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ let draw_polygon ctx { vertices; stroke; fill } =
Option.iter fill_rect fill;
Cairo.Path.clear ctx.ctx


(* Validates context before rendering *)
let show shapes =
let rec render ctx = function
Expand Down
Loading