gecko/image/public/imgITools.idl
2012-05-21 12:12:37 +01:00

73 lines
2.8 KiB
Plaintext

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsISupports.idl"
interface nsIInputStream;
interface imgIContainer;
[scriptable, uuid(1f19a2ce-cf5c-4a6b-8ba7-63785b45053f)]
interface imgITools : nsISupports
{
/**
* decodeImageData
* Caller provides an input stream and mimetype. We read from the stream
* and decompress it (according to the specified mime type) and return
* the resulting imgIContainer. (If the caller already has a container,
* it can be provided as input to be reused).
*
* @param aStream
* An input stream for an encoded image file.
* @param aMimeType
* Type of image in the stream.
* @param aContainer
* An imgIContainer holding the decoded image. Specify |null| when
* calling to have one created, otherwise specify a container to
* be used. It is an error to pass an already-initialized container
* as aContainer.
*/
void decodeImageData(in nsIInputStream aStream,
in ACString aMimeType,
inout imgIContainer aContainer);
/**
* encodeImage
* Caller provides an image container, and the mime type it should be
* encoded to. We return an input stream for the encoded image data.
*
* @param aContainer
* An image container.
* @param aMimeType
* Type of encoded image desired (eg "image/png").
* @param outputOptions
* Encoder-specific output options.
*/
nsIInputStream encodeImage(in imgIContainer aContainer,
in ACString aMimeType,
[optional] in AString outputOptions);
/**
* encodeScaledImage
* Caller provides an image container, and the mime type it should be
* encoded to. We return an input stream for the encoded image data.
* The encoded image is scaled to the specified dimensions.
*
* @param aContainer
* An image container.
* @param aMimeType
* Type of encoded image desired (eg "image/png").
* @param aWidth, aHeight
* The size (in pixels) desired for the resulting image.
* @param outputOptions
* Encoder-specific output options.
*/
nsIInputStream encodeScaledImage(in imgIContainer aContainer,
in ACString aMimeType,
in long aWidth,
in long aHeight,
[optional] in AString outputOptions);
};