From: Nicolas C. <war...@fr...> - 2005-05-19 11:58:17
|
> On Thu, May 19, 2005 at 04:34:19PM +0900, Nicolas Cannasse wrote: > > I also have a complete, small, and easy Png library, that can be used > > together with Unzip module to read Png using only ExtLib. If there is some > > interest it could be added to ExtLib. > > A Png library sounds nice, but I'm not sure how appropriate it is for > Extlib. How does it compare to the functionality of camlimages? > > Rich. It's maybe more easy to use than a framework such as camlimages, and is pure Ocaml (it doesn't require additionnal decoding libraries). Here's the mli for review. The full ML source is only 11Ko. Nicolas --- type grey_bits = | GBits1 | GBits2 | GBits4 | GBits8 | GBits16 type grey_alpha_bits = | GABits8 | GABits16 type true_bits = | TBits8 | TBits16 type index_bits = | IBits1 | IBits2 | IBits4 | IBits8 type alpha = | NoAlpha | HaveAlpha type color = | ClGreyScale of grey_bits | ClGreyAlpha of grey_alpha_bits | ClTrueColor of true_bits * alpha | ClIndexed of index_bits type header = { png_width : int; png_height : int; png_color : color; png_interlace : bool; } type chunk_id = string type chunk = | CEnd | CHeader of header | CData of string | CPalette of string | CUnknown of chunk_id * string type png = chunk list type error_msg = | Invalid_header | Invalid_file | Truncated_file | Invalid_CRC | Invalid_colors | Unsupported_colors | Invalid_datasize | Invalid_filter of int | Invalid_array exception Error of error_msg val error_msg : error_msg -> string val is_critical : chunk_id -> bool val is_public : chunk_id -> bool val is_reseverd : chunk_id -> bool val is_safe_to_copy : chunk_id -> bool val header : png -> header val data : png -> string val color_bits : color -> int val parse : IO.input -> png val write : 'a IO.output -> png -> unit val filter : png -> string -> string val make : width:int -> height:int -> pixel:(int -> int -> int32) -> compress:(string -> string) -> png |