1998-04-13 20:24:54 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Netscape Public License
|
|
|
|
* Version 1.0 (the "NPL"); you may not use this file except in
|
|
|
|
* compliance with the NPL. You may obtain a copy of the NPL at
|
|
|
|
* http://www.mozilla.org/NPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* NPL.
|
|
|
|
*
|
|
|
|
* The Initial Developer of this code under the NPL is Netscape
|
|
|
|
* Communications Corporation. Portions created by Netscape are
|
|
|
|
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
|
|
|
* Reserved.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef nsIRenderingContext_h___
|
|
|
|
#define nsIRenderingContext_h___
|
|
|
|
|
|
|
|
#include "nscore.h"
|
|
|
|
#include "nsISupports.h"
|
|
|
|
#include "nsColor.h"
|
|
|
|
#include "nsCoord.h"
|
1999-02-25 18:53:31 +00:00
|
|
|
#include "nsIDrawingSurface.h"
|
1998-04-13 20:24:54 +00:00
|
|
|
|
|
|
|
class nsIWidget;
|
|
|
|
class nsIFontMetrics;
|
|
|
|
class nsIImage;
|
|
|
|
class nsTransform2D;
|
|
|
|
class nsString;
|
|
|
|
class nsIDeviceContext;
|
1998-05-18 21:46:20 +00:00
|
|
|
class nsIRegion;
|
1998-04-13 20:24:54 +00:00
|
|
|
|
|
|
|
struct nsFont;
|
|
|
|
struct nsPoint;
|
|
|
|
struct nsRect;
|
|
|
|
|
1998-05-27 02:13:28 +00:00
|
|
|
//cliprect/region combination methods
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
nsClipCombine_kIntersect = 0,
|
|
|
|
nsClipCombine_kUnion = 1,
|
|
|
|
nsClipCombine_kSubtract = 2,
|
|
|
|
nsClipCombine_kReplace = 3
|
|
|
|
} nsClipCombine;
|
|
|
|
|
1998-09-30 22:24:46 +00:00
|
|
|
//linestyles
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
nsLineStyle_kNone = 0,
|
|
|
|
nsLineStyle_kSolid = 1,
|
|
|
|
nsLineStyle_kDashed = 2,
|
|
|
|
nsLineStyle_kDotted = 3
|
|
|
|
} nsLineStyle;
|
|
|
|
|
1998-04-13 20:24:54 +00:00
|
|
|
// IID for the nsIRenderingContext interface
|
1998-09-07 19:12:44 +00:00
|
|
|
#define NS_IRENDERING_CONTEXT_IID \
|
|
|
|
{ 0xa6cf9068, 0x15b3, 0x11d2,{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
|
1998-04-13 20:24:54 +00:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
1998-08-03 04:53:25 +00:00
|
|
|
//a cross platform way of specifying a native rendering context
|
1998-04-13 20:24:54 +00:00
|
|
|
typedef void * nsDrawingSurface;
|
|
|
|
|
|
|
|
// RenderingContext interface
|
|
|
|
class nsIRenderingContext : public nsISupports
|
|
|
|
{
|
|
|
|
public:
|
1999-06-14 06:16:08 +00:00
|
|
|
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IRENDERING_CONTEXT_IID)
|
1998-12-17 22:13:41 +00:00
|
|
|
|
1998-04-13 20:24:54 +00:00
|
|
|
//TBD: bind/unbind, transformation of scalars (hacky),
|
|
|
|
//potential drawmode for selection, polygons. MMP
|
|
|
|
|
1998-04-14 22:20:32 +00:00
|
|
|
/**
|
|
|
|
* Initialize the RenderingContext
|
|
|
|
* @param aContext the device context to use.
|
|
|
|
* @param aWidget the widget to hook up to
|
|
|
|
* @result The result of the initialization, NS_Ok if no errors
|
|
|
|
*/
|
1998-11-14 02:05:13 +00:00
|
|
|
NS_IMETHOD Init(nsIDeviceContext* aContext, nsIWidget *aWidget) = 0;
|
1998-04-14 22:20:32 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Initialize the RenderingContext
|
|
|
|
* @param aContext the device context to use for the drawing.
|
|
|
|
* @param aSurface the surface to draw into
|
|
|
|
* @result The result of the initialization, NS_Ok if no errors
|
|
|
|
*/
|
1998-11-14 02:05:13 +00:00
|
|
|
NS_IMETHOD Init(nsIDeviceContext* aContext, nsDrawingSurface aSurface) = 0;
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1998-04-14 22:20:32 +00:00
|
|
|
/**
|
|
|
|
* Reset the rendering context
|
|
|
|
*/
|
1998-10-30 02:08:25 +00:00
|
|
|
NS_IMETHOD Reset(void) = 0;
|
1998-04-14 22:20:32 +00:00
|
|
|
|
1998-05-05 22:11:50 +00:00
|
|
|
/**
|
|
|
|
* Get the DeviceContext that this RenderingContext was initialized with
|
|
|
|
* @result the device context
|
|
|
|
*/
|
1998-10-30 02:08:25 +00:00
|
|
|
NS_IMETHOD GetDeviceContext(nsIDeviceContext *& aDeviceContext) = 0;
|
1998-05-05 22:11:50 +00:00
|
|
|
|
1999-03-09 22:07:06 +00:00
|
|
|
/**
|
|
|
|
* Lock a rect of the drawing surface associated with the
|
|
|
|
* rendering context. do not attempt to use any of the Rendering Context
|
|
|
|
* rendering or state management methods until the drawing surface has
|
|
|
|
* been Unlock()ed. if a drawing surface is Lock()ed with this method,
|
|
|
|
* it must be Unlock()ed by calling UnlockDrawingSurface() rather than
|
|
|
|
* just calling the Unlock() method on the drawing surface directly.
|
|
|
|
* see nsIDrawingSurface.h for more information
|
|
|
|
* @return error status
|
|
|
|
**/
|
|
|
|
NS_IMETHOD LockDrawingSurface(PRInt32 aX, PRInt32 aY, PRUint32 aWidth, PRUint32 aHeight,
|
|
|
|
void **aBits, PRInt32 *aStride, PRInt32 *aWidthBytes,
|
|
|
|
PRUint32 aFlags) = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Unlock a rect of the drawing surface associated with the rendering
|
|
|
|
* context. see nsIDrawingSurface.h for more information.
|
|
|
|
* @return error status
|
|
|
|
**/
|
|
|
|
NS_IMETHOD UnlockDrawingSurface(void) = 0;
|
|
|
|
|
1998-04-14 22:20:32 +00:00
|
|
|
/**
|
|
|
|
* Selects an offscreen drawing surface into the RenderingContext to draw to.
|
|
|
|
* @param aSurface is the offscreen surface we are going to draw to.
|
1998-10-23 17:58:18 +00:00
|
|
|
* if nsnull, the original drawing surface obtained at initialization
|
|
|
|
* should be selected.
|
1998-04-14 22:20:32 +00:00
|
|
|
*/
|
1998-09-07 19:12:44 +00:00
|
|
|
NS_IMETHOD SelectOffScreenDrawingSurface(nsDrawingSurface aSurface) = 0;
|
|
|
|
|
1999-02-10 02:15:47 +00:00
|
|
|
/**
|
|
|
|
* Get the currently selected drawing surface
|
|
|
|
* @param aSurface out parameter for the current drawing surface
|
|
|
|
*/
|
|
|
|
NS_IMETHOD GetDrawingSurface(nsDrawingSurface *aSurface) = 0;
|
|
|
|
|
1998-09-07 19:12:44 +00:00
|
|
|
/**
|
|
|
|
* Returns in aResult any rendering hints that the context has.
|
|
|
|
* See below for the hints bits. Always returns NS_OK.
|
|
|
|
*/
|
|
|
|
NS_IMETHOD GetHints(PRUint32& aResult) = 0;
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1998-04-14 22:20:32 +00:00
|
|
|
/**
|
|
|
|
* Save a graphical state onto a stack.
|
|
|
|
*/
|
1998-10-30 02:08:25 +00:00
|
|
|
NS_IMETHOD PushState(void) = 0;
|
1998-04-14 22:20:32 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get and and set RenderingContext to this graphical state
|
1998-06-16 16:49:29 +00:00
|
|
|
* @return if PR_TRUE, indicates that the clipping region after
|
|
|
|
* popping state is empty, else PR_FALSE
|
1998-04-14 22:20:32 +00:00
|
|
|
*/
|
1998-10-30 02:08:25 +00:00
|
|
|
NS_IMETHOD PopState(PRBool &aClipEmpty) = 0;
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1998-04-14 22:20:32 +00:00
|
|
|
/**
|
|
|
|
* Tells if a given rectangle is visible within the rendering context
|
|
|
|
* @param aRect is the rectangle that will be checked for visiblity
|
|
|
|
* @result If true, that rectanglular area is visable.
|
|
|
|
*/
|
1998-10-30 02:08:25 +00:00
|
|
|
NS_IMETHOD IsVisibleRect(const nsRect& aRect, PRBool &aIsVisible) = 0;
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1998-04-14 22:20:32 +00:00
|
|
|
/**
|
|
|
|
* Sets the clipping for the RenderingContext to the passed in rectangle
|
|
|
|
* @param aRect The rectangle to set the clipping rectangle to
|
1998-05-27 02:13:28 +00:00
|
|
|
* @param aCombine how to combine this rect with the current clip region.
|
|
|
|
* see the bottom of nsIRenderingContext.h
|
1998-06-03 21:30:51 +00:00
|
|
|
* @return PR_TRUE if the clip region is now empty, else PR_FALSE
|
1998-04-14 22:20:32 +00:00
|
|
|
*/
|
1998-10-30 02:08:25 +00:00
|
|
|
NS_IMETHOD SetClipRect(const nsRect& aRect, nsClipCombine aCombine, PRBool &aClipEmpty) = 0;
|
1998-04-14 22:20:32 +00:00
|
|
|
|
|
|
|
/**
|
1998-05-27 02:13:28 +00:00
|
|
|
* Gets the bounds of the clip region of the RenderingContext
|
|
|
|
* @param aRect out parameter to contain the clip region bounds
|
1998-05-18 21:46:20 +00:00
|
|
|
* for the RenderingContext
|
1998-06-03 21:30:51 +00:00
|
|
|
* @return PR_TRUE if the rendering context has a local cliprect set
|
|
|
|
* else aRect is undefined
|
1998-04-14 22:20:32 +00:00
|
|
|
*/
|
1998-10-30 02:08:25 +00:00
|
|
|
NS_IMETHOD GetClipRect(nsRect &aRect, PRBool &aHasLocalClip) = 0;
|
1998-05-18 21:46:20 +00:00
|
|
|
|
1998-09-30 22:24:46 +00:00
|
|
|
/**
|
|
|
|
* Sets the line style for the RenderingContext
|
|
|
|
* @param aLineStyle The line style
|
|
|
|
* @return NS_OK if the line style is correctly set
|
|
|
|
*/
|
|
|
|
NS_IMETHOD SetLineStyle(nsLineStyle aLineStyle) = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the line style for the RenderingContext
|
|
|
|
* @param aLineStyle The line style to be retrieved
|
|
|
|
* @return NS_OK if the line style is correctly retrieved
|
|
|
|
*/
|
|
|
|
NS_IMETHOD GetLineStyle(nsLineStyle &aLineStyle) = 0;
|
|
|
|
|
1998-05-18 21:46:20 +00:00
|
|
|
/**
|
|
|
|
* Sets the clipping for the RenderingContext to the passed in region
|
|
|
|
* @param aRegion The region to set the clipping area to
|
1998-05-27 02:13:28 +00:00
|
|
|
* @param aCombine how to combine this region with the current clip region.
|
|
|
|
* see the bottom of nsIRenderingContext.h
|
1998-06-03 21:30:51 +00:00
|
|
|
* @return PR_TRUE if the clip region is now empty, else PR_FALSE
|
1998-05-27 02:13:28 +00:00
|
|
|
*/
|
1998-10-30 02:08:25 +00:00
|
|
|
NS_IMETHOD SetClipRegion(const nsIRegion& aRegion, nsClipCombine aCombine, PRBool &aClipEmpty) = 0;
|
1998-05-27 02:13:28 +00:00
|
|
|
|
1999-09-13 03:42:37 +00:00
|
|
|
/**
|
|
|
|
* Gets a copy of the current clipping region for the RenderingContext
|
|
|
|
* @param aRegion inout parameter representing the clip region.
|
|
|
|
* if SetClipRegion() is called, do not assume that GetClipRegion()
|
|
|
|
* will return the same object.
|
|
|
|
*/
|
|
|
|
NS_IMETHOD CopyClipRegion(nsIRegion &aRegion) = 0;
|
|
|
|
|
1998-05-27 02:13:28 +00:00
|
|
|
/**
|
|
|
|
* Gets the current clipping region for the RenderingContext
|
|
|
|
* @param aRegion out parameter representing the clip region.
|
|
|
|
* if SetClipRegion() is called, do not assume that GetClipRegion()
|
|
|
|
* will return the same object.
|
1998-05-18 21:46:20 +00:00
|
|
|
*/
|
1998-10-30 02:08:25 +00:00
|
|
|
NS_IMETHOD GetClipRegion(nsIRegion **aRegion) = 0;
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1998-04-14 22:20:32 +00:00
|
|
|
/**
|
|
|
|
* Sets the forground color for the RenderingContext
|
|
|
|
* @param aColor The color to set the RenderingContext to
|
|
|
|
*/
|
1998-10-30 02:08:25 +00:00
|
|
|
NS_IMETHOD SetColor(nscolor aColor) = 0;
|
1998-04-14 22:20:32 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the forground color for the RenderingContext
|
|
|
|
* @return The current forground color of the RenderingContext
|
|
|
|
*/
|
1998-10-30 02:08:25 +00:00
|
|
|
NS_IMETHOD GetColor(nscolor &aColor) const = 0;
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1998-04-14 22:20:32 +00:00
|
|
|
/**
|
|
|
|
* Sets the font for the RenderingContext
|
|
|
|
* @param aFont The font to use in the RenderingContext
|
|
|
|
*/
|
1998-10-30 02:08:25 +00:00
|
|
|
NS_IMETHOD SetFont(const nsFont& aFont) = 0;
|
1998-04-14 22:20:32 +00:00
|
|
|
|
1998-10-01 03:36:06 +00:00
|
|
|
/**
|
|
|
|
* Sets the font for the RenderingContext
|
|
|
|
* @param aFontMetric The font metrics representing the
|
|
|
|
* font to use in the RenderingContext
|
|
|
|
*/
|
1998-10-30 02:08:25 +00:00
|
|
|
NS_IMETHOD SetFont(nsIFontMetrics *aFontMetrics) = 0;
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1998-04-14 22:20:32 +00:00
|
|
|
/**
|
|
|
|
* Get the current fontmetrics for the RenderingContext
|
|
|
|
* @return The current font of the RenderingContext
|
|
|
|
*/
|
1998-10-30 02:08:25 +00:00
|
|
|
NS_IMETHOD GetFontMetrics(nsIFontMetrics *&aFontMetrics) = 0;
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1998-04-14 22:20:32 +00:00
|
|
|
/**
|
|
|
|
* Add in a translate to the RenderingContext's transformation matrix
|
|
|
|
* @param aX The horizontal translation
|
|
|
|
* @param aY The vertical translation
|
|
|
|
*/
|
1998-10-30 02:08:25 +00:00
|
|
|
NS_IMETHOD Translate(nscoord aX, nscoord aY) = 0;
|
1998-04-14 22:20:32 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Add in a scale to the RenderingContext's transformation matrix
|
|
|
|
* @param aX The horizontal scale
|
|
|
|
* @param aY The vertical scale
|
|
|
|
*/
|
1998-10-30 02:08:25 +00:00
|
|
|
NS_IMETHOD Scale(float aSx, float aSy) = 0;
|
1998-04-14 22:20:32 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the current transformation matrix for the RenderingContext
|
|
|
|
* @return The transformation matrix for the RenderingContext
|
|
|
|
*/
|
1998-10-30 02:08:25 +00:00
|
|
|
NS_IMETHOD GetCurrentTransform(nsTransform2D *&aTransform) = 0;
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1998-04-14 22:20:32 +00:00
|
|
|
/**
|
1998-10-23 17:58:18 +00:00
|
|
|
* Create an offscreen drawing surface compatible with this RenderingContext.
|
|
|
|
* The rect passed in is not affected by any transforms in the rendering
|
|
|
|
* context and the values are in device units.
|
1998-05-05 22:11:50 +00:00
|
|
|
* @param aBounds A rectangle representing the size for the drawing surface.
|
|
|
|
* if nsnull then a bitmap will not be created and associated
|
|
|
|
* with the new drawing surface
|
1998-10-23 17:58:18 +00:00
|
|
|
* @param aSurfFlags see bottom of nsIRenderingContext.h
|
1998-04-14 22:20:32 +00:00
|
|
|
* @return A nsDrawingSurface
|
|
|
|
*/
|
1998-10-30 02:08:25 +00:00
|
|
|
NS_IMETHOD CreateDrawingSurface(nsRect *aBounds, PRUint32 aSurfFlags, nsDrawingSurface &aSurface) = 0;
|
1998-04-14 22:20:32 +00:00
|
|
|
|
|
|
|
/**
|
1998-05-05 22:11:50 +00:00
|
|
|
* Destroy a drawing surface created by CreateDrawingSurface()
|
|
|
|
* @param aDS A drawing surface to destroy
|
1998-04-14 22:20:32 +00:00
|
|
|
*/
|
1998-10-30 02:08:25 +00:00
|
|
|
NS_IMETHOD DestroyDrawingSurface(nsDrawingSurface aDS) = 0;
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1998-04-14 22:20:32 +00:00
|
|
|
/**
|
|
|
|
* Draw a line
|
|
|
|
* @param aXO starting horiztonal coord in twips
|
|
|
|
* @param aY0 starting vertical coord in twips
|
|
|
|
* @param aX1 end horiztonal coord in twips
|
|
|
|
* @param aY1 end vertical coord in twips
|
|
|
|
*/
|
1998-10-30 02:08:25 +00:00
|
|
|
NS_IMETHOD DrawLine(nscoord aX0, nscoord aY0, nscoord aX1, nscoord aY1) = 0;
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1998-07-17 17:26:21 +00:00
|
|
|
/**
|
|
|
|
* Draw a polyline
|
|
|
|
* @param aPoints array of endpoints
|
|
|
|
* @param aNumPonts number of points
|
|
|
|
*/
|
1998-10-30 02:08:25 +00:00
|
|
|
NS_IMETHOD DrawPolyline(const nsPoint aPoints[], PRInt32 aNumPoints) = 0;
|
1998-07-17 17:26:21 +00:00
|
|
|
|
1998-04-14 22:20:32 +00:00
|
|
|
/**
|
|
|
|
* Draw a rectangle
|
|
|
|
* @param aRect The rectangle to draw
|
|
|
|
*/
|
1998-10-30 02:08:25 +00:00
|
|
|
NS_IMETHOD DrawRect(const nsRect& aRect) = 0;
|
1998-04-14 22:20:32 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Draw a rectangle
|
|
|
|
* @param aX Horizontal left Coordinate in twips
|
|
|
|
* @param aY Vertical top Coordinate in twips
|
|
|
|
* @param aWidth Width of rectangle in twips
|
|
|
|
* @param aHeight Height of rectangle in twips
|
|
|
|
*/
|
1998-10-30 02:08:25 +00:00
|
|
|
NS_IMETHOD DrawRect(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight) = 0;
|
1998-04-14 22:20:32 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Fill a rectangle in the current foreground color
|
|
|
|
* @param aRect The rectangle to draw
|
|
|
|
*/
|
1998-10-30 02:08:25 +00:00
|
|
|
NS_IMETHOD FillRect(const nsRect& aRect) = 0;
|
1998-04-14 22:20:32 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Fill a rectangle in the current foreground color
|
|
|
|
* @param aX Horizontal left Coordinate in twips
|
|
|
|
* @param aY Vertical top Coordinate in twips
|
|
|
|
* @param aWidth Width of rectangle in twips
|
|
|
|
* @param aHeight Height of rectangle in twips
|
|
|
|
*/
|
1998-10-30 02:08:25 +00:00
|
|
|
NS_IMETHOD FillRect(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight) = 0;
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1999-07-20 07:26:09 +00:00
|
|
|
/**
|
|
|
|
* XOR Invert a rectangle in the current foreground color
|
|
|
|
* @param aRect The rectangle to draw
|
|
|
|
*/
|
|
|
|
NS_IMETHOD InvertRect(const nsRect& aRect) = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* XOR Invert a rectangle in the current foreground color
|
|
|
|
* @param aX Horizontal left Coordinate in twips
|
|
|
|
* @param aY Vertical top Coordinate in twips
|
|
|
|
* @param aWidth Width of rectangle in twips
|
|
|
|
* @param aHeight Height of rectangle in twips
|
|
|
|
*/
|
|
|
|
NS_IMETHOD InvertRect(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight) = 0;
|
|
|
|
|
1998-04-14 22:20:32 +00:00
|
|
|
/**
|
|
|
|
* Draw a poly in the current foreground color
|
|
|
|
* @param aPoints points to use for the drawing, last must equal first
|
|
|
|
* @param aNumPonts number of points in the polygon
|
|
|
|
*/
|
1998-10-30 02:08:25 +00:00
|
|
|
NS_IMETHOD DrawPolygon(const nsPoint aPoints[], PRInt32 aNumPoints) = 0;
|
1998-04-14 22:20:32 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Fill a poly in the current foreground color
|
|
|
|
* @param aPoints points to use for the drawing, last must equal first
|
|
|
|
* @param aNumPonts number of points in the polygon
|
|
|
|
*/
|
1998-10-30 02:08:25 +00:00
|
|
|
NS_IMETHOD FillPolygon(const nsPoint aPoints[], PRInt32 aNumPoints) = 0;
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1998-04-14 22:20:32 +00:00
|
|
|
/**
|
|
|
|
* Draw an ellipse in the current foreground color
|
|
|
|
* @param aRect The rectangle define bounds of ellipse to draw
|
|
|
|
*/
|
1998-10-30 02:08:25 +00:00
|
|
|
NS_IMETHOD DrawEllipse(const nsRect& aRect) = 0;
|
1998-04-14 22:20:32 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Draw an ellipse in the current foreground color
|
|
|
|
* @param aX Horizontal left Coordinate in twips
|
|
|
|
* @param aY Vertical top Coordinate in twips
|
|
|
|
* @param aWidth Width of horizontal axis in twips
|
|
|
|
* @param aHeight Height of vertical axis in twips
|
|
|
|
*/
|
1998-10-30 02:08:25 +00:00
|
|
|
NS_IMETHOD DrawEllipse(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight) = 0;
|
1998-04-14 22:20:32 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Fill an ellipse in the current foreground color
|
|
|
|
* @param aRect The rectangle define bounds of ellipse to draw
|
|
|
|
*/
|
1998-10-30 02:08:25 +00:00
|
|
|
NS_IMETHOD FillEllipse(const nsRect& aRect) = 0;
|
|
|
|
|
1998-04-14 22:20:32 +00:00
|
|
|
/**
|
|
|
|
* Fill an ellipse in the current foreground color
|
|
|
|
* @param aX Horizontal left Coordinate in twips
|
|
|
|
* @param aY Vertical top Coordinate in twips
|
|
|
|
* @param aWidth Width of horizontal axis in twips
|
|
|
|
* @param aHeight Height of vertical axis in twips
|
|
|
|
*/
|
1998-10-30 02:08:25 +00:00
|
|
|
NS_IMETHOD FillEllipse(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight) = 0;
|
|
|
|
|
1998-04-14 22:20:32 +00:00
|
|
|
/**
|
|
|
|
* Draw an arc in the current forground color
|
|
|
|
* @param aRect The rectangle define bounds of ellipse to use
|
|
|
|
* @param aStartAngle the starting angle of the arc, in the ellipse
|
|
|
|
* @param aEndAngle The ending angle of the arc, in the ellipse
|
|
|
|
*/
|
1998-10-30 02:08:25 +00:00
|
|
|
NS_IMETHOD DrawArc(const nsRect& aRect,
|
|
|
|
float aStartAngle, float aEndAngle) = 0;
|
|
|
|
|
1998-04-14 22:20:32 +00:00
|
|
|
/**
|
|
|
|
* Draw an arc in the current forground color
|
|
|
|
* @param aX Horizontal left Coordinate in twips
|
|
|
|
* @param aY Vertical top Coordinate in twips
|
|
|
|
* @param aWidth Width of horizontal axis in twips
|
|
|
|
* @param aHeight Height of vertical axis in twips
|
|
|
|
* @param aStartAngle the starting angle of the arc, in the ellipse
|
|
|
|
* @param aEndAngle The ending angle of the arc, in the ellipse
|
|
|
|
*/
|
1998-10-30 02:08:25 +00:00
|
|
|
NS_IMETHOD DrawArc(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight,
|
|
|
|
float aStartAngle, float aEndAngle) = 0;
|
|
|
|
|
1998-04-14 22:20:32 +00:00
|
|
|
/**
|
|
|
|
* Fill an arc in the current forground color
|
|
|
|
* @param aRect The rectangle define bounds of ellipse to use
|
|
|
|
* @param aStartAngle the starting angle of the arc, in the ellipse
|
|
|
|
* @param aEndAngle The ending angle of the arc, in the ellipse
|
|
|
|
*/
|
1998-10-30 02:08:25 +00:00
|
|
|
NS_IMETHOD FillArc(const nsRect& aRect,
|
|
|
|
float aStartAngle, float aEndAngle) = 0;
|
|
|
|
|
1998-04-14 22:20:32 +00:00
|
|
|
/**
|
|
|
|
* Fill an arc in the current forground color
|
|
|
|
* @param aX Horizontal left Coordinate in twips
|
|
|
|
* @param aY Vertical top Coordinate in twips
|
|
|
|
* @param aWidth Width of horizontal axis in twips
|
|
|
|
* @param aHeight Height of vertical axis in twips
|
|
|
|
* @param aStartAngle the starting angle of the arc, in the ellipse
|
|
|
|
* @param aEndAngle The ending angle of the arc, in the ellipse
|
|
|
|
*/
|
1998-10-30 02:08:25 +00:00
|
|
|
NS_IMETHOD FillArc(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight,
|
|
|
|
float aStartAngle, float aEndAngle) = 0;
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1998-10-02 01:07:56 +00:00
|
|
|
/**
|
|
|
|
* Returns the width (in app units) of an 8-bit character
|
1998-10-02 18:19:30 +00:00
|
|
|
* If no font has been Set, the results are undefined.
|
|
|
|
* @param aC character to measure
|
|
|
|
* @param aWidth out parameter for width
|
|
|
|
* @return error status
|
1998-10-02 01:07:56 +00:00
|
|
|
*/
|
1998-10-30 02:08:25 +00:00
|
|
|
NS_IMETHOD GetWidth(char aC, nscoord &aWidth) = 0;
|
1998-10-02 01:07:56 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the width (in app units) of a unicode character
|
1998-10-02 18:19:30 +00:00
|
|
|
* If no font has been Set, the results are undefined.
|
|
|
|
* @param aC character to measure
|
|
|
|
* @param aWidth out parameter for width
|
1999-01-28 05:03:05 +00:00
|
|
|
* @param aFontID an optional out parameter used to store a
|
|
|
|
* font identifier that can be passed into the DrawString()
|
|
|
|
* methods to speed rendering
|
1998-10-02 18:19:30 +00:00
|
|
|
* @return error status
|
1998-10-02 01:07:56 +00:00
|
|
|
*/
|
1999-01-28 05:03:05 +00:00
|
|
|
NS_IMETHOD GetWidth(PRUnichar aC, nscoord &aWidth,
|
|
|
|
PRInt32 *aFontID = nsnull) = 0;
|
1998-10-02 01:07:56 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the width (in app units) of an nsString
|
1998-10-02 18:19:30 +00:00
|
|
|
* If no font has been Set, the results are undefined.
|
|
|
|
* @param aString string to measure
|
|
|
|
* @param aWidth out parameter for width
|
1999-01-28 05:03:05 +00:00
|
|
|
* @param aFontID an optional out parameter used to store a
|
|
|
|
* font identifier that can be passed into the DrawString()
|
|
|
|
* methods to speed rendering
|
1998-10-02 18:19:30 +00:00
|
|
|
* @return error status
|
1998-10-02 01:07:56 +00:00
|
|
|
*/
|
1999-01-28 05:03:05 +00:00
|
|
|
NS_IMETHOD GetWidth(const nsString& aString, nscoord &aWidth,
|
|
|
|
PRInt32 *aFontID = nsnull) = 0;
|
1998-10-02 01:07:56 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the width (in app units) of an 8-bit character string
|
1998-10-02 18:19:30 +00:00
|
|
|
* If no font has been Set, the results are undefined.
|
|
|
|
* @param aString string to measure
|
|
|
|
* @param aWidth out parameter for width
|
|
|
|
* @return error status
|
1998-10-02 01:07:56 +00:00
|
|
|
*/
|
1998-10-30 02:08:25 +00:00
|
|
|
NS_IMETHOD GetWidth(const char* aString, nscoord& aWidth) = 0;
|
1998-10-02 01:07:56 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the width (in app units) of an 8-bit character string
|
1998-10-02 18:19:30 +00:00
|
|
|
* If no font has been Set, the results are undefined.
|
|
|
|
* @param aString string to measure
|
|
|
|
* @param aLength number of characters in string
|
|
|
|
* @param aWidth out parameter for width
|
|
|
|
* @return error status
|
1998-10-02 01:07:56 +00:00
|
|
|
*/
|
1998-10-30 02:08:25 +00:00
|
|
|
NS_IMETHOD GetWidth(const char* aString, PRUint32 aLength,
|
|
|
|
nscoord& aWidth) = 0;
|
1998-10-02 01:07:56 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the width (in app units) of a Unicode character string
|
1998-10-02 18:19:30 +00:00
|
|
|
* If no font has been Set, the results are undefined.
|
|
|
|
* @param aString string to measure
|
|
|
|
* @param aLength number of characters in string
|
|
|
|
* @param aWidth out parameter for width
|
1999-01-28 05:03:05 +00:00
|
|
|
* @param aFontID an optional out parameter used to store a
|
|
|
|
* font identifier that can be passed into the DrawString()
|
|
|
|
* methods to speed rendering
|
1998-10-02 18:19:30 +00:00
|
|
|
* @return error status
|
1998-10-02 01:07:56 +00:00
|
|
|
*/
|
1998-10-30 02:08:25 +00:00
|
|
|
NS_IMETHOD GetWidth(const PRUnichar *aString, PRUint32 aLength,
|
1999-01-28 05:03:05 +00:00
|
|
|
nscoord &aWidth, PRInt32 *aFontID = nsnull) = 0;
|
1998-10-02 01:07:56 +00:00
|
|
|
|
1998-04-14 22:20:32 +00:00
|
|
|
/**
|
|
|
|
* Draw a string in the RenderingContext
|
|
|
|
* @param aString The string to draw
|
|
|
|
* @param aLength The length of the aString
|
|
|
|
* @param aX Horizontal starting point of baseline
|
|
|
|
* @param aY Vertical starting point of baseline.
|
1998-10-26 17:12:39 +00:00
|
|
|
* @param aSpacing inter-character spacing to apply
|
1998-04-14 22:20:32 +00:00
|
|
|
*/
|
1998-10-30 02:08:25 +00:00
|
|
|
NS_IMETHOD DrawString(const char *aString, PRUint32 aLength,
|
|
|
|
nscoord aX, nscoord aY,
|
|
|
|
const nscoord* aSpacing = nsnull) = 0;
|
1998-09-07 19:12:44 +00:00
|
|
|
|
1998-04-14 22:20:32 +00:00
|
|
|
/**
|
|
|
|
* Draw a string in the RenderingContext
|
|
|
|
* @param aString A PRUnichar of the string
|
|
|
|
* @param aLength The length of the aString
|
|
|
|
* @param aX Horizontal starting point of baseline
|
|
|
|
* @param aY Vertical starting point of baseline.
|
1999-01-28 05:03:05 +00:00
|
|
|
* @param aFontID an optional parameter used to speed font
|
|
|
|
* selection for complex unicode strings. the value
|
|
|
|
* passed is returned by the DrawString() methods.
|
1998-10-26 17:12:39 +00:00
|
|
|
* @param aSpacing inter-character spacing to apply
|
1998-04-14 22:20:32 +00:00
|
|
|
*/
|
1998-10-30 02:08:25 +00:00
|
|
|
NS_IMETHOD DrawString(const PRUnichar *aString, PRUint32 aLength,
|
|
|
|
nscoord aX, nscoord aY,
|
1999-01-28 05:03:05 +00:00
|
|
|
PRInt32 aFontID = -1,
|
1998-10-30 02:08:25 +00:00
|
|
|
const nscoord* aSpacing = nsnull) = 0;
|
1998-09-07 19:12:44 +00:00
|
|
|
|
1998-04-14 22:20:32 +00:00
|
|
|
/**
|
|
|
|
* Draw a string in the RenderingContext
|
|
|
|
* @param aString A nsString of the string
|
|
|
|
* @param aX Horizontal starting point of baseline
|
|
|
|
* @param aY Vertical starting point of baseline.
|
1999-01-28 05:03:05 +00:00
|
|
|
* @param aFontID an optional parameter used to speed font
|
|
|
|
* selection for complex unicode strings. the value
|
|
|
|
* passed is returned by the DrawString() methods.
|
1998-10-26 17:12:39 +00:00
|
|
|
* @param aSpacing inter-character spacing to apply
|
1998-04-14 22:20:32 +00:00
|
|
|
*/
|
1998-10-30 02:08:25 +00:00
|
|
|
NS_IMETHOD DrawString(const nsString& aString, nscoord aX, nscoord aY,
|
1999-01-28 05:03:05 +00:00
|
|
|
PRInt32 aFontID = -1,
|
1998-10-30 02:08:25 +00:00
|
|
|
const nscoord* aSpacing = nsnull) = 0;
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1998-04-14 22:20:32 +00:00
|
|
|
/**
|
|
|
|
* Copy an image to the RenderingContext
|
|
|
|
* @param aX Horzontal left destination coordinate
|
|
|
|
* @param aY Vertical top of destinatio coordinate
|
|
|
|
*/
|
1998-10-30 02:08:25 +00:00
|
|
|
NS_IMETHOD DrawImage(nsIImage *aImage, nscoord aX, nscoord aY) = 0;
|
1998-04-14 22:20:32 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Copy an image to the RenderingContext, scaling can occur if width/hieght does not match source
|
|
|
|
* @param aX Horzontal left destination coordinate
|
|
|
|
* @param aY Vertical top of destinatio coordinate
|
|
|
|
* @param aWidth Width of destination,
|
|
|
|
* @param aHeight Height of destination
|
|
|
|
*/
|
1998-10-30 02:08:25 +00:00
|
|
|
NS_IMETHOD DrawImage(nsIImage *aImage, nscoord aX, nscoord aY,
|
|
|
|
nscoord aWidth, nscoord aHeight) = 0;
|
|
|
|
|
1998-04-14 22:20:32 +00:00
|
|
|
/**
|
|
|
|
* Copy an image to the RenderingContext, scaling can occur if source/dest rects differ
|
|
|
|
* @param aRect Destination rectangle to copy the image to
|
|
|
|
*/
|
1998-10-30 02:08:25 +00:00
|
|
|
NS_IMETHOD DrawImage(nsIImage *aImage, const nsRect& aRect) = 0;
|
|
|
|
|
1998-04-14 22:20:32 +00:00
|
|
|
/**
|
|
|
|
* Copy an image to the RenderingContext, scaling/clipping can occur if source/dest rects differ
|
|
|
|
* @param aSRect Source rectangle to copy from
|
|
|
|
* @param aDRect Destination rectangle to copy the image to
|
|
|
|
*/
|
1998-10-30 02:08:25 +00:00
|
|
|
NS_IMETHOD DrawImage(nsIImage *aImage, const nsRect& aSRect, const nsRect& aDRect)=0;
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1998-04-14 22:20:32 +00:00
|
|
|
/**
|
1998-10-23 17:58:18 +00:00
|
|
|
* Copy offscreen pixelmap to this RenderingContext.
|
|
|
|
* @param aSrcSurf drawing surface to copy bits from
|
|
|
|
* @param aSrcX x offset into source pixelmap to copy from
|
|
|
|
* @param aSrcY y offset into source pixelmap to copy from
|
|
|
|
* @param aDestBounds Destination rectangle to copy to
|
|
|
|
* @param aCopyFlags see below
|
1998-04-14 22:20:32 +00:00
|
|
|
*/
|
1998-10-23 17:58:18 +00:00
|
|
|
NS_IMETHOD CopyOffScreenBits(nsDrawingSurface aSrcSurf, PRInt32 aSrcX, PRInt32 aSrcY,
|
|
|
|
const nsRect &aDestBounds, PRUint32 aCopyFlags) = 0;
|
1999-06-26 21:53:07 +00:00
|
|
|
//~~~
|
|
|
|
NS_IMETHOD RetrieveCurrentNativeGraphicData(PRUint32 * ngd) = 0;
|
1998-04-13 20:24:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
//modifiers for text rendering
|
|
|
|
|
|
|
|
#define NS_DRAWSTRING_NORMAL 0x0
|
|
|
|
#define NS_DRAWSTRING_UNDERLINE 0x1
|
|
|
|
#define NS_DRAWSTRING_OVERLINE 0x2
|
|
|
|
#define NS_DRAWSTRING_LINE_THROUGH 0x4
|
|
|
|
|
1998-09-07 19:12:44 +00:00
|
|
|
// Bit values for GetHints
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This bit, when set, indicates that the underlying rendering system
|
|
|
|
* prefers 8 bit text rendering over PRUnichar text rendering. When this
|
|
|
|
* bit is <b>not</b> set the opposite is true: the system prefers PRUnichar
|
|
|
|
* rendering, not 8 bit rendering.
|
|
|
|
*/
|
|
|
|
#define NS_RENDERING_HINT_FAST_8BIT_TEXT 0x1
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This bit, when set, indicates that the rendering is being done
|
|
|
|
* remotely.
|
|
|
|
*/
|
|
|
|
#define NS_RENDERING_HINT_REMOTE_RENDERING 0x2
|
|
|
|
|
1998-10-23 17:58:18 +00:00
|
|
|
//flags for copy CopyOffScreenBits
|
|
|
|
|
|
|
|
//when performing the blit, use the region, if any,
|
|
|
|
//that exists in the source drawingsurface as a
|
|
|
|
//blit mask.
|
|
|
|
#define NS_COPYBITS_USE_SOURCE_CLIP_REGION 0x0001
|
|
|
|
|
|
|
|
//transform the source offsets by the xform in the
|
|
|
|
//rendering context
|
|
|
|
#define NS_COPYBITS_XFORM_SOURCE_VALUES 0x0002
|
|
|
|
|
|
|
|
//transform the destination rect by the xform in the
|
|
|
|
//rendering context
|
|
|
|
#define NS_COPYBITS_XFORM_DEST_VALUES 0x0004
|
|
|
|
|
|
|
|
//this is basically a hack and is used by callers
|
|
|
|
//who have selected an alternate drawing surface and
|
|
|
|
//wish the copy to happen to that buffer rather than
|
|
|
|
//the "front" buffer. i'm not proud of this. MMP
|
1999-08-19 22:34:22 +00:00
|
|
|
//XXX: This is no longer needed by the XPCODE. It will
|
|
|
|
//be removed once all of the platform specific nsRenderingContext's
|
|
|
|
//stop using it.
|
1998-10-23 17:58:18 +00:00
|
|
|
#define NS_COPYBITS_TO_BACK_BUFFER 0x0008
|
|
|
|
|
1998-04-13 20:24:54 +00:00
|
|
|
#endif /* nsIRenderingContext_h___ */
|