package camlimages

  1. Overview
  2. Docs
Image processing library

Install

dune-project
 Dependency

Authors

Maintainers

Sources

camlimages-5.0.4.tar.bz2
sha256=1c9a68bdc3d348c9f859d490dadf384926213e47a584159832f7fc4a20242865
md5=1ddba74d210b86a899b5d6565f45c2dc

doc/camlimages.core/Color/index.html

Module ColorSource

Definition of colormaps, i.e. mappings from real RGB colors to integers. The integer corresponding to a color c is an index i into a vector of colors whose ith element is c.

Sourceexception Too_many_colors

An exception raised when too many number of colors are used for a given color model.

Sourcetype 'a map = {
  1. mutable max : int;
  2. mutable map : 'a array;
}

Colormap

Colormap manipulation functions

Sourceval size : 'a map -> int

Returns the size of a colormap.

Sourceval find_exact : 'a map -> 'a -> int

Finds a color in the colormap and returns its color index. Raises exception Not_found if the color is not in the colormap.

Sourceval add_color : 'a map -> 'a -> int

Add a new color into the given colormap and return its index. If the color is already in the colormap, it is not added again, and the corresponding color index is returned.

Sourceval add_colors : 'a map -> 'a list -> int list

Add the list of new colors into the given colormap and return their indices. If a color is already in the colormap, it is not added again, and the corresponding color index is returned.

Sourceval copy : 'a map -> 'a map

Copy a colormap

Sourcemodule type S = sig ... end
Sourcetype rgb = {
  1. mutable r : int;
  2. mutable g : int;
  3. mutable b : int;
}

R(ed), G(reen), B(lue) representation of colors.

Sourcemodule Rgb : S with type t = rgb

Colormap for RGB

Sourcetype rgba = {
  1. color : rgb;
  2. mutable alpha : int;
}

RGB with alpha (transparent) information

Sourcemodule Rgba : sig ... end

Colormap for RGBA

Sourcetype cmyk = {
  1. mutable c : int;
  2. mutable m : int;
  3. mutable y : int;
  4. mutable k : int;
}

Cyan Magenta Yellow blacK color model

Sourcemodule Cmyk : S with type t = cmyk

Colormap for CMYK

Rgb specialized functions (for backward compatibility)

Sourceval rgb_square_distance : rgb -> rgb -> int

Compute the distance between two colours.

Sourceval plus : rgb -> rgb -> rgb
Sourceval minus : rgb -> rgb -> rgb
Sourceval brightness : rgb -> int

Color name parser

Sourceval color_parse : string -> rgb

Color name parser function.

It queries the name in the color name database given by the file Camlimages.path_rgb_txt. It also understands the following color format:

"#rrggbb" where r,g and b are 0-9a-fA-F "#rrrrggggbbbb" where r,g and b are 0-9a-fA-F

It may raise Failure if not found.

Sourceval colormap_parse : string array -> rgb array * int

Same as color_parse but work for multiple names.

If a color of the result has a minus value for its R component, it is considered transparent and replaced by r=0 g=255 b=0. The function returns the last transparent color index.

OCaml

Innovation. Community. Security.