Skip to content

Commit

Permalink
Merge pull request #108 from FayCarsons/include-modules
Browse files Browse the repository at this point in the history
Include modules vs using let bindings
  • Loading branch information
FayCarsons authored Mar 1, 2024
2 parents 38a327b + 664559f commit 5c71433
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 34 deletions.
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

0 comments on commit 5c71433

Please sign in to comment.