image/public/imgITools.idl

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/image/public/imgITools.idl	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,151 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
     1.5 + *
     1.6 + * This Source Code Form is subject to the terms of the Mozilla Public
     1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.9 +
    1.10 +#include "nsISupports.idl"
    1.11 +
    1.12 +interface nsIInputStream;
    1.13 +interface imgIContainer;
    1.14 +interface imgILoader;
    1.15 +interface imgICache;
    1.16 +interface nsIDOMDocument;
    1.17 +interface imgIScriptedNotificationObserver;
    1.18 +interface imgINotificationObserver;
    1.19 +
    1.20 +[scriptable, builtinclass, uuid(4c2383a4-931c-484d-8c4a-973590f66e3f)]
    1.21 +interface imgITools : nsISupports
    1.22 +{
    1.23 +    /**
    1.24 +     * decodeImage
    1.25 +     * Caller provides an input stream and mimetype. We read from the stream
    1.26 +     * and decompress it (according to the specified mime type) and return
    1.27 +     * the resulting imgIContainer.
    1.28 +     *
    1.29 +     * @param aStream
    1.30 +     *        An input stream for an encoded image file.
    1.31 +     * @param aMimeType
    1.32 +     *        Type of image in the stream.
    1.33 +     */
    1.34 +    imgIContainer decodeImage(in nsIInputStream aStream,
    1.35 +                              in ACString aMimeType);
    1.36 +
    1.37 +    /**
    1.38 +     * decodeImageData
    1.39 +     * Caller provides an input stream and mimetype. We read from the stream
    1.40 +     * and decompress it (according to the specified mime type) and return
    1.41 +     * the resulting imgIContainer.
    1.42 +     *
    1.43 +     * This method is deprecated and will be removed at some time in the future;
    1.44 +     * new code should use |decodeImage|.
    1.45 +     *
    1.46 +     * @param aStream
    1.47 +     *        An input stream for an encoded image file.
    1.48 +     * @param aMimeType
    1.49 +     *        Type of image in the stream.
    1.50 +     * @param aContainer
    1.51 +     *        An imgIContainer holding the decoded image will be returned via
    1.52 +     *        this parameter. It is an error to provide any initial value but
    1.53 +     *        |null|.
    1.54 +     */
    1.55 +    [deprecated] void decodeImageData(in nsIInputStream aStream,
    1.56 +                                      in ACString aMimeType,
    1.57 +                                      inout imgIContainer aContainer);
    1.58 +
    1.59 +    /**
    1.60 +     * encodeImage
    1.61 +     * Caller provides an image container, and the mime type it should be
    1.62 +     * encoded to. We return an input stream for the encoded image data.
    1.63 +     *
    1.64 +     * @param aContainer
    1.65 +     *        An image container.
    1.66 +     * @param aMimeType
    1.67 +     *        Type of encoded image desired (eg "image/png").
    1.68 +     * @param outputOptions
    1.69 +     *        Encoder-specific output options.
    1.70 +     */
    1.71 +    nsIInputStream encodeImage(in imgIContainer aContainer,
    1.72 +                               in ACString aMimeType,
    1.73 +                               [optional] in AString outputOptions);
    1.74 +
    1.75 +    /**
    1.76 +     * encodeScaledImage
    1.77 +     * Caller provides an image container, and the mime type it should be
    1.78 +     * encoded to. We return an input stream for the encoded image data.
    1.79 +     * The encoded image is scaled to the specified dimensions.
    1.80 +     *
    1.81 +     * @param aContainer
    1.82 +     *        An image container.
    1.83 +     * @param aMimeType
    1.84 +     *        Type of encoded image desired (eg "image/png").
    1.85 +     * @param aWidth, aHeight
    1.86 +     *        The size (in pixels) desired for the resulting image. Specify 0 to
    1.87 +     *        use the given image's width or height. Values must be >= 0.
    1.88 +     * @param outputOptions
    1.89 +     *        Encoder-specific output options.
    1.90 +     */
    1.91 +    nsIInputStream encodeScaledImage(in imgIContainer aContainer,
    1.92 +                                     in ACString aMimeType,
    1.93 +                                     in long aWidth,
    1.94 +                                     in long aHeight,
    1.95 +                                     [optional] in AString outputOptions);
    1.96 +
    1.97 +    /**
    1.98 +     * getImgLoaderForDocument
    1.99 +     * Retrieve an image loader that reflects the privacy status of the given
   1.100 +     * document.
   1.101 +     *
   1.102 +     * @param doc
   1.103 +     *        A document. Must not be null.
   1.104 +     */
   1.105 +    imgILoader getImgLoaderForDocument(in nsIDOMDocument doc);
   1.106 +
   1.107 +    /**
   1.108 +     * getImgLoaderForDocument
   1.109 +     * Retrieve an image cache that reflects the privacy status of the given
   1.110 +     * document.
   1.111 +     *
   1.112 +     * @param doc
   1.113 +     *        A document. Null is allowed, but must _only_ be passed
   1.114 +     *        when there is no way to obtain a relevant document for
   1.115 +     *        the current context in which a cache is desired.
   1.116 +     */
   1.117 +    imgICache getImgCacheForDocument(in nsIDOMDocument doc);
   1.118 +
   1.119 +    /**
   1.120 +     * encodeCroppedImage
   1.121 +     * Caller provides an image container, and the mime type it should be
   1.122 +     * encoded to. We return an input stream for the encoded image data.
   1.123 +     * The encoded image is cropped to the specified dimensions.
   1.124 +     *
   1.125 +     * The given offset and size must not exceed the image bounds.
   1.126 +     *
   1.127 +     * @param aContainer
   1.128 +     *        An image container.
   1.129 +     * @param aMimeType
   1.130 +     *        Type of encoded image desired (eg "image/png").
   1.131 +     * @param aOffsetX, aOffsetY
   1.132 +     *        The crop offset (in pixels). Values must be >= 0.
   1.133 +     * @param aWidth, aHeight
   1.134 +     *        The size (in pixels) desired for the resulting image. Specify 0 to
   1.135 +     *        use the given image's width or height. Values must be >= 0.
   1.136 +     * @param outputOptions
   1.137 +     *        Encoder-specific output options.
   1.138 +     */
   1.139 +    nsIInputStream encodeCroppedImage(in imgIContainer aContainer,
   1.140 +                                      in ACString aMimeType,
   1.141 +                                      in long aOffsetX,
   1.142 +                                      in long aOffsetY,
   1.143 +                                      in long aWidth,
   1.144 +                                      in long aHeight,
   1.145 +                                      [optional] in AString outputOptions);
   1.146 +
   1.147 +    /**
   1.148 +     * Create a wrapper around a scripted notification observer (ordinarily
   1.149 +     * imgINotificationObserver cannot be implemented from scripts).
   1.150 +     *
   1.151 +     * @param aObserver The scripted observer to wrap 
   1.152 +     */
   1.153 +    imgINotificationObserver createScriptedObserver(in imgIScriptedNotificationObserver aObserver);
   1.154 +};

mercurial