package mm

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type t

A canvas.

val create : int -> int -> t

Create an empty canvas.

val make : ?width:int -> ?height:int -> ?x:int -> ?y:int -> Mm_image__ImageYUV420.t -> t

Create a canvas containing a given image. Negative dimensions are ignored, default ones are those of the image.

val width : t -> int

Width of the image.

val height : t -> int

Height of the image.

val viewport : ?x:int -> ?y:int -> int -> int -> t -> t

Change the width and height of the viewport of the canvas.

val size : t -> int

Size of a canvas in bytes.

val planes : t -> int

Number of planes in the image.

val add : t -> t -> t

Add two canvas. The first one is on top of the second one.

val covering : t -> bool

Whether the canvas covers the whole area with images (this function is imprecise: it might have false negatives).

val render : ?fresh:bool -> ?transparent:bool -> t -> Mm_image__ImageYUV420.t

Render the canvas as an image. If fresh is set to true, the resulting can be modified in place. If transparent is set to true, the non-covered portions are made transparent.

val rendered : ?transparent:bool -> t -> t

Rendered canvas.

val map : (Mm_image__ImageYUV420.t -> Mm_image__ImageYUV420.t) -> t -> t

Map a function on the underlying image. This of course triggers a render of the canvas.

val iter : (Mm_image__ImageYUV420.t -> unit) -> t -> t

Execute a function on the rendering of the canvas.

val translate : int -> int -> t -> t

Translate the image.

val bounding_box : t -> (int * int) * (int * int)

Bouding box (smallest box enclosing all images contained in the canavs): returns the lower-left corner and the dimensions.

val scale : ?scaler:(Mm_image__ImageYUV420.t -> Mm_image__ImageYUV420.t -> unit) -> Fraction.t -> Fraction.t -> t -> t

Scale the image proportionally by fractional coefficients with given numerator and denominator in the x and y directions. The viewport is left untouched. The scaler parameter can be specified in order to use a particular function to scale individual images. The viewport is left unchanged.

val resize : ?proportional:bool -> ?scaler:(Mm_image__ImageYUV420.t -> Mm_image__ImageYUV420.t -> unit) -> int -> int -> t -> t

Resize the image, scaling and changing the viewport.

module Draw : sig ... end
OCaml

Innovation. Community. Security.