1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include
"nsISupports.idl"
9 interface nsIInputStream
;
10 interface imgIContainer
;
13 interface nsIDOMDocument
;
14 interface imgIScriptedNotificationObserver
;
15 interface imgINotificationObserver
;
17 [scriptable
, builtinclass
, uuid(4c2383a4
-931c
-484d
-8c4a
-973590f66e3f
)]
18 interface imgITools
: nsISupports
22 * Caller provides an input stream and mimetype. We read from the stream
23 * and decompress it (according to the specified mime type) and return
24 * the resulting imgIContainer.
27 * An input stream for an encoded image file.
29 * Type of image in the stream.
31 imgIContainer decodeImage
(in nsIInputStream aStream
,
32 in ACString aMimeType
);
36 * Caller provides an input stream and mimetype. We read from the stream
37 * and decompress it (according to the specified mime type) and return
38 * the resulting imgIContainer.
40 * This method is deprecated and will be removed at some time in the future;
41 * new code should use |decodeImage|.
44 * An input stream for an encoded image file.
46 * Type of image in the stream.
48 * An imgIContainer holding the decoded image will be returned via
49 * this parameter. It is an error to provide any initial value but
52 [deprecated
] void decodeImageData
(in nsIInputStream aStream
,
53 in ACString aMimeType
,
54 inout imgIContainer aContainer
);
58 * Caller provides an image container, and the mime type it should be
59 * encoded to. We return an input stream for the encoded image data.
64 * Type of encoded image desired (eg "image/png").
65 * @param outputOptions
66 * Encoder-specific output options.
68 nsIInputStream encodeImage
(in imgIContainer aContainer
,
69 in ACString aMimeType
,
70 [optional] in AString outputOptions
);
74 * Caller provides an image container, and the mime type it should be
75 * encoded to. We return an input stream for the encoded image data.
76 * The encoded image is scaled to the specified dimensions.
81 * Type of encoded image desired (eg "image/png").
82 * @param aWidth, aHeight
83 * The size (in pixels) desired for the resulting image. Specify 0 to
84 * use the given image's width or height. Values must be >= 0.
85 * @param outputOptions
86 * Encoder-specific output options.
88 nsIInputStream encodeScaledImage
(in imgIContainer aContainer
,
89 in ACString aMimeType
,
92 [optional] in AString outputOptions
);
95 * getImgLoaderForDocument
96 * Retrieve an image loader that reflects the privacy status of the given
100 * A document. Must not be null.
102 imgILoader getImgLoaderForDocument
(in nsIDOMDocument doc
);
105 * getImgLoaderForDocument
106 * Retrieve an image cache that reflects the privacy status of the given
110 * A document. Null is allowed, but must _only_ be passed
111 * when there is no way to obtain a relevant document for
112 * the current context in which a cache is desired.
114 imgICache getImgCacheForDocument
(in nsIDOMDocument doc
);
118 * Caller provides an image container, and the mime type it should be
119 * encoded to. We return an input stream for the encoded image data.
120 * The encoded image is cropped to the specified dimensions.
122 * The given offset and size must not exceed the image bounds.
125 * An image container.
127 * Type of encoded image desired (eg "image/png").
128 * @param aOffsetX, aOffsetY
129 * The crop offset (in pixels). Values must be >= 0.
130 * @param aWidth, aHeight
131 * The size (in pixels) desired for the resulting image. Specify 0 to
132 * use the given image's width or height. Values must be >= 0.
133 * @param outputOptions
134 * Encoder-specific output options.
136 nsIInputStream encodeCroppedImage
(in imgIContainer aContainer
,
137 in ACString aMimeType
,
142 [optional] in AString outputOptions
);
145 * Create a wrapper around a scripted notification observer (ordinarily
146 * imgINotificationObserver cannot be implemented from scripts).
148 * @param aObserver The scripted observer to wrap
150 imgINotificationObserver createScriptedObserver
(in imgIScriptedNotificationObserver aObserver
);