package archimedes
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=6c27810ecc964480a95584bdab10c5fd2784d530395c1a464f43be18f6f363be
md5=7f3bd1771751a074e4b4d2ccc5213260
doc/archimedes/Archimedes/Backend/module-type-T/index.html
Module type Backend.T
The interface that backends must provide to be registered.
val set_line_width : t -> float -> unitset_color bk c sets the color of the backend bk to c.
set_line_width bk w sets the line width of the backend bk to w. The line width is expressed in the natural backend coordinates (i.e. when the CTM is the identity).
set_line_width bk w sets the line width of the backend bk to w. The line width is expressed in the natural backend coordinates (i.e. when the CTM is the identity).
set_line_cap bk c sets the line cap for the backend bk to c.
val set_dash : t -> float -> float array -> unitset_line_cap bk c sets the line cap for the backend bk to c.
set_dash bk ofs pattern
set_dash bk ofs pattern
set_line_join bk j sets the line join for the backend bk to j.
val get_line_width : t -> floatval get_dash : t -> float array * floatval move_to : t -> float -> float -> unitBegin a new sub-path. After this call the current point will be (x, y).
val line_to : t -> float -> float -> unitBegin a new sub-path. After this call the current point will be (x, y).
line_to bk x y Adds a line to the path from the current point to position (x, y) in the current backend coordinates. After this call the current point will be (x, y).
If there is no current point before the call to line_to this function will behave as move_to bk x y.
val rel_move_to : t -> float -> float -> unitval rel_line_to : t -> float -> float -> unitval curve_to : t -> float -> float -> float -> float -> float -> float -> unitcurve_to bk x1 y1 x2 y2 x3 y3 adds an Bezier curve to the path, starting at the current point, ending at point (x3,y3), with control points (x1,y1) and (x2,y2).
val rectangle : t -> float -> float -> w:float -> h:float -> unitrectangle bk x y w h adds to the current path of bk a rectangle whose lower left corner is at (x,y) and width and height are respectively w and h.
val arc : t -> r:float -> a1:float -> a2:float -> unitarc bk r a1 a2 add an arc to the current path starting from the current point with a radius r, starting at angle a1 and going clockwise to angle a2.
val close_path : t -> unitAdds a line segment to the path from the current point to the beginning of the current sub-path (the most recent point passed to Archimedes.Backend.T.move_to) and closes this sub-path.
val clear_path : t -> unitAdds a line segment to the path from the current point to the beginning of the current sub-path (the most recent point passed to Archimedes.Backend.T.move_to) and closes this sub-path.
Clears the current path. After this call there will be no path. Nothing is guaranteed about the current point (it may not be preserved).
val path_extents : t -> Matrix.rectangleClears the current path. After this call there will be no path. Nothing is guaranteed about the current point (it may not be preserved).
val stroke : t -> unitstroke bk draw the curve described by the current path according to the current line width and color.
val stroke_preserve : t -> unitstroke bk draw the curve described by the current path according to the current line width and color.
Same as stroke but make sure the current path is unmodified.
val fill : t -> unitSame as stroke but make sure the current path is unmodified.
fill bk draw the curve described by the current path according to the current line width and color. The current path may be modified. This is affected by the CTM.
val fill_preserve : t -> unitfill bk draw the curve described by the current path according to the current line width and color. The current path may be modified. This is affected by the CTM.
Same as fill but make sure the current path is unmodified.
stroke_path bk p stroke the abstract path p, where its coordinates are interpreted in the current transformation matrix. Of course, the current clipping, line width and color are be obeyed. This function may modify the current path in bk.
For backend developers: the internal representation of the path is available in Archimedes_internals.Path.
stroke_path bk p stroke the abstract path p, where its coordinates are interpreted in the current transformation matrix. Of course, the current clipping, line width and color are be obeyed. This function may modify the current path in bk.
For backend developers: the internal representation of the path is available in Archimedes_internals.Path.
fill_path_preserve is similar to stroke_path_preserve except that it fills the path.
fill_with_color t c fill the current path of t with the color c. Even if the color is transparent, it must replace all underlying elements (contrarily to Backend.T.fill which will show the underlying elements through a transparent color). If transparency is not supported by the backend, it does the same as Backend.T.fill, except that this operation does not change the current color of the backend. It may modify the current path however.
val show : t -> unitSome backends may not show immediately the action of stroke, fill, stroke_path_preserve,... immediately (usually because it is expensive but also to avoid flicker during animations). show bk forces the backend to update.
val clip_rectangle : t -> float -> float -> w:float -> h:float -> unitEstablishes a new clip rectangle by intersecting the current clip rectangle. This may clear the current path. Calling clip_rectangle can only make the clip region smaller, never larger. For clip_rectangle to have only a local effect, put it in a save / restore group.
clip_rectangle is garantee to respect the CTM only if the components xy and yx of the matrix are both 0..
val save : t -> unitSave the current state of the backend. Note that save/restore must not affect the current path.
val restore : t -> unitSave the current state of the backend. Note that save/restore must not affect the current path.
Restore the saved state of the backend.
val translate : t -> float -> float -> unittranslate cr tx ty modifies the current transformation matrix by translating the user-space origin by (tx,ty).
val scale : t -> float -> float -> unittranslate cr tx ty modifies the current transformation matrix by translating the user-space origin by (tx,ty).
scale sx sy modifies the current transformation matrix by scaling the X and Y user-space axes by sx and sy respectively.
val rotate : t -> float -> unitscale sx sy modifies the current transformation matrix by scaling the X and Y user-space axes by sx and sy respectively.
Modifies the current transformation matrix by rotating the user-space axes by angle radians.
Modifies the current transformation matrix by rotating the user-space axes by angle radians.
Set the current transformation matrix which is the matrix transorming user to device coordinates.
Set the current transformation matrix which is the matrix transorming user to device coordinates.
Return the current transformation matrix. Modifying this matrix does not affect the matrix held in t.
val flipy : t -> boolReturn the current transformation matrix. Modifying this matrix does not affect the matrix held in t.
true iff this kind of device has its Y axis pointing downwards. FIXME: really needed ? Beware that on some devices, the font display happens in the current coordinates.
select_font_face t slant weight family selects a family and style of font from a simplified description as a family name, slant and weight. Family names are bakend dependent. Raise an exception if the face is not supported.
val set_font_size : t -> float -> unitselect_font_face t slant weight family selects a family and style of font from a simplified description as a family name, slant and weight. Family names are bakend dependent. Raise an exception if the face is not supported.
Set the scaling of the font.
val text_extents : t -> string -> Matrix.rectangleSet the scaling of the font.
Returns a rectangle whose width and height specify respectively the length and the height of the text. The x and y values give the lower bottom point of the rectangle as if the text was placed at the origin.
val show_text :
t ->
rotate:float ->
x:float ->
y:float ->
text_position ->
string ->
unitReturns a rectangle whose width and height specify respectively the length and the height of the text. The x and y values give the lower bottom point of the rectangle as if the text was placed at the origin.
show_text t angle x y pos txt displays txt at the point (x,y) as indicated by pos. The point (x,y) is in the current coordinate system but the current transformation matrix will NOT be applied to the text itself. angle indicates by how many radians the text must be rotated w.r.t. the x-axis (in the current coordinate system, assuming it is orthonormal) -- not all device support rotations of angles <> 0. (in device coordinates). This is an immediate operation: no stroke nor fill are required (nor will have any effect).