1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 *
3 * ***** BEGIN LICENSE BLOCK *****
4 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 *
6 * The contents of this file are subject to the Mozilla Public License Version
7 * 1.1 (the "License"); you may not use this file except in compliance with
8 * the License. You may obtain a copy of the License at
9 * http://www.mozilla.org/MPL/
10 *
11 * Software distributed under the License is distributed on an "AS IS" basis,
12 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 * for the specific language governing rights and limitations under the
14 * License.
15 *
16 * The Original Code is mozilla.org code.
17 *
18 * The Initial Developer of the Original Code is
19 * Netscape Communications Corporation.
20 * Portions created by the Initial Developer are Copyright (C) 2001
21 * the Initial Developer. All Rights Reserved.
22 *
23 * Contributor(s):
24 * Stuart Parmenter <pavlov@netscape.com>
25 *
26 * Alternatively, the contents of this file may be used under the terms of
27 * either the GNU General Public License Version 2 or later (the "GPL"), or
28 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29 * in which case the provisions of the GPL or the LGPL are applicable instead
30 * of those above. If you wish to allow use of your version of this file only
31 * under the terms of either the GPL or the LGPL, and not to allow others to
32 * use your version of this file under the terms of the MPL, indicate your
33 * decision by deleting the provisions above and replace them with the notice
34 * and other provisions required by the GPL or the LGPL. If you do not delete
35 * the provisions above, a recipient may use your version of this file under
36 * the terms of any one of the MPL, the GPL or the LGPL.
37 *
38 * ***** END LICENSE BLOCK ***** */
39
40 #include "nsISupports.idl"
41
42 interface nsIInputStream;
43 interface imgILoad;
44
45 /**
46 * imgIDecoder interface
47 *
48 * @author Stuart Parmenter <pavlov@netscape.com>
49 * @version 0.2
50 * @see imagelib2
51 */
52 [scriptable, uuid(9eebf43a-1dd1-11b2-953e-f1782f4cbad3)]
53 interface imgIDecoder : nsISupports
54 {
55 /**
56 * Initialize an image decoder.
57 * @param aRequest the request that owns the decoder.
58 *
59 * @note The decode should QI \a aLoad to an imgIDecoderObserver
60 * and should send decoder notifications to the request.
61 * The decoder should always pass NULL as the first two parameters to
62 * all of the imgIDecoderObserver APIs.
63 */
64 void init(in imgILoad aLoad);
65
66 /**
67 * Closes the stream.
68 */
69 void close();
70
71 /**
72 * Flushes the stream.
73 */
74 void flush();
75
76 /**
77 * Writes data into the stream from an input stream.
78 * Implementer's note: This method is defined by this interface in order
79 * to allow the output stream to efficiently copy the data from the input
80 * stream into its internal buffer (if any). If this method was provide
81 * as an external facility, a separate char* buffer would need to be used
82 * in order to call the output stream's other Write method.
83 * @param fromStream the stream from which the data is read
84 * @param count the maximun number of bytes to write
85 * @return aWriteCount out parameter to hold the number of
86 * bytes written. if an error occurs, the writecount
87 * is undefined
88 */
89 unsigned long writeFrom(in nsIInputStream inStr,
90 in unsigned long count);
91
92 };