package mm

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

Operations on images stored in RGBA32 format (ie RGB channels + an alpha channel, one byte for each).

module Color : sig ... end
type t

An image.

val width : t -> int
val height : t -> int
val dimensions : t -> int * int
val data : t -> data
val size : t -> int
val stride : t -> int
val create : int -> int -> t
val make : ?stride:int -> int -> int -> data -> t
val get_pixel : t -> int -> int -> Color.t
val set_pixel : t -> int -> int -> Color.t -> unit
val get_pixel_rgba : t -> int -> int -> Pixel.rgba
val set_pixel_rgba : t -> int -> int -> Pixel.rgba -> unit
val copy : t -> t
val blit : ?blank:bool -> ?x:int -> ?y:int -> ?w:int -> ?h:int -> t -> t -> unit
val blit_all : t -> t -> unit

blit_all src dst copies all the contents of src into dst.

Conversions from/to other formats

val of_RGB24_string : string -> int -> t
val to_RGB24_string : t -> string
val of_BGRA : BGRA.t -> t
val to_BGRA : t -> BGRA.t
val to_int_image : t -> int array array
val to_BMP : t -> string
val of_PPM : ?alpha:RGB8.Color.t -> string -> t
val swap_rb : t -> unit

Swap red and blue channels. Useful for quickly handling BGRA formats.

Manipulation of images

val add : ?x:int -> ?y:int -> ?w:int -> ?h:int -> t -> t -> unit
val fill_all : t -> Color.t -> unit
val blank_all : t -> unit
val fill_alpha : t -> int -> unit
val blank : t -> unit
val randomize_all : t -> unit
val randomize : t -> unit
val scale : ?proportional:bool -> t -> t -> unit

scale src dst scales the image src to dst.

module Scale : sig ... end
module Effect : sig ... end
module Draw : sig ... end
module Motion : sig ... end