2001-09-26 04:16:04 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
2004-04-18 01:52:36 +04:00
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
1998-05-22 18:15:57 +04:00
|
|
|
*
|
2004-04-18 01:52:36 +04:00
|
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/MPL/
|
1998-05-22 18:15:57 +04:00
|
|
|
*
|
2001-09-26 04:16:04 +04:00
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
1998-05-22 18:15:57 +04:00
|
|
|
*
|
1999-11-06 06:43:54 +03:00
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
2004-04-18 01:52:36 +04:00
|
|
|
* The Initial Developer of the Original Code is
|
2001-09-26 04:16:04 +04:00
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
1999-11-06 06:43:54 +03:00
|
|
|
*
|
2001-09-26 04:16:04 +04:00
|
|
|
* Contributor(s):
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
2004-04-18 01:52:36 +04:00
|
|
|
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
|
|
|
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
2001-09-26 04:16:04 +04:00
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
2004-04-18 01:52:36 +04:00
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
2001-09-26 04:16:04 +04:00
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
2004-04-18 01:52:36 +04:00
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
2001-09-26 04:16:04 +04:00
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
1998-05-22 18:15:57 +04:00
|
|
|
|
|
|
|
#ifndef nsIBlender_h___
|
|
|
|
#define nsIBlender_h___
|
|
|
|
|
|
|
|
#include "nscore.h"
|
|
|
|
#include "nsISupports.h"
|
|
|
|
#include "nsIRenderingContext.h"
|
|
|
|
|
1998-06-11 21:33:26 +04:00
|
|
|
// IID for the nsIBlender interface
|
1998-05-22 18:15:57 +04:00
|
|
|
#define NS_IBLENDER_IID \
|
|
|
|
{ 0xbdb4b5b0, 0xf0db, 0x11d1, \
|
|
|
|
{ 0xa8, 0x2a, 0x00, 0x40, 0x95, 0x9a, 0x28, 0xc9 } }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
|
|
// Blender interface
|
|
|
|
class nsIBlender : public nsISupports
|
|
|
|
{
|
|
|
|
public:
|
1999-06-14 10:16:08 +04:00
|
|
|
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IBLENDER_IID)
|
1998-11-04 19:02:50 +03:00
|
|
|
|
1998-05-22 18:15:57 +04:00
|
|
|
/**
|
|
|
|
* Initialize the Blender
|
1998-11-04 19:02:50 +03:00
|
|
|
* @update dc 11/4/98
|
1999-02-25 21:53:31 +03:00
|
|
|
* @param aContext is where the blender can get info about the device its blending on
|
1998-05-22 18:15:57 +04:00
|
|
|
* @result The result of the initialization, NS_OK if no errors
|
|
|
|
*/
|
1999-02-25 21:53:31 +03:00
|
|
|
NS_IMETHOD Init(nsIDeviceContext *aContext) = 0;
|
1998-06-22 18:41:23 +04:00
|
|
|
|
1998-05-22 18:15:57 +04:00
|
|
|
/**
|
|
|
|
* NOTE: if we can make this static, that would be great. I don't think we can.
|
|
|
|
* Blend source and destination nsDrawingSurfaces. Both drawing surfaces
|
|
|
|
* will have bitmaps associated with them.
|
|
|
|
* @param aSX x offset into source drawing surface of blend area
|
|
|
|
* @param aSY y offset into source drawing surface of blend area
|
|
|
|
* @param aWidth width of blend area
|
|
|
|
* @param aHeight width of blend area
|
1998-11-04 19:02:50 +03:00
|
|
|
* @param aSrc source for the blending
|
1998-05-22 18:15:57 +04:00
|
|
|
* @param aDest destination for blending
|
|
|
|
* @param aDX x offset into destination drawing surface of blend area
|
|
|
|
* @param aDY y offset into destination drawing surface of blend area
|
|
|
|
* @param aSrcOpacity 0.0f -> 1.0f opacity value of source area. 1.0f indicates
|
|
|
|
* complete opacity.
|
1998-12-01 05:15:44 +03:00
|
|
|
* @param aSecondSrc an optional second source drawing surface which is used in
|
|
|
|
* conjunction with the background color parameters to determine
|
|
|
|
* which pixels to blend
|
|
|
|
* @param aSrcBackColor color of pixels in aSrc that should be
|
|
|
|
* considered "background" color
|
|
|
|
* @param aSecondSrcBackColor color of pixels in aSrc that should be
|
|
|
|
* considered "background" color
|
1998-05-22 18:15:57 +04:00
|
|
|
*/
|
2004-07-18 21:36:03 +04:00
|
|
|
NS_IMETHOD Blend(PRInt32 aSX, PRInt32 aSY, PRInt32 aWidth, PRInt32 aHeight,nsIDrawingSurface* aSrc,
|
|
|
|
nsIDrawingSurface* aDest, PRInt32 aDX, PRInt32 aDY, float aSrcOpacity,
|
|
|
|
nsIDrawingSurface* aSecondSrc = nsnull, nscolor aSrcBackColor = NS_RGB(0, 0, 0),
|
1998-12-01 05:15:44 +03:00
|
|
|
nscolor aSecondSrcBackColor = NS_RGB(0, 0, 0)) = 0;
|
1999-03-10 01:07:06 +03:00
|
|
|
|
|
|
|
NS_IMETHOD Blend(PRInt32 aSX, PRInt32 aSY, PRInt32 aWidth, PRInt32 aHeight, nsIRenderingContext *aSrc,
|
|
|
|
nsIRenderingContext *aDest, PRInt32 aDX, PRInt32 aDY, float aSrcOpacity,
|
|
|
|
nsIRenderingContext *aSecondSrc = nsnull, nscolor aSrcBackColor = NS_RGB(0, 0, 0),
|
|
|
|
nscolor aSecondSrcBackColor = NS_RGB(0, 0, 0)) = 0;
|
2003-04-06 06:49:40 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
GetAlphas computes an array of alpha values for a rectangle of pixels, using
|
|
|
|
the drawn-onto-black and the drawn-onto-white images. The pixels are
|
|
|
|
returned in a new'ed array of aRect.width*aRect.height elements, in row-major
|
|
|
|
order. This array must be freed by the caller.
|
|
|
|
*/
|
2004-07-18 21:36:03 +04:00
|
|
|
NS_IMETHOD GetAlphas(const nsRect& aRect, nsIDrawingSurface* aBlack,
|
|
|
|
nsIDrawingSurface* aWhite, PRUint8** aAlphas) = 0;
|
1998-05-22 18:15:57 +04:00
|
|
|
};
|
|
|
|
|
1998-10-26 08:39:12 +03:00
|
|
|
#endif
|