Module Cairo


module Cairo: sig .. end
Cairo Graphics


Error reporting



type status =
| SUCCESS
| NO_MEMORY
| INVALID_RESTORE
| INVALID_POP_GROUP
| NO_CURRENT_POINT
| INVALID_MATRIX
| INVALID_STATUS
| NULL_POINTER
| INVALID_STRING
| INVALID_PATH_DATA
| READ_ERROR
| WRITE_ERROR
| SURFACE_FINISHED
| SURFACE_TYPE_MISMATCH
| PATTERN_TYPE_MISMATCH
| INVALID_CONTENT
| INVALID_FORMAT
| INVALID_VISUAL
| FILE_NOT_FOUND
| INVALID_DASH
| INVALID_DSC_COMMENT
| INVALID_INDEX
| CLIP_NOT_REPRESENTABLE
exception Error of status
val init : unit
val version_encode : int -> int -> int -> int
val run_time_version : unit -> int
val run_time_version_string : unit -> string
val compile_time_version : int
val compile_time_version_string : string

Types


type t 
type -'a surface 
type -'a pattern 
type -'a font_face 
type surface_type = [ `BeOS
| `DirectFB
| `Glitz
| `Image
| `PDF
| `PS
| `Quartz
| `SVG
| `Win32
| `XCB
| `Xlib ]
type pattern_type = [ `Linear | `Radial | `Solid | `Surface ] 
type font_type = [ `ATSUI | `FT | `TOY | `Win32 ] 

type content =
| CONTENT_COLOR
| CONTENT_ALPHA
| CONTENT_COLOR_ALPHA

type point = {
   x : float;
   y : float;
}
type matrix = {
   xx : float;
   yx : float;
   xy : float;
   yy : float;
   x0 : float;
   y0 : float;
}

Core API


val create : [> `Any ] surface -> t
val save : t -> unit
val restore : t -> unit
val push_group : ?content:content -> t -> unit
val pop_group : t -> [ `Any ] pattern
val pop_group_to_source : t -> unit
val status : t -> status
val surface_status : [> `Any ] surface -> status
val pattern_status : [> `Any ] pattern -> status
val font_face_status : [> `Any ] font_face -> status
val string_of_status : status -> string

Renderer state



type operator =
| OPERATOR_CLEAR
| OPERATOR_SOURCE
| OPERATOR_OVER
| OPERATOR_IN
| OPERATOR_OUT
| OPERATOR_ATOP
| OPERATOR_DEST
| OPERATOR_DEST_OVER
| OPERATOR_DEST_IN
| OPERATOR_DEST_OUT
| OPERATOR_DEST_ATOP
| OPERATOR_XOR
| OPERATOR_ADD
| OPERATOR_SATURATE
val set_operator : t -> operator -> unit
val set_source : t -> [> `Any ] pattern -> unit
val set_source_rgb : t -> red:float -> green:float -> blue:float -> unit
val set_source_rgba : t -> red:float -> green:float -> blue:float -> alpha:float -> unit
val set_source_surface : t -> [> `Any ] surface -> float -> float -> unit
val set_tolerance : t -> float -> unit

type antialias =
| ANTIALIAS_DEFAULT
| ANTIALIAS_NONE
| ANTIALIAS_GRAY
| ANTIALIAS_SUBPIXEL
val set_antialias : t -> antialias -> unit

type fill_rule =
| FILL_RULE_WINDING
| FILL_RULE_EVEN_ODD
val set_fill_rule : t -> fill_rule -> unit
val set_line_width : t -> float -> unit

type line_cap =
| LINE_CAP_BUTT
| LINE_CAP_ROUND
| LINE_CAP_SQUARE
val set_line_cap : t -> line_cap -> unit

type line_join =
| LINE_JOIN_MITER
| LINE_JOIN_ROUND
| LINE_JOIN_BEVEL
val set_line_join : t -> line_join -> unit
val set_dash : t -> float array -> float -> unit
val set_miter_limit : t -> float -> unit

