1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/src/nsIScriptableRegion.idl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,176 @@ 1.4 +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- 1.5 + * 1.6 + * This Source Code Form is subject to the terms of the Mozilla Public 1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.9 + 1.10 +#include "nsISupports.idl" 1.11 + 1.12 +%{C++ 1.13 +class nsIntRegion; 1.14 +%} 1.15 + 1.16 +native nsIntRegion(nsIntRegion); 1.17 + 1.18 + 1.19 +[scriptable, uuid(a5f44cc7-2820-489b-b817-ae8a08506ff6)] 1.20 +interface nsIScriptableRegion : nsISupports 1.21 +{ 1.22 + void init ( ) ; 1.23 + 1.24 + /** 1.25 + * copy operator equivalent that takes another region 1.26 + * 1.27 + * @param region to copy 1.28 + * @return void 1.29 + * 1.30 + **/ 1.31 + 1.32 + void setToRegion ( in nsIScriptableRegion aRegion ); 1.33 + 1.34 + /** 1.35 + * copy operator equivalent that takes a rect 1.36 + * 1.37 + * @param aX xoffset of rect to set region to 1.38 + * @param aY yoffset of rect to set region to 1.39 + * @param aWidth width of rect to set region to 1.40 + * @param aHeight height of rect to set region to 1.41 + * @return void 1.42 + * 1.43 + **/ 1.44 + 1.45 + void setToRect ( in long aX, in long aY, in long aWidth, in long aHeight ); 1.46 + 1.47 + /** 1.48 + * destructively intersect another region with this one 1.49 + * 1.50 + * @param region to intersect 1.51 + * @return void 1.52 + * 1.53 + **/ 1.54 + 1.55 + void intersectRegion ( in nsIScriptableRegion aRegion ) ; 1.56 + 1.57 + /** 1.58 + * destructively intersect a rect with this region 1.59 + * 1.60 + * @param aX xoffset of rect to intersect with region 1.61 + * @param aY yoffset of rect to intersect with region 1.62 + * @param aWidth width of rect to intersect with region 1.63 + * @param aHeight height of rect to intersect with region 1.64 + * @return void 1.65 + * 1.66 + **/ 1.67 + 1.68 + void intersectRect ( in long aX, in long aY, in long aWidth, in long aHeight ) ; 1.69 + 1.70 + /** 1.71 + * destructively union another region with this one 1.72 + * 1.73 + * @param region to union 1.74 + * @return void 1.75 + * 1.76 + **/ 1.77 + 1.78 + void unionRegion ( in nsIScriptableRegion aRegion ) ; 1.79 + 1.80 + /** 1.81 + * destructively union a rect with this region 1.82 + * 1.83 + * @param aX xoffset of rect to union with region 1.84 + * @param aY yoffset of rect to union with region 1.85 + * @param aWidth width of rect to union with region 1.86 + * @param aHeight height of rect to union with region 1.87 + * @return void 1.88 + * 1.89 + **/ 1.90 + 1.91 + void unionRect ( in long aX, in long aY, in long aWidth, in long aHeight ) ; 1.92 + 1.93 + /** 1.94 + * destructively subtract another region with this one 1.95 + * 1.96 + * @param region to subtract 1.97 + * @return void 1.98 + * 1.99 + **/ 1.100 + 1.101 + void subtractRegion ( in nsIScriptableRegion aRegion ) ; 1.102 + 1.103 + /** 1.104 + * destructively subtract a rect from this region 1.105 + * 1.106 + * @param aX xoffset of rect to subtract with region 1.107 + * @param aY yoffset of rect to subtract with region 1.108 + * @param aWidth width of rect to subtract with region 1.109 + * @param aHeight height of rect to subtract with region 1.110 + * @return void 1.111 + * 1.112 + **/ 1.113 + 1.114 + void subtractRect ( in long aX, in long aY, in long aWidth, in long aHeight ) ; 1.115 + 1.116 + /** 1.117 + * is this region empty? i.e. does it contain any pixels 1.118 + * 1.119 + * @param none 1.120 + * @return returns whether the region is empty 1.121 + * 1.122 + **/ 1.123 + 1.124 + boolean isEmpty ( ) ; 1.125 + 1.126 + /** 1.127 + * == operator equivalent i.e. do the regions contain exactly 1.128 + * the same pixels 1.129 + * 1.130 + * @param region to compare 1.131 + * @return whether the regions are identical 1.132 + * 1.133 + **/ 1.134 + 1.135 + boolean isEqualRegion ( in nsIScriptableRegion aRegion ) ; 1.136 + 1.137 + /** 1.138 + * returns the bounding box of the region i.e. the smallest 1.139 + * rectangle that completely contains the region. 1.140 + * 1.141 + * @param aX out parameter for xoffset of bounding rect for region 1.142 + * @param aY out parameter for yoffset of bounding rect for region 1.143 + * @param aWidth out parameter for width of bounding rect for region 1.144 + * @param aHeight out parameter for height of bounding rect for region 1.145 + * @return void 1.146 + * 1.147 + **/ 1.148 + void getBoundingBox ( out long aX, out long aY, out long aWidth, out long aHeight ) ; 1.149 + 1.150 + /** 1.151 + * offsets the region in x and y 1.152 + * 1.153 + * @param xoffset pixel offset in x 1.154 + * @param yoffset pixel offset in y 1.155 + * @return void 1.156 + * 1.157 + **/ 1.158 + void offset ( in long aXOffset, in long aYOffset ) ; 1.159 + 1.160 + /** 1.161 + * @return null if there are no rects, 1.162 + * @return flat array of rects,ie [x1,y1,width1,height1,x2...]. 1.163 + * The result will contain bogus data if values don't fit in 31 bit 1.164 + **/ 1.165 + [implicit_jscontext] jsval getRects(); 1.166 + 1.167 + /** 1.168 + * does the region intersect the rectangle? 1.169 + * 1.170 + * @param rect to check for containment 1.171 + * @return true if the region intersects the rect 1.172 + * 1.173 + **/ 1.174 + 1.175 + boolean containsRect ( in long aX, in long aY, in long aWidth, in long aHeight ) ; 1.176 + 1.177 + [noscript] readonly attribute nsIntRegion region; 1.178 + 1.179 +};