Back to index

lightning-sunbird  0.9+nobinonly
imgIEncoder.idl
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
00002  * ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is Oracle Corporation code.
00016  *
00017  * The Initial Developer of the Original Code is Oracle Corporation.
00018  * Portions created by the Initial Developer are Copyright (C) 2005
00019  * the Initial Developer. All Rights Reserved.
00020  *
00021  * Contributor(s):
00022  *   Stuart Parmenter <pavlov@pavlov.net>
00023  *   Brett Wilson <brettw@gmail.com>
00024  *
00025  * Alternatively, the contents of this file may be used under the terms of
00026  * either the GNU General Public License Version 2 or later (the "GPL"), or
00027  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00028  * in which case the provisions of the GPL or the LGPL are applicable instead
00029  * of those above. If you wish to allow use of your version of this file only
00030  * under the terms of either the GPL or the LGPL, and not to allow others to
00031  * use your version of this file under the terms of the MPL, indicate your
00032  * decision by deleting the provisions above and replace them with the notice
00033  * and other provisions required by the GPL or the LGPL. If you do not delete
00034  * the provisions above, a recipient may use your version of this file under
00035  * the terms of any one of the MPL, the GPL or the LGPL.
00036  *
00037  * ***** END LICENSE BLOCK ***** */
00038 
00039 #include "nsISupports.idl"
00040 #include "nsIInputStream.idl"
00041 
00045 [scriptable, uuid(b1b0b493-3369-44e0-878d-f7c56d937680)]
00046 interface imgIEncoder_MOZILLA_1_8_BRANCH : nsIInputStream
00047 {
00048   // Possible values for input format (note that not all image formats
00049   // support saving alpha channels):
00050 
00051     // Input is RGB each pixel is represented by three bytes:
00052     // R, G, and B (in that order, regardless of host endianness)
00053   const PRUint32 INPUT_FORMAT_RGB = 0;
00054 
00055     // Input is RGB each pixel is represented by four bytes:
00056     // R, G, and B (in that order, regardless of host endianness).
00057     // POST-MULTIPLIED alpha us used (50% transparent red is 0xff000080)
00058   const PRUint32 INPUT_FORMAT_RGBA = 1;
00059 
00060     // Input is host-endian ARGB: On big-endian machines each pixel is therefore
00061     // ARGB, and for little-endian machiens (Intel) each pixel is BGRA
00062     // (This is used by canvas to match it's internal representation)
00063     //
00064     // PRE-MULTIPLIED alpha is used (That is, 50% transparent red is 0x80800000,
00065     // not 0x80ff0000
00066   const PRUint32 INPUT_FORMAT_HOSTARGB = 2;
00067 
00068   /* data - list of bytes in the format specified by inputFormat
00069    * width  - width in pixels
00070    * height - height in pixels
00071    * stride - number of bytes per row in the image
00072    *          Normally (width*3) or (width*4), depending on your input format,
00073    *          but some data uses padding at the end of each row, which would
00074    *          be extra.
00075    * inputFormat - one of INPUT_FORMAT_* specifying the format of data
00076    * outputOptions - semicolon-delimited list of name=value pairs that can
00077    *                 give options to the output encoder. Options are encoder-
00078    *                 specific. Just give empty string for default behavior.
00079    */
00080   void initFromData([array, size_is(length), const] in PRUint8 data,
00081                     in unsigned long length,
00082                     in PRUint32 width,
00083                     in PRUint32 height,
00084                     in PRUint32 stride,
00085                     in PRUint32 inputFormat,
00086                     in AString outputOptions);
00087 };
00088 
00093 interface nsIClipboardImage;
00094 interface nsIFile;
00095 
00096 [scriptable, uuid(CCC5B3AD-3E67-4e3d-97E1-B06B2E96FEF8)]
00097 interface imgIEncoder : nsISupports
00098 {
00099   void encodeClipboardImage(in nsIClipboardImage aClipboardImage, out nsIFile aImageFile);
00100 };
00101