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