Transformations


val translate : t -> tx:float -> ty:float -> unit
val scale : t -> sx:float -> sy:float -> unit
val rotate : t -> angle:float -> unit
val transform : t -> matrix -> unit
val set_matrix : t -> matrix -> unit
val identity_matrix : t -> unit
val user_to_device : t -> point -> point
val user_to_device_distance : t -> point -> point
val device_to_user : t -> point -> point
val device_to_user_distance : t -> point -> point

Paths


val new_path : t -> unit
val move_to : t -> x:float -> y:float -> unit
val move_to_point : t -> point -> unit
val new_sub_path : t -> unit
val line_to : t -> x:float -> y:float -> unit
val line_to_point : t -> point -> unit
val curve_to : t ->
x1:float -> y1:float -> x2:float -> y2:float -> x3:float -> y3:float -> unit
val curve_to_point : t -> point -> point -> point -> unit
val arc : t ->
xc:float -> yc:float -> radius:float -> angle1:float -> angle2:float -> unit
val arc_negative : t ->
xc:float -> yc:float -> radius:float -> angle1:float -> angle2:float -> unit
val rel_move_to : t -> dx:float -> dy:float -> unit
val rel_line_to : t -> dx:float -> dy:float -> unit
val rel_curve_to : t ->
dx1:float ->
dy1:float -> dx2:float -> dy2:float -> dx3:float -> dy3:float -> unit
val rectangle : t -> x:float -> y:float -> width:float -> height:float -> unit
val close_path : t -> unit
val paint : t -> unit
val paint_with_alpha : t -> float -> unit
val mask : t -> [> `Any ] pattern -> unit
val mask_surface : t ->
[> `Any ] surface -> surface_x:float -> surface_y:float -> unit
val stroke : t -> unit
val stroke_preserve : t -> unit
val fill : t -> unit
val fill_preserve : t -> unit
val copy_page : t -> unit
val show_page : t -> unit
val in_stroke : t -> point -> bool
val in_fill : t -> point -> bool
val stroke_extents : t -> float * float * float * float
val fill_extents : t -> float * float * float * float
val reset_clip : t -> unit
val clip : t -> unit
val clip_preserve : t -> unit

Text API



type glyph = {
   index : int;
   glyph_x : float;
   glyph_y : float;
}
type text_extents = {
   x_bearing : float;
   y_bearing : float;
   text_width : float;
   text_height : float;
   x_advance : float;
   y_advance : float;
}
type font_extents = {
   ascent : float;
   descent : float;
   font_height : float;
   max_x_advance : float;
   max_y_advance : float;
}
type font_slant =
| FONT_SLANT_NORMAL
| FONT_SLANT_ITALIC
| FONT_SLANT_OBLIQUE

type font_weight =
| FONT_WEIGHT_NORMAL
| FONT_WEIGHT_BOLD

type subpixel_order =
| SUBPIXEL_ORDER_DEFAULT
| SUBPIXEL_ORDER_RGB
| SUBPIXEL_ORDER_BGR
| SUBPIXEL_ORDER_VRGB
| SUBPIXEL_ORDER_VBGR

type hint_style =
| HINT_STYLE_DEFAULT
| HINT_STYLE_NONE
| HINT_STYLE_SLIGHT
| HINT_STYLE_MEDIUM
| HINT_STYLE_FULL

