package camlimages

  1. Overview
  2. Docs

Colormap for RGB

type t = rgb
val square_distance : t -> t -> int

Square distance of colors

val plus : t -> t -> t

Adding colors. No overflow is considered.

val minus : t -> t -> t

Subtracting colors. No underflow is considered.

val size : t map -> int

size of the color map

val find_exact : t map -> t -> int

Find the given color in the colormap and returns the color index. Not_found may be raised.

val add_color : t map -> t -> int

add_color map c adds c to map if c is not in map. The function returns the color index for c. It may raise Too_many_colors.

val add_colors : t map -> t list -> int list

add_colors is as same as add_color but it adds multiple colors

val find_nearest : t map -> t -> int

find_nearest map c returns a color index of map which is the nearest to c. The color distance is given by square_distance.

OCaml

Innovation. Community. Security.