`sig
exception Graphic_failure of string
val open_graph : string -> unit
val close_graph : unit -> unit
val set_window_title : string -> unit
external clear_graph : unit -> unit = "gr_clear_graph"
external size_x : unit -> int = "gr_size_x"
external size_y : unit -> int = "gr_size_y"
type color = int
val rgb : int -> int -> int -> Graphics.color
external set_color : Graphics.color -> unit = "gr_set_color"
val background : Graphics.color
val foreground : Graphics.color
val black : Graphics.color
val white : Graphics.color
val red : Graphics.color
val green : Graphics.color
val blue : Graphics.color
val yellow : Graphics.color
val cyan : Graphics.color
val magenta : Graphics.color
external plot : int -> int -> unit = "gr_plot"
val plots : (int * int) array -> unit
external point_color : int -> int -> Graphics.color = "gr_point_color"
external moveto : int -> int -> unit = "gr_moveto"
val rmoveto : int -> int -> unit
external current_x : unit -> int = "gr_current_x"
external current_y : unit -> int = "gr_current_y"
val current_point : unit -> int * int
external lineto : int -> int -> unit = "gr_lineto"
val rlineto : int -> int -> unit
val curveto : int * int -> int * int -> int * int -> unit
external draw_rect : int -> int -> int -> int -> unit = "gr_draw_rect"
val draw_poly_line : (int * int) array -> unit
val draw_poly : (int * int) array -> unit
val draw_segments : (int * int * int * int) array -> unit
external draw_arc : int -> int -> int -> int -> int -> int -> unit
= "gr_draw_arc" "gr_draw_arc_nat"
val draw_ellipse : int -> int -> int -> int -> unit
val draw_circle : int -> int -> int -> unit
external set_line_width : int -> unit = "gr_set_line_width"
external draw_char : char -> unit = "gr_draw_char"
external draw_string : string -> unit = "gr_draw_string"
external set_font : string -> unit = "gr_set_font"
val set_text_size : int -> unit
external text_size : string -> int * int = "gr_text_size"
external fill_rect : int -> int -> int -> int -> unit = "gr_fill_rect"
external fill_poly : (int * int) array -> unit = "gr_fill_poly"
external fill_arc : int -> int -> int -> int -> int -> int -> unit
= "gr_fill_arc" "gr_fill_arc_nat"
val fill_ellipse : int -> int -> int -> int -> unit
val fill_circle : int -> int -> int -> unit
type image
val transp : Graphics.color
external make_image : Graphics.color array array -> Graphics.image
= "gr_make_image"
external dump_image : Graphics.image -> Graphics.color array array
= "gr_dump_image"
external draw_image : Graphics.image -> int -> int -> unit
= "gr_draw_image"
val get_image : int -> int -> int -> int -> Graphics.image
external create_image : int -> int -> Graphics.image = "gr_create_image"
external blit_image : Graphics.image -> int -> int -> unit
= "gr_blit_image"
type status = {
mouse_x : int;
mouse_y : int;
button : bool;
keypressed : bool;
key : char;
}
and event = Button_down | Button_up | Key_pressed | Mouse_motion | Poll
external wait_next_event : Graphics.event list -> Graphics.status
= "gr_wait_event"
val mouse_pos : unit -> int * int
val button_down : unit -> bool
val read_key : unit -> char
val key_pressed : unit -> bool
external sound : int -> int -> unit = "gr_sound"
val auto_synchronize : bool -> unit
external synchronize : unit -> unit = "gr_synchronize"
external display_mode : bool -> unit = "gr_display_mode"
external remember_mode : bool -> unit = "gr_remember_mode"
end`