image/public/imgITools.idl

Wed, 31 Dec 2014 13:27:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 13:27:57 +0100
branch
TOR_BUG_3246
changeset 6
8bccb770b82d
permissions
-rw-r--r--

Ignore runtime configuration files generated during quality assurance.

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

mercurial