3 { This file contains application interface routines that are used for both
4 compression and decompression. }
6 { Original: jcomapi.c; Copyright (C) 1994-1997, Thomas G. Lane. }
8 interface
10 {$I imjconfig.inc}
12 uses
13 imjmorecfg,
14 imjinclude,
15 imjpeglib;
17 { Abort processing of a JPEG compression or decompression operation,
18 but don't destroy the object itself. }
20 {GLOBAL}
24 { Destruction of a JPEG object. }
26 {GLOBAL}
29 {GLOBAL}
32 {GLOBAL}
35 implementation
37 { Abort processing of a JPEG compression or decompression operation,
38 but don't destroy the object itself.
40 For this, we merely clean up all the nonpermanent memory pools.
41 Note that temp files (virtual arrays) are not allowed to belong to
42 the permanent pool, so we will be able to close all temp files here.
43 Closing a data source or destination, if necessary, is the application's
44 responsibility. }
47 {GLOBAL}
49 var
51 begin
52 { Do nothing if called on a not-initialized or destroyed JPEG object. }
54 exit;
56 { Releasing pools in reverse order might help avoid fragmentation
57 with some (brain-damaged) malloc libraries. }
60 begin
64 { Reset overall state for possible reuse of object }
66 begin
68 { Try to keep application from accessing now-deleted marker list.
69 A bit kludgy to do it here, but this is the most central place. }
71 end
72 else
73 begin
79 { Destruction of a JPEG object.
81 Everything gets deallocated except the master jpeg_compress_struct itself
82 and the error manager struct. Both of these are supplied by the application
83 and must be freed, if necessary, by the application. (Often they are on
84 the stack and so don't need to be freed anyway.)
85 Closing a data source or destination, if necessary, is the application's
86 responsibility. }
89 {GLOBAL}
91 begin
92 { We need only tell the memory manager to release everything. }
93 { NB: mem pointer is NIL if memory mgr failed to initialize. }
101 { Convenience routines for allocating quantization and Huffman tables.
102 (Would jutils.c be a more reasonable place to put these?) }
105 {GLOBAL}
107 var
109 begin
112 );
118 {GLOBAL}
120 var
122 begin
125 );