michael@0: /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- michael@0: * michael@0: * This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsISupports.idl" michael@0: michael@0: %{C++ michael@0: class nsIntRegion; michael@0: %} michael@0: michael@0: native nsIntRegion(nsIntRegion); michael@0: michael@0: michael@0: [scriptable, uuid(a5f44cc7-2820-489b-b817-ae8a08506ff6)] michael@0: interface nsIScriptableRegion : nsISupports michael@0: { michael@0: void init ( ) ; michael@0: michael@0: /** michael@0: * copy operator equivalent that takes another region michael@0: * michael@0: * @param region to copy michael@0: * @return void michael@0: * michael@0: **/ michael@0: michael@0: void setToRegion ( in nsIScriptableRegion aRegion ); michael@0: michael@0: /** michael@0: * copy operator equivalent that takes a rect michael@0: * michael@0: * @param aX xoffset of rect to set region to michael@0: * @param aY yoffset of rect to set region to michael@0: * @param aWidth width of rect to set region to michael@0: * @param aHeight height of rect to set region to michael@0: * @return void michael@0: * michael@0: **/ michael@0: michael@0: void setToRect ( in long aX, in long aY, in long aWidth, in long aHeight ); michael@0: michael@0: /** michael@0: * destructively intersect another region with this one michael@0: * michael@0: * @param region to intersect michael@0: * @return void michael@0: * michael@0: **/ michael@0: michael@0: void intersectRegion ( in nsIScriptableRegion aRegion ) ; michael@0: michael@0: /** michael@0: * destructively intersect a rect with this region michael@0: * michael@0: * @param aX xoffset of rect to intersect with region michael@0: * @param aY yoffset of rect to intersect with region michael@0: * @param aWidth width of rect to intersect with region michael@0: * @param aHeight height of rect to intersect with region michael@0: * @return void michael@0: * michael@0: **/ michael@0: michael@0: void intersectRect ( in long aX, in long aY, in long aWidth, in long aHeight ) ; michael@0: michael@0: /** michael@0: * destructively union another region with this one michael@0: * michael@0: * @param region to union michael@0: * @return void michael@0: * michael@0: **/ michael@0: michael@0: void unionRegion ( in nsIScriptableRegion aRegion ) ; michael@0: michael@0: /** michael@0: * destructively union a rect with this region michael@0: * michael@0: * @param aX xoffset of rect to union with region michael@0: * @param aY yoffset of rect to union with region michael@0: * @param aWidth width of rect to union with region michael@0: * @param aHeight height of rect to union with region michael@0: * @return void michael@0: * michael@0: **/ michael@0: michael@0: void unionRect ( in long aX, in long aY, in long aWidth, in long aHeight ) ; michael@0: michael@0: /** michael@0: * destructively subtract another region with this one michael@0: * michael@0: * @param region to subtract michael@0: * @return void michael@0: * michael@0: **/ michael@0: michael@0: void subtractRegion ( in nsIScriptableRegion aRegion ) ; michael@0: michael@0: /** michael@0: * destructively subtract a rect from this region michael@0: * michael@0: * @param aX xoffset of rect to subtract with region michael@0: * @param aY yoffset of rect to subtract with region michael@0: * @param aWidth width of rect to subtract with region michael@0: * @param aHeight height of rect to subtract with region michael@0: * @return void michael@0: * michael@0: **/ michael@0: michael@0: void subtractRect ( in long aX, in long aY, in long aWidth, in long aHeight ) ; michael@0: michael@0: /** michael@0: * is this region empty? i.e. does it contain any pixels michael@0: * michael@0: * @param none michael@0: * @return returns whether the region is empty michael@0: * michael@0: **/ michael@0: michael@0: boolean isEmpty ( ) ; michael@0: michael@0: /** michael@0: * == operator equivalent i.e. do the regions contain exactly michael@0: * the same pixels michael@0: * michael@0: * @param region to compare michael@0: * @return whether the regions are identical michael@0: * michael@0: **/ michael@0: michael@0: boolean isEqualRegion ( in nsIScriptableRegion aRegion ) ; michael@0: michael@0: /** michael@0: * returns the bounding box of the region i.e. the smallest michael@0: * rectangle that completely contains the region. michael@0: * michael@0: * @param aX out parameter for xoffset of bounding rect for region michael@0: * @param aY out parameter for yoffset of bounding rect for region michael@0: * @param aWidth out parameter for width of bounding rect for region michael@0: * @param aHeight out parameter for height of bounding rect for region michael@0: * @return void michael@0: * michael@0: **/ michael@0: void getBoundingBox ( out long aX, out long aY, out long aWidth, out long aHeight ) ; michael@0: michael@0: /** michael@0: * offsets the region in x and y michael@0: * michael@0: * @param xoffset pixel offset in x michael@0: * @param yoffset pixel offset in y michael@0: * @return void michael@0: * michael@0: **/ michael@0: void offset ( in long aXOffset, in long aYOffset ) ; michael@0: michael@0: /** michael@0: * @return null if there are no rects, michael@0: * @return flat array of rects,ie [x1,y1,width1,height1,x2...]. michael@0: * The result will contain bogus data if values don't fit in 31 bit michael@0: **/ michael@0: [implicit_jscontext] jsval getRects(); michael@0: michael@0: /** michael@0: * does the region intersect the rectangle? michael@0: * michael@0: * @param rect to check for containment michael@0: * @return true if the region intersects the rect michael@0: * michael@0: **/ michael@0: michael@0: boolean containsRect ( in long aX, in long aY, in long aWidth, in long aHeight ) ; michael@0: michael@0: [noscript] readonly attribute nsIntRegion region; michael@0: michael@0: };