package mm

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

Module Image.YUV420Source

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

An image in YUV420 format.

Sourceval 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.

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

Ensure that the image has an alpha channel.

Sourceval remove_alpha : t -> unit
Sourceval of_YUV420_string : ?y_stride:int -> ?uv_stride:int -> string -> int -> int -> t
Sourceval of_RGB24_string : string -> int -> t
Sourceval of_RGBA32 : RGBA32.t -> t
Sourceval to_RGBA32 : t -> RGBA32.t
Sourceval of_bitmap : ?fg:Pixel.rgba -> ?bg:Pixel.rgba -> Bitmap.t -> t
Sourceval to_BMP : t -> string
Sourceval of_PPM : string -> t
Sourceval width : t -> int

Width of an image.

Sourceval height : t -> int

Height of an image.

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

Size in bytes.

Sourceval has_alpha : t -> bool

Whether the image has an alpha channel.

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

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

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

Add the fist image to the second at given offset.

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

Flip image horizontally.

Sourceval is_opaque : t -> bool

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

Sourceval optimize_alpha : t -> unit

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

Sourceval fill_alpha : t -> int -> unit
Sourceval disk_alpha : t -> int -> int -> int -> unit
Sourceval alpha_of_color : t -> Pixel.yuv -> int -> unit
Sourceval 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.

Sourceval 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.

Sourceval 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.

Sourceval alpha_to_y : t -> unit

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

Sourceval randomize : t -> unit
Sourceval rotate : t -> int -> int -> float -> t -> unit
Sourceval 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).

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

Convert to format useable by Graphics.make_image.

Sourcemodule Effect : sig ... end
OCaml

Innovation. Community. Security.