color type is now int * int * int * float (from int * int * int).
stroke defaults to Color.black for all shapes, fill defaults to Color.transparent
Cairo backend
Moved from context.ml / render.ml to backend_cairo.ml and mli.
Stroke and fill are required for draw_{anything} functions
Expanded the argument types for draw_{anything} functions (was running into a cycle dependency error without - maybe that was due to something else and it isn't needed now).
Rename background -> set_background
Make set_background and set_line_width take ctx as an arg : at the backend ctx level
When there is a default context (context.ml), this is not needed and the global default is used
Context API
type context is now a sum type over CairoBackend, SVGBackend, and LazyBackend (#119 )
It has a default global context: that can be changed later. All functions that do need a context now take it as an optional argument - it is possible to work with multiple contexts parallely (#118 )
It's also possible to set the global context and work with different backends as the default
Shapes
Renamed center to origin in shape.ml code
Remove no_fill and no_stroke (it is the same as with_stroke Color.transparent and with_fill Color.transparent)
Stroke and fill are non-optional on shapes
Examples
Rename line to parallel_lines and create a new simpler line example
Refactor:
color
fn:color : ?a:float -> int -> int -> int -> unit
(rgba color making function)rgb
fn:rgb : int -> int -> int -> unit
(rgb - opaque color making function. renamed and changed signature from opaque) - https://github.com/Sudha247/ocaml-joy/issues/117color
type is nowint * int * int * float
(fromint * int * int
).Color.black
for all shapes, fill defaults toColor.transparent
context.ml
/render.ml
tobackend_cairo.ml
andmli
.draw_{anything}
functionsdraw_{anything}
functions (was running into a cycle dependency error without - maybe that was due to something else and it isn't needed now).background
->set_background
set_background
andset_line_width
takectx
as an arg : at the backend ctx levelcontext.ml
), this is not needed and the global default is usedtype context
is now a sum type overCairoBackend
,SVGBackend
, andLazyBackend
(#119 )center
toorigin
inshape.ml
codeno_fill
andno_stroke
(it is the same aswith_stroke Color.transparent
andwith_fill Color.transparent
)line
toparallel_lines
and create a new simplerline
example