Module Graphics_js
Javascript binding for Graphics lib
include module type of Graphics
val open_graph : string -> unit
val close_graph : unit -> unit
val set_window_title : string -> unit
val resize_window : int -> int -> unit
val rgb : int -> int -> int -> color
val set_color : color -> unit
val background : color
val foreground : color
val black : color
val white : color
val red : color
val green : color
val blue : color
val yellow : color
val cyan : color
val magenta : color
val point_color : int -> int -> color
val moveto : int -> int -> unit
val rlineto : int -> int -> unit
val curveto : (int * int) -> (int * int) -> (int * int) -> unit
val draw_rect : int -> int -> int -> int -> unit
val draw_poly_line : (int * int) array -> unit
val draw_poly : (int * int) array -> unit
val draw_segments : (int * int * int * int) array -> unit
val draw_arc : int -> int -> int -> int -> int -> int -> unit
val draw_ellipse : int -> int -> int -> int -> unit
val draw_circle : int -> int -> int -> unit
val set_line_width : int -> unit
val fill_arc : int -> int -> int -> int -> int -> int -> unit
val fill_ellipse : int -> int -> int -> int -> unit
val fill_circle : int -> int -> int -> unit
val transp : color
val make_image : color array array -> image
val dump_image : image -> color array array
val draw_image : image -> int -> int -> unit
val get_image : int -> int -> int -> int -> image
type status
=
{
mouse_x : int;
mouse_y : int;
button : bool;
keypressed : bool;
key : char;
}
type event
=
|
Button_down
|
Button_up
|
Key_pressed
|
Mouse_motion
|
Poll
Initializations
val open_graph : string -> unit
Open a graphics window. The graphics window is cleared and the current point is set to (0, 0). The string argument is used to pass optional information on the desired graphics mode, the graphics window size, and so on. Specification can be found at http://www.w3schools.com/jsref/met_win_open.asp. Note: an extra specification is available, "target", to specifies the target attribute or the name of the window.
val open_canvas : Js_of_ocaml.Dom_html.canvasElement Js_of_ocaml.Js.t -> unit
use a canvas to setup the current context
val get_context : unit -> context
Get the current context
val set_context : context -> unit
Set the current context