package imagelib

  1. Overview
  2. Docs

Module ImageSource

Sourcemodule Pixmap : sig ... end
Sourcetype pixmap =
  1. | Grey of Pixmap.t
  2. | GreyA of Pixmap.t * Pixmap.t
  3. | RGB of Pixmap.t * Pixmap.t * Pixmap.t
  4. | RGBA of Pixmap.t * Pixmap.t * Pixmap.t * Pixmap.t
Sourcetype image = {
  1. width : int;
  2. height : int;
  3. max_val : int;
  4. pixels : pixmap;
}
Sourceval create_rgb : ?alpha:bool -> ?max_val:int -> int -> int -> image

create_rgb ?alpha ?max_val width height is an RGB image of dimensions width * height. Raises Invalid_argument if width or height are negative, or if max_val is not in the range [1;65535].

Sourceval create_grey : ?alpha:bool -> ?max_val:int -> int -> int -> image

create_rgb ?alpha ?max_val width height is a greyscale image of dimensions width * height. Raises Invalid_argument if width or height are negative, or if max_val is not in the range [1;65535].

Sourceval read_rgba : image -> int -> int -> (int -> int -> int -> int -> 'a) -> 'a
Sourceval read_rgb : image -> int -> int -> (int -> int -> int -> 'a) -> 'a
Sourceval read_greya : image -> int -> int -> (int -> int -> 'a) -> 'a
Sourceval read_grey : image -> int -> int -> (int -> 'a) -> 'a
Sourceval write_rgba : image -> int -> int -> int -> int -> int -> int -> unit
Sourceval write_rgb : image -> int -> int -> int -> int -> int -> unit
Sourceval write_greya : image -> int -> int -> int -> int -> unit
Sourceval write_grey : image -> int -> int -> int -> unit
Sourceval fill_rgb : ?alpha:int -> image -> int -> int -> int -> unit

fill_rgb ?alpha image r g b overwrites image with r,g,b colors. TODO

Sourceval fill_alpha : image -> int -> unit
Sourceval copy : image -> image

copy image is a copy of image backed my a new memory allocation, so that the mutations of either copy are independent of each other

Sourceval compare_image : image -> image -> int
Sourceexception Corrupted_image of string
Sourcemodule type ReadImage = sig ... end
Sourcemodule type ReadImageStreaming = sig ... end
Sourcemodule type WriteImage = sig ... end
Sourceexception Not_yet_implemented of string
Sourcemodule Resize : sig ... end
OCaml

Innovation. Community. Security.