package mm

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

Operations on images stored in YUV420 format, ie one luma (Y) and two chrominance (U and V) channels.

type t = ImageYUV420.t

An image in YUV420 format.

val make : int -> int -> ?alpha:Data.t -> Data.t -> int -> Data.t -> Data.t -> int -> t

Create an image with given width, height, alpha channel, Y (with given stride) U and V (with given stride). The strides of U and V are the same, the stride of the alpha channel is the same as Y.

val make_data : int -> int -> Data.t -> int -> int -> t
val create : ?blank:bool -> ?y_stride:int -> ?uv_stride:int -> int -> int -> t
val ensure_alpha : t -> unit

Ensure that the image has an alpha channel.

val remove_alpha : t -> unit
val of_YUV420_string : ?y_stride:int -> ?uv_stride:int -> string -> int -> int -> t
val of_RGB24_string : string -> int -> t
val of_RGBA32 : RGBA32.t -> t
val to_RGBA32 : t -> RGBA32.t
val to_BMP : t -> string
val of_PPM : string -> t
val width : t -> int

Width of an image.

val height : t -> int

Height of an image.

val y : t -> Data.t
val y_stride : t -> int
val u : t -> Data.t
val v : t -> Data.t
val uv_stride : t -> int
val data : t -> Data.t * Data.t * Data.t
val alpha : t -> Data.t option
val set_alpha : t -> Data.t option -> unit
val dimensions : t -> int * int
val size : t -> int

Size in bytes.

val has_alpha : t -> bool

Whether the image has an alpha channel.

val copy : t -> t
val blit_all : t -> t -> unit
val blit : t -> t -> unit
val scale : ?proportional:bool -> t -> t -> unit

Scale one image in order to fill the other. By default, proportions are not preserved.

val blank_all : t -> unit
val add : t -> ?x:int -> ?y:int -> t -> unit

Add the fist image to the second at given offset.

val blank : t -> unit
val fill : t -> Pixel.yuv -> unit
val hmirror : t -> unit

Flip image horizontally.

val is_opaque : t -> bool

Whether the image is opaque (it has no transparent or semi-transparent pixel).

val optimize_alpha : t -> unit

Optimize the α channel by removing it in the case the image is opaque.

val fill_alpha : t -> int -> unit
val disk_alpha : t -> int -> int -> int -> unit
val alpha_of_color : t -> Pixel.yuv -> int -> unit
val alpha_of_sameness : t -> t -> int -> unit

Takes a reference image and an image, and make similar portions transparent on the second (the last parameter controls the tolerance). This is useful to make bluescreens withtout bluescreens.

val alpha_of_diff : t -> t -> int -> int -> unit

alpha_of_diff prev curr level speed takes a previous image and a current image and make parts of the current image more transparent if they were the same. level is the distance at which we consider two colors to be the same and speed is the inverse of the convergence speed.

val box_alpha : t -> int -> int -> int -> int -> float -> unit

box_alpha img x y width height alpha sets alpha value on a given image box.

val alpha_to_y : t -> unit

Remove alpha channel and set it as Y channel. Useful to inspect the alpha channel.

val randomize : t -> unit
val rotate : t -> int -> int -> float -> t -> unit
val gradient_uv : t -> (int * int) -> (int * int) -> (int * int) -> unit

Fill the image with a gradient. It takes as argument the (U,V) at pixel (0,0), at pixel (xmax,0) and at pixel (0,ymax).

val get_pixel_y : t -> int -> int -> int
val get_pixel_u : t -> int -> int -> int
val get_pixel_v : t -> int -> int -> int
val get_pixel_rgba : t -> int -> int -> Pixel.rgba
val set_pixel_rgba : t -> int -> int -> Pixel.rgba -> unit
val to_int_image : t -> int array array

Convert to format useable by Graphics.make_image.

module Effect : sig ... end