Module Archimedes.Backend

module Backend: sig .. end
Module providing a uniform interface and managing the dynamic loading of the backends. This modules is only useful to create new backends and should not be used for plotting data.

type line_cap =
| BUTT (*start(stop) the line exactly at the start(end) point*)
| ROUND (*use a round ending, the center of the circle is the end point*)
| SQUARE (*use squared ending, the center of the square is the end point*)

type line_join =
| JOIN_MITER (*use a sharp (angled) corner*)
| JOIN_ROUND (*use a rounded join, the center of the circle is the joint point*)
| JOIN_BEVEL (*use a cut-off join, the join is cut off at half the line width from the joint point*)

type text_position =
| CC (*centrer horizontally and vertically*)
| LC (*align left horizontally and center vertically*)
| RC (*align right horizontally and center vertically*)
| CT (*center horizontally and align top vertically*)
| CB (*center horizontally and align bottom vertically*)
| LT (*align left horizontally and top vertically*)
| LB (*align left horizontally and bottom vertically*)
| RT (*align right horizontally and top vertically*)
| RB (*align right horizontally and bottom vertically*)

type slant =
| Upright
| Italic
Specifies variants of a font face based on their slant.

type weight =
| Normal
| Bold
Specifies variants of a font face based on their weight.
module type T = sig .. end
The interface that backends must provide to be registered.

type error =
| Corrupted_dependency of string
| Non_loadable_dependency of string * Dynlink.error
| Nonexistent of string (*Cannot find the backend in the directories*)
| Not_loadable of string * Dynlink.error (*Cannot load the backend because of the dynlink error.*)
| Not_registering of string (*Not applying the Archimedes.Backend.Register functor.*)
exception Error of error * string
Exception raised when a backend cannot be loaded.
include Archimedes.Backend.T
val make : ?dirs:string list -> string list -> float -> float -> t
make backend width height creates a new backend of the given dimensions. The units of the dimensions are backend dependent.

The first element of backend is the name (case insensitive) of the underlying engine. It may be followed by one or several options. For example, "Graphics" for the graphics backend or "Cairo"; "PNG"; filename for the Cairo backend, using a PNG surface to be saved to filename. The empty list selects the graphics backend.

val close : t -> unit
Close the handle. For some backends, the output will not be complete until this function is called.
val height : t -> float
Returns the width of the backend canvas.
val width : t -> float
Returns the height of the backend canvas.
val name : t -> string
Returns the name under which the backend was registered.
val registered : unit -> string list
Return the list of registered (i.e. loaded) backends.
val available : dirs:string list -> string list
Return the list of available backends in the given directories.

Registering new modules

module type Capabilities = sig .. end
module Register: 
functor (B : Capabilities) -> sig .. end
The side effect of this functor application is to register the functions of the backend B under the name