package vg
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha512=ccd0d0f61cdbdb3420b5f4d747fe6e6b95e487738f70163a6e26396b1eeb9a42118306bc9c2c9afc9256171d57f81fbdf08ec558625eb5d723230aa0e9564fb6
doc/vg/Vg/Vgr/Private/index.html
Module Vgr.Private
Private functions for implementing renderers.
Warning. Vg users should not use these definitions, they exposes Vg's internals for implementing renderers. This functionality is subject to change even between minor versions of the library.
In order to provide a consistant interface for Vg users, renderer writers should follow the guidelines below. You may want to drop an email to the maintainer for help and discussion.
- If you render to "Bla", define you renderer in a module called
Vgr_bla(lowercase). - The renderer target creation function must be named
Vgr_bla.target. - Images must be rendered via the
renderfunction. If you are writing a batch renderer provide support for each of thedsttypes and especially the non-blocking interface. - Respect Vg's linear sRGB color model.
- Whenever possible use an XMP metadata packet for metadata, see
Vgr.xmp. - The renderer should implement the rendering cost model, see the
limitparameter ofrender. - Follow
Vg's coordinate system conventions to specify the relationship between a target and the view rectangle to render. - If the renderer doesn't support
Vg's full rendering model or diverges from its semantics it must ignore unsupported features and warn the client via thewarnfunction.
Internal data
module Data : sig ... endInternal data.
module Font : sig ... endFont helpers.
module P : sig ... endPaths helpers.
module I : sig ... endImage helpers
Renderers
type k = renderer -> [ `Ok | `Partial ]The type for renderer continuations.
type render_fun =
[ `End | `Image of Gg.size2 * Gg.box2 * Data.image ] ->
k ->
kThe type for rendering functions.
type 'a render_target = renderer -> 'a -> bool * render_fun constraint 'a = [< dst ]The type for render targets. The function takes a created renderer and its destination. It should return a boolean indicating whether multiple images can be rendered on the target, and a function that is invoked by the renderer to render a new image or end the rendering sequence.
val create_target : 'a render_target -> 'a targetcreate_target t makes an end-user render target from t.
val limit : renderer -> intlimit r is r's render limit.
partial k r suspends the renderer r and returns `Partial. Rendering will continue with k r, on render `Await.
Writing dst_stored destinations
flush k r flushes the renderer r. If r writes on a stored destination this function must be called by the rendering function on `End.
writeb b k r writes the byte b and kontinues.
writes s j l k r writes l bytes from s starting at j and kontinues.
writebuf buf j l k r write l bytes from buf starting at j and kontinues.
Miscellaneous
val add_xml_data : Buffer.t -> string -> unitadd_xml_data b s adds s to b, escapes '<', '>', '&' and '"' (but not single quotes) and maps illegal XML unicode characters to the replacement character U+FFFD.