Module Graphics_js
Javascript binding for Graphics lib
include module type of Graphics
val open_graph : string -> unitval close_graph : unit -> unitval set_window_title : string -> unitval resize_window : int -> int -> unit
val rgb : int -> int -> int -> color
val set_color : color -> unit
val background : colorval foreground : colorval black : colorval white : colorval red : colorval green : colorval blue : colorval yellow : colorval cyan : colorval magenta : color
val point_color : int -> int -> colorval moveto : int -> int -> unit
val rlineto : int -> int -> unitval curveto : (int * int) -> (int * int) -> (int * int) -> unitval draw_rect : int -> int -> int -> int -> unitval draw_poly_line : (int * int) array -> unitval draw_poly : (int * int) array -> unitval draw_segments : (int * int * int * int) array -> unitval draw_arc : int -> int -> int -> int -> int -> int -> unitval draw_ellipse : int -> int -> int -> int -> unitval draw_circle : int -> int -> int -> unitval set_line_width : int -> unit
val fill_arc : int -> int -> int -> int -> int -> int -> unitval fill_ellipse : int -> int -> int -> int -> unitval fill_circle : int -> int -> int -> unit
val transp : color
val make_image : color array array -> imageval dump_image : image -> color array arrayval 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 -> unitOpen 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 -> unituse a canvas to setup the current context
val get_context : unit -> contextGet the current context
val set_context : context -> unitSet the current context