module Gctx:sig..end
The drawing primitives in this module are all relative to the graphics context. This means that when a widget needs to draw on the screen, it need not know its absolute position. The graphics context is responsible for translating the relative positions passed into the drawing routines into absolute positions on the screen.
The graphics context also includes other information for basic drawing (such as the current pen color.)
Note that this module defines a persistent (immutable) data structure. The
operations here use a given graphics context to create a new one with the
specified characteristics. They do not modify their arguments.
type gctx
type color = {
|
r : |
|
g : |
|
b : |
0 .. 255 inclusiveval black : color
val white : color
val red : color
val green : color
val blue : color
val yellow : color
val cyan : color
val magenta : colorval open_graphics : unit -> unitval top_level : gctxval translate : gctx -> int * int -> gctxval with_color : gctx -> color -> gctxtypeposition =int * int
typedimension =int * int
val draw_line : gctx -> position -> position -> unitval draw_string : gctx -> position -> string -> unitval draw_rect : gctx -> position -> dimension -> unitval fill_rect : gctx -> position -> dimension -> unitval draw_ellipse : gctx -> position -> int -> int -> unitval text_size : string -> dimensiontype event
type event_type =
| |
KeyPress of |
| |
MouseDown |
| |
MouseUp |
| |
MouseMove |
| |
MouseDrag |
val event_type : event -> event_typeval event_pos : event -> gctx -> positionval wait_for_event : unit -> eventval make_test_event : event_type -> position -> event