package camlimages

  1. Overview
  2. Docs
Image processing library

Install

Dune Dependency

Authors

Maintainers

Sources

camlimages-5.0.3.tar.bz2
sha256=b8203da78a9733488e40fafccfafb874c9ebafd8a5f1fa1d9a46ae2ac241e97a
md5=7dd5aa1944d01d2e908d4caa1e1bba78

doc/src/camlimages.core/oColor.ml.html

Source file oColor.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
(***********************************************************************)
(*                                                                     *)
(*                           Objective Caml                            *)
(*                                                                     *)
(*            François Pessaux, projet Cristal, INRIA Rocquencourt     *)
(*            Pierre Weis, projet Cristal, INRIA Rocquencourt          *)
(*            Jun Furuse, projet Cristal, INRIA Rocquencourt           *)
(*                                                                     *)
(*  Copyright 1999-2004,                                               *)
(*  Institut National de Recherche en Informatique et en Automatique.  *)
(*  Distributed only by permission.                                    *)
(*                                                                     *)
(***********************************************************************)

(* $Id: oColor.ml,v 1.1 2006/11/28 15:43:28 rousse Exp $*)

(** Class interface for Color *)

open Color

class virtual ['a] map (cmap : 'a Color.map) = object
  val mapobj = cmap
  method colormap = mapobj
  
  method max = mapobj.max
  method map = mapobj.map
  
  method query_color x = if x < size cmap then cmap.map.(x) else raise Not_found
  
  method set_max max = mapobj.max <- max
  method set_map map = mapobj.map <- map
  
  method size = size mapobj
  method find_exact = find_exact mapobj
  method add_color = add_color mapobj
  method add_colors = add_colors mapobj
  method virtual find_nearest : 'a -> int
end

class rgbmap (cmap : rgb Color.map) = object
  inherit [rgb] map cmap
  method find_nearest = Rgb.find_nearest mapobj
end

class rgbamap (cmap : rgba Color.map) = object
  inherit [rgba] map cmap
  method find_nearest = Rgba.find_nearest mapobj
end

class cmykmap (cmap : cmyk Color.map) = object
  inherit [cmyk] map cmap
  method find_nearest = Cmyk.find_nearest mapobj
end
OCaml

Innovation. Community. Security.