Back to index

lightning-sunbird  0.9+nobinonly
nsICanvasRenderingContext2D.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 mozilla.org code.
00016  *
00017  * The Initial Developer of the Original Code is
00018  *   Vladimir Vukicevic <vladimir@pobox.com>
00019  * Portions created by the Initial Developer are Copyright (C) 2004
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *
00024  * Alternatively, the contents of this file may be used under the terms of
00025  * either the GNU General Public License Version 2 or later (the "GPL"), or
00026  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00027  * in which case the provisions of the GPL or the LGPL are applicable instead
00028  * of those above. If you wish to allow use of your version of this file only
00029  * under the terms of either the GPL or the LGPL, and not to allow others to
00030  * use your version of this file under the terms of the MPL, indicate your
00031  * decision by deleting the provisions above and replace them with the notice
00032  * and other provisions required by the GPL or the LGPL. If you do not delete
00033  * the provisions above, a recipient may use your version of this file under
00034  * the terms of any one of the MPL, the GPL or the LGPL.
00035  *
00036  * ***** END LICENSE BLOCK ***** */
00037 
00038 #include "nsISupports.idl"
00039 
00040 interface nsIDOMHTMLImageElement;
00041 interface nsIBoxObject;
00042 
00043 [scriptable, uuid(bbb20a59-524e-4662-981e-5e142814b20c)]
00044 interface nsICanvasGradient : nsISupports
00045 {
00046   void addColorStop(in float offset, in DOMString color);
00047 };
00048 
00049 [scriptable, uuid(21dea65c-5c08-4eb1-ac82-81fe95be77b8)]
00050 interface nsICanvasPattern : nsISupports
00051 {
00052 };
00053 
00054 [scriptable, uuid(fd1e2245-8d8c-4146-bf47-fb84ddd6fca0)]
00055 interface nsICanvasRenderingContext2D : nsISupports
00056 {
00057   // back-reference to the canvas object
00058   readonly attribute nsIBoxObject canvas;
00059 
00060   // state
00061   void save();
00062   void restore();
00063 
00064   // transformations
00065   void scale(in float x, in float y);
00066   void rotate(in float angle);
00067   void translate(in float x, in float y);
00068 
00069   // compositing
00070   attribute float globalAlpha; /* default 1.0 -- opaque */
00071   attribute DOMString globalCompositeOperation; /* default "over" */
00072 
00073   // colors and styles
00074   attribute DOMString strokeStyle;
00075   attribute DOMString fillStyle;
00076 
00077   nsICanvasGradient createLinearGradient (in float x0, in float y0, in float x1, in float y1);
00078   nsICanvasGradient createRadialGradient(in float x0, in float y0, in float r0, in float x1, in float y1, in float r1);
00079   nsICanvasPattern createPattern(in nsIDOMHTMLImageElement image, in DOMString repetition);
00080 
00081   attribute float lineWidth; /* default 1 */
00082   attribute DOMString lineCap; /* "butt", "round", "square" (default) */
00083   attribute DOMString lineJoin; /* "round", "bevel", "miter" (default) */
00084   attribute float miterLimit; /* default 10 */
00085 
00086   // shadows
00087   attribute float shadowOffsetX;
00088   attribute float shadowOffsetY;
00089   attribute float shadowBlur;
00090   attribute DOMString shadowColor;
00091 
00092   // rects
00093   void clearRect(in float x, in float y, in float w, in float h);
00094   void fillRect(in float x, in float y, in float w, in float h);
00095   void strokeRect(in float x, in float y, in float w, in float h);
00096 
00097   // path API
00098   void beginPath();
00099   void closePath();
00100 
00101   void moveTo(in float x, in float y);
00102   void lineTo(in float x, in float y);
00103   void quadraticCurveTo(in float cpx, in float cpy, in float x, in float y);
00104   void bezierCurveTo(in float cp1x, in float cp1y, in float cp2x, in float cp2y, in float x, in float y);
00105   void arcTo(in float x1, in float y1, in float x2, in float y2, in float radius);
00106   void arc(in float x, in float y, in float r, in float startAngle, in float endAngle, in boolean clockwise);
00107   void rect(in float x, in float y, in float w, in float h);
00108 
00109   void fill();
00110   void stroke();
00111   void clip();
00112 
00113   // image api
00114   void drawImage();
00115 /*
00116   void drawImage(in HTMLImageElement image, in float dx, in float dy);
00117   void drawImage(in HTMLImageElement image, in float dx, in float dy, in float dw, in float dh);
00118   void drawImage(in HTMLImageElement image, in float sx, in float sy, in float sw, in float sh, in float dx, in float dy, in float dw, in float dh);
00119 */
00120 };