type hint_metrics =
| HINT_METRICS_DEFAULT
| HINT_METRICS_OFF
| HINT_METRICS_ON
val font_face_get_type : [> `Any ] font_face -> [ `ATSUI | `Any | `FT | `TOY | `Win32 ]
val font_face_downcast_to_toy : [> `Any ] font_face -> [ `Any | `TOY ] font_face

Font options


module Font_Options: sig .. end
Font options functions

Scaled Fonts API


module Scaled_Font: sig .. end
Scaled fonts functions
val select_font_face : t -> string -> font_slant -> font_weight -> unit
val set_font_size : t -> float -> unit
val set_font_matrix : t -> matrix -> unit
val get_font_matrix : t -> matrix
val set_font_options : t -> Font_Options.t -> unit
val merge_font_options : t -> Font_Options.t -> unit
val get_font_options : t -> Font_Options.t
val set_scaled_font : t -> [> `Any ] Scaled_Font.t -> unit
val show_text : t -> string -> unit
val show_glyphs : t -> glyph array -> unit
val get_font_face : t -> [ `Any ] font_face
val font_extents : t -> font_extents
val set_font_face : t -> [> `Any ] font_face -> unit
val text_extents : t -> string -> text_extents
val glyph_extents : t -> glyph array -> text_extents
val text_path : t -> string -> unit
val glyph_path : t -> glyph array -> unit

Renderer state querying


val get_operator : t -> operator
val get_source : t -> [ `Any ] pattern
val get_tolerance : t -> float
val get_antialias : t -> antialias
val get_current_point : t -> point
val get_fill_rule : t -> fill_rule
val get_line_width : t -> float
val get_line_cap : t -> line_cap
val get_line_join : t -> line_join
val get_miter_limit : t -> float
val get_matrix : t -> matrix
val get_target : t -> [ `Any ] surface
val get_group_target : t -> [ `Any ] surface
type flat_path = [ `CLOSE | `LINE_TO of point | `MOVE_TO of point ] 
type path = [ `CLOSE
| `CURVE_TO of point * point * point
| `LINE_TO of point
| `MOVE_TO of point ]
val fold_path : t -> ('a -> [> path ] -> 'a) -> 'a -> 'a
val fold_path_flat : t -> ('a -> [> flat_path ] -> 'a) -> 'a -> 'a
val append_path : t -> [< path ] -> unit

Surface API


val surface_create_similar : [> `Any ] surface ->
content -> width:int -> height:int -> [ `Any ] surface
val surface_finish : [> `Any ] surface -> unit
val surface_get_type : [> `Any ] surface ->
[ `Any
| `BeOS
| `DirectFB
| `Glitz
| `Image
| `PDF
| `PS
| `Quartz
| `SVG
| `Win32
| `XCB
| `Xlib ]
val surface_get_content : [> `Any ] surface -> content
val surface_get_font_options : [> `Any ] surface -> Font_Options.t
val surface_flush : [> `Any ] surface -> unit
val mark_dirty : [> `Any ] surface -> unit
val mark_dirty_rectangle : [> `Any ] surface -> int -> int -> int -> int -> unit
val surface_set_device_offset : [> `Any ] surface -> float -> float -> unit
val surface_get_device_offset : [> `Any ] surface -> float * float
val surface_set_fallback_resolution : [> `Any ] surface -> float -> float -> unit

Image surface


type image_surface = [ `Any | `Image ] surface 

type format =
| FORMAT_ARGB32
| FORMAT_RGB24
| FORMAT_A8
| FORMAT_A1
val image_surface_create : format -> width:int -> height:int -> image_surface
val image_surface_get_format : [> `Image ] surface -> format
val image_surface_get_width : [> `Image ] surface -> int
val image_surface_get_height : [> `Image ] surface -> int
val image_surface_get_stride : [> `Image ] surface -> int

Patterns


type solid_pattern = [ `Any | `Solid ] pattern 
type surface_pattern = [ `Any | `Surface ] pattern 
type gradient_pattern = [ `Any | `Gradient ] pattern 

type extend =
| EXTEND_NONE
| EXTEND_REPEAT
| EXTEND_REFLECT

type filter =
| FILTER_FAST
| FILTER_GOOD
| FILTER_BEST
| FILTER_NEAREST
| FILTER_BILINEAR
| FILTER_GAUSSIAN
module Pattern: sig .. end
Patterns functions

Matrix API


module Matrix: sig .. end
Matrix functions