1 /** -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
3 * ***** BEGIN LICENSE BLOCK *****
4 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
6 * The contents of this file are subject to the Mozilla Public License Version
7 * 1.1 (the "License"); you may not use this file except in compliance with
8 * the License. You may obtain a copy of the License at
9 * http://www.mozilla.org/MPL/
11 * Software distributed under the License is distributed on an "AS IS" basis,
12 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 * for the specific language governing rights and limitations under the
16 * The Original Code is mozilla.org code.
18 * The Initial Developer of the Original Code is
19 * Netscape Communications Corporation.
20 * Portions created by the Initial Developer are Copyright (C) 2001
21 * the Initial Developer. All Rights Reserved.
24 * Stuart Parmenter <pavlov@netscape.com>
25 * Chris Saari <saari@netscape.com>
27 * Alternatively, the contents of this file may be used under the terms of
28 * either of the GNU General Public License Version 2 or later (the "GPL"),
29 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
30 * in which case the provisions of the GPL or the LGPL are applicable instead
31 * of those above. If you wish to allow use of your version of this file only
32 * under the terms of either the GPL or the LGPL, and not to allow others to
33 * use your version of this file under the terms of the MPL, indicate your
34 * decision by deleting the provisions above and replace them with the notice
35 * and other provisions required by the GPL or the LGPL. If you do not delete
36 * the provisions above, a recipient may use your version of this file under
37 * the terms of any one of the MPL, the GPL or the LGPL.
39 * ***** END LICENSE BLOCK ***** */
41 #include
"nsISupports.idl"
42 #include
"gfxtypes.idl"
43 #include
"gfxIFormats.idl"
49 native nsRectRef
(nsIntRect
&);
52 * gfxIImageFrame interface
54 * All x, y, width, height values are in pixels.
56 * @author Tim Rowley <tor@cs.brown.edu>
57 * @author Stuart Parmenter <pavlov@netscape.com>
60 [scriptable
, uuid(9c37930b
-cadd
-453c
-89e1
-9ed456715b9c
)]
61 interface gfxIImageFrame
: nsISupports
64 * Create a new \a aWidth x \a aHeight sized image.
66 * @param aX The x-offset from the origin of the gfxIImageContainer parent.
67 * @param aY The y-offset from the origin of the gfxIImageContainer parent.
68 * @param aWidth The width of the image to create.
69 * @param aHeight The height of the image to create.
70 * @param aFormat the width of the image to create.
72 * @note The data in a new image is uninitialized.
74 void init
(in PRInt32 aX
,
78 in gfx_format aFormat
,
82 * TRUE by default. When set to FALSE, you will no longer be able to make any modifications
83 * to the data of the image. Any attempts will fail.
85 attribute
boolean mutable
;
88 * The x-offset of the image.
90 readonly attribute PRInt32 x
;
93 * The y-offset of the image.
95 readonly attribute PRInt32 y
;
98 * The width of the image.
100 readonly attribute PRInt32 width
;
103 * The height of the image.
105 readonly attribute PRInt32 height
;
108 * The rectangle this frame ocupies.
109 * @param rect this is really an out parameter.
111 [noscript
] void getRect
(in nsRectRef rect
);
114 * The image data format the image was created with.
117 readonly attribute gfx_format format
;
120 * returns whether the image requires the background to be painted
122 readonly attribute
boolean needsBackground
;
125 readonly attribute
unsigned long imageBytesPerRow
;
128 * returns the number of bytes allocated for the image
130 readonly attribute
unsigned long imageDataLength
;
132 // XXX do we copy here? lets not...
133 void getImageData
([array
, size_is(length
)] out PRUint8 bits
, out unsigned long length
);
136 * Get Palette data pointer
138 void getPaletteData
([array
, size_is(length
)] out gfx_color palette
, out unsigned long length
);
141 * Lock image pixels before addressing the data directly
143 void lockImageData
();
146 * Unlock image pixels
148 void unlockImageData
();
151 /* GIF Specific methods. These should be in a different class or interface. */
154 * Represents the number of milliseconds until the next frame should be displayed.
155 * @note -1 means that this frame should be displayed forever.
157 attribute
long timeout
;
159 /* frame disposal method, used only by GIFs. Should probably subclass image frame
160 * and image container for GIFs special needs, but for simplicity it is here for the
163 attribute
long frameDisposalMethod
;
165 /* PNG specific methods */
167 attribute
long blendMethod
;