package graphv_webgl

  1. Overview
  2. Docs

This module is ready for use by user applications. It combines the Graphv_webgl_impl module with the Graphv_font_js module to produce a new vector library.

module CreateFlags : sig ... end

Flags for rendering quality.

type t

Creates a new renderer from a WebGL context. Make sure the stencil buffer is enabled for the WebGL context.

module Align : sig ... end

Text alignment flags.

module BlendFactor : sig ... end

Blending modes used for compositing. The current blend mode determines how a fill or stroke is composited to the current framebuffer. See here for more information on the different blending modes.

module Bounds : sig ... end
module Buffer : sig ... end

This module exposes the native platforms buffer. Can be used for copy-free interop.

module Color : sig ... end

Operations on colors.

module CompositeOperation : sig ... end
module CompositeOperationState : sig ... end
module ImageFlags : sig ... end
module LineCap : sig ... end
module LineJoin : sig ... end
module Matrix : sig ... end

A module for basic 2x2 (+2) matrix operations.

module Winding : sig ... end
module FloatOps : sig ... end

A module for swapping the default integer operators with floating point operators.

val save : t -> unit

Saves all context state to be restored later. Must have a corresponding restore call in order to be correct. Saves and restores happen in LIFO (stack) order.

val restore : t -> unit

Restore a previously saved state. Must have a previous save call in order to be correct. Saves and restores happen in LIFO (stack) order.

val reset : t -> unit

Reset the current state to default settings. Only affects the current state, not an previously saved states. Does not clear any saved states.

val set_device_pixel_ratio : t -> float -> unit
val set_shape_antialias : t -> enabled:bool -> unit
val set_miter_limit : t -> limit:float -> unit
val set_stroke_width : t -> width:float -> unit
val set_line_cap : t -> cap:LineCap.t -> unit
val set_line_join : t -> join:LineJoin.t -> unit
val begin_frame : t -> width:float -> height:float -> device_ratio:float -> unit

Start a fresh frame. Resets all state.

  • parameter width

    The width of the viewport area.

  • parameter height

    The height of the viewport area.

  • parameter device_ratio

    The scaling factor for the render. Also known as the Device Pixel Ratio. Use this to get pixel-perfect rendering on high-resolution displays.

val cancel_frame : t -> unit

Cancels a built up frame. Should call begin_frame to start a new render.

val end_frame : t -> unit

Flush and render the frame to the screen. Nothing is drawn until this method is called. Alternatively can call cancel_frame to not render the build up frame.

module Transform : sig ... end
module Scissor : sig ... end
module Global : sig ... end
val fill : t -> unit

Fill the last created path. You can call both stroke and fill for a given path. The path is not cleared until Path.begin_ is called again.

val stroke : t -> unit

Stroke the last created path. You can call both stroke and fill for a given path. The path is not cleared until Path.begin_ is called again

module Path : sig ... end

Draw shapes.

module Image : sig ... end
module Paint : sig ... end

Create various fill and stroke effects.

val set_fill_color : t -> color:Color.t -> unit
val set_fill_paint : t -> paint:Paint.t -> unit
val set_stroke_color : t -> color:Color.t -> unit
val set_stroke_paint : t -> paint:Paint.t -> unit
module Text : sig ... end

Module for text rendering. Text is rendered using a glyph bitmap. The default bitmap size is 2048x2048. It is possible to run out of space in this bitmap so try to be conservative with font sizes and number of fonts. Glyphs are grouped by font, size, and blur. A glyph will be rendered once per combination of properties.

OCaml

Innovation. Community. Security.