Module Cairo_render.General

Generic output, taking a function setting the styles for Cairo.

Parameters

Signature

include Cosmetyc.Signatures.Output with type error = cairo_error with module Repr = Repr
type _ t

We assume a type representing a stream of written object. No function to create such flux are included in this signature, but we expect each output module to come with its own way of generating flux. The type is parameterised by the expected output when closing the flux. It is possible to choose unit as a parameter in the case where the output is done with side-effects.

module Repr = Repr
type error = cairo_error
exception Invalid_output of error
val error_to_string : error -> string

Print-out the error.

val write_node : _ t -> Repr.Node.t -> unit

Write a node.

val write_nodes : _ t -> Repr.Node.t Stdlib.Seq.t -> unit

Write multiple nodes.

val write_way : _ t -> Repr.Way.t -> unit

Write a way.

val write_ways : _ t -> Repr.Way.t Stdlib.Seq.t -> unit

Write multiple ways.

val write_relation : _ t -> Repr.Relation.t -> unit

Write a relation.

val write_relations : _ t -> Repr.Relation.t Stdlib.Seq.t -> unit

Write multiple relations.

val write_object : _ t -> Repr.Object.t -> unit

Write an object.

val write_objects : _ t -> Repr.Object.t Stdlib.Seq.t -> unit

Write multiple objects.

val close : 'a. 'a t -> 'a

Close an output, returning the final object.

type surface = Cairo.Surface.t

An abstract representation of all different drawing targets that Cairo can render to; the actual drawings are performed using a Cairo context.

type canvas = Cairo.context

Style of the render. Dependent to each module implementation.

val open_out : file_info -> Cosmetyc.Common.Bbox.Wrap.t -> float -> ?background:(float * float * float * float) -> ?draw_scale:bool -> ?copyright:string -> style -> unit t

Open an output flux of objects that will be rendered on an image. It takes as arguments a description of the image's properties, the bounding box of the rendering, the scale factor (in pixels per meter), and the style (see for instance module General below). Optionally, the background color can be added. One can also enable or disable the drawing of the scale or change the copyright information (note that due to OpenStreetMap's licence, it has to be said that information coming from OpenStreetMap comes from OpenStreetMap).