~ubuntu-branches/ubuntu/oneiric/haxe/oneiric

« back to all changes in this revision

Viewing changes to ocaml/swflib/swfPic.ml

  • Committer: Bazaar Package Importer
  • Author(s): Jens Peter Secher
  • Date: 2009-03-18 23:09:50 UTC
  • mfrom: (3.1.1 experimental)
  • Revision ID: james.westby@ubuntu.com-20090318230950-pgfuxg2ucolps74t
Tags: 1:2.2-2
* Use ocamlfind to locate and use the libraries xml-light and extlib
  which already exist in Debian as separate packages.
  (Closes: #519630)
* Fixed compile error with camlp4 3.11, thanks to Stéphane Glondu.
  (Closes: #519627)
* Use quilt instead of dpatch for patches, and describe how to use
  quilt in Debian.source (thanks to Russ Allbery).
* Added a Vcs-Hg control filed to indicate the location of the public
  repository.
* Bumped Standards-Version to 3.8.1.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
open Swf
22
22
open ExtList
23
23
 
24
 
type error_msg = 
 
24
type error_msg =
25
25
        | PngError of Png.error_msg
26
26
        | Interlaced
27
27
        | UnsupportedColorModel
28
28
        | UnsupportedExtension
29
29
        | UnzipFailed
30
 
        | InvalidDatasize
31
 
        | InvalidFilter of int
32
30
 
33
31
exception Error of error_msg
34
32
exception File_not_found of string
45
43
        | Interlaced -> "Interlaced mode is not supported"
46
44
        | UnsupportedColorModel -> "Unsupported color model"
47
45
        | UnsupportedExtension -> "Unsupported file extension"
48
 
        | InvalidFilter f -> ("Invalid filter " ^ string_of_int f)
49
46
        | UnzipFailed -> "Decompression failed"
50
 
        | InvalidDatasize -> "Invalid data size"
51
47
 
52
48
let error msg = raise (Error msg)
53
49
 
64
60
        let ext = String.sub file (p + 1) (len - (p + 1)) in
65
61
        match String.uppercase ext with
66
62
        | "PNG" ->
67
 
                let png , header, data = (try 
 
63
                let png , header, data = (try
68
64
                        let p = Png.parse ch in
69
65
                        p , Png.header p, Png.data p
70
 
                with Png.Error msg -> 
 
66
                with Png.Error msg ->
71
67
                        IO.close_in ch; error (PngError msg)
72
68
                ) in
73
69
                IO.close_in ch;
117
113
 
118
114
let make_clip name pics baseid =
119
115
        let npics = List.length pics in
120
 
        let ids = Array.of_list (List.map (fun p -> p.pid) pics) in 
 
116
        let ids = Array.of_list (List.map (fun p -> p.pid) pics) in
121
117
        let rec loop i p =
122
118
                let w = p.pwidth in
123
119
                let h = p.pheight in
208
204
                        } :: TShowFrame :: loop (i+1)
209
205
        in
210
206
        let tid = ref 0 in
211
 
        let make_tag t = 
 
207
        let make_tag t =
212
208
                incr tid;
213
209
                {
214
210
                        tid = - !tid;