Bug 574778 - Fix win widget's ConstrainPosition so that it supports full screen windo...
[mozilla-central.git] / modules / libpr0n / public / imgIEncoder.idl
blob9c6e9dbd913904486b95f1f6ab38646d4fabcffe
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 * ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
13 * License.
15 * The Original Code is Oracle Corporation code.
17 * The Initial Developer of the Original Code is Oracle Corporation.
18 * Portions created by the Initial Developer are Copyright (C) 2005
19 * the Initial Developer. All Rights Reserved.
21 * Contributor(s):
22 * Stuart Parmenter <pavlov@pavlov.net>
23 * Brett Wilson <brettw@gmail.com>
24 * Justin Dolske <dolske@mozilla.com>
26 * Alternatively, the contents of this file may be used under the terms of
27 * either the GNU General Public License Version 2 or later (the "GPL"), or
28 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29 * in which case the provisions of the GPL or the LGPL are applicable instead
30 * of those above. If you wish to allow use of your version of this file only
31 * under the terms of either the GPL or the LGPL, and not to allow others to
32 * use your version of this file under the terms of the MPL, indicate your
33 * decision by deleting the provisions above and replace them with the notice
34 * and other provisions required by the GPL or the LGPL. If you do not delete
35 * the provisions above, a recipient may use your version of this file under
36 * the terms of any one of the MPL, the GPL or the LGPL.
38 * ***** END LICENSE BLOCK ***** */
40 #include "nsISupports.idl"
41 #include "nsIAsyncInputStream.idl"
42 #include "nsIEventTarget.idl"
44 /**
45 * imgIEncoder interface
47 [scriptable, uuid(4bcba4ec-7a44-43f9-a70f-1e92cdc625b9)]
48 interface imgIEncoder : nsIAsyncInputStream
50 // Possible values for outputOptions. Multiple values are semicolon-separated.
52 // PNG:
53 // ----
54 // transparency=[yes|no|none] -- default: "yes"
55 // Overrides default from input format. "no" and "none" are equivalent.
58 // APNG:
59 // -----
60 // The following options can be used with startImageEncode():
62 // transparency=[yes|no|none] -- default: "yes"
63 // Overrides default from input format. "no" and "none" are equivalent.
64 // skipfirstframe=[yes|no] -- default: "no"
65 // Controls display of the first frame in animations. PNG-only clients always
66 // display the first frame (and only that frame).
67 // frames=# -- default: "1"
68 // Total number of frames in the image. The first frame, even if skipped, is
69 // always included in the count.
70 // plays=# -- default: "0"
71 // Number of times to play the animation sequence. "0" will repeat forever.
74 // The following options can be used for each frame, with addImageFrame():
76 // transparency=[yes|no|none] -- default: "yes"
77 // Overrides default from input format. "no" and "none" are equivalent.
78 // delay=# -- default: "500"
79 // Number of milliseconds to display the frame, before moving to the next frame.
80 // dispose=[none|background|previous] -- default: "none"
81 // What to do with the image's canvas before rendering the next frame. See APNG spec.
82 // blend=[source|over] -- default: "source"
83 // How to render the new frame on the canvas. See APNG spec.
84 // xoffset=# -- default: "0"
85 // yoffset=# -- default: "0"
86 // Where to draw the frame, relative to the canvas.
89 // JPEG:
90 // -----
92 // quality=# -- default: "92"
93 // Quality of compression, 0-100 (worst-best).
94 // Quality >= 90 prevents down-sampling of the color channels.
97 // Possible values for input format (note that not all image formats
98 // support saving alpha channels):
100 // Input is RGB each pixel is represented by three bytes:
101 // R, G, and B (in that order, regardless of host endianness)
102 const PRUint32 INPUT_FORMAT_RGB = 0;
104 // Input is RGB each pixel is represented by four bytes:
105 // R, G, and B (in that order, regardless of host endianness).
106 // POST-MULTIPLIED alpha us used (50% transparent red is 0xff000080)
107 const PRUint32 INPUT_FORMAT_RGBA = 1;
109 // Input is host-endian ARGB: On big-endian machines each pixel is therefore
110 // ARGB, and for little-endian machiens (Intel) each pixel is BGRA
111 // (This is used by canvas to match it's internal representation)
113 // PRE-MULTIPLIED alpha is used (That is, 50% transparent red is 0x80800000,
114 // not 0x80ff0000
115 const PRUint32 INPUT_FORMAT_HOSTARGB = 2;
117 /* data - list of bytes in the format specified by inputFormat
118 * width - width in pixels
119 * height - height in pixels
120 * stride - number of bytes per row in the image
121 * Normally (width*3) or (width*4), depending on your input format,
122 * but some data uses padding at the end of each row, which would
123 * be extra.
124 * inputFormat - one of INPUT_FORMAT_* specifying the format of data
125 * outputOptions - semicolon-delimited list of name=value pairs that can
126 * give options to the output encoder. Options are encoder-
127 * specific. Just give empty string for default behavior.
129 void initFromData([array, size_is(length), const] in PRUint8 data,
130 in unsigned long length,
131 in PRUint32 width,
132 in PRUint32 height,
133 in PRUint32 stride,
134 in PRUint32 inputFormat,
135 in AString outputOptions);
138 * For encoding images which may contain multiple frames, the 1-shot
139 * initFromData() interface is too simplistic. The alternative is to
140 * use startImageEncode(), call addImageFrame() one or more times, and
141 * then finish initialization with endImageEncode().
143 * The arguments are basically the same as in initFromData().
145 void startImageEncode(in PRUint32 width,
146 in PRUint32 height,
147 in PRUint32 inputFormat,
148 in AString outputOptions);
150 void addImageFrame( [array, size_is(length), const] in PRUint8 data,
151 in unsigned long length,
152 in PRUint32 width,
153 in PRUint32 height,
154 in PRUint32 stride,
155 in PRUint32 frameFormat,
156 in AString frameOptions);
158 void endImageEncode();