зеркало из https://github.com/mozilla/gecko-dev.git
416 строки
13 KiB
Plaintext
416 строки
13 KiB
Plaintext
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
*
|
|
* 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/
|
|
*
|
|
* 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.
|
|
*
|
|
* The Original Code is mozilla.org code.
|
|
*
|
|
* The Initial Developer of the Original Code is Netscape
|
|
* Communications Corporation. Portions created by Netscape are
|
|
* Copyright (C) 2000 Netscape Communications Corporation. All
|
|
* Rights Reserved.
|
|
*
|
|
* Contributor(s):
|
|
* Stuart Parmenter <pavlov@netscape.com>
|
|
*/
|
|
|
|
#include "nsISupports.idl"
|
|
#include "gfxtypes.idl"
|
|
|
|
interface nsIFontMetrics;
|
|
interface nsIImage;
|
|
interface nsIRegion;
|
|
|
|
/**
|
|
* nsIDrawable interface
|
|
*
|
|
* @author Stuart Parmenter <pavlov@netscape.com>
|
|
* @version 0.0
|
|
* @see "gfx2"
|
|
**/
|
|
[scriptable, uuid(12be2fd2-1dd2-11b2-bc8f-ac54c3aa0d69)]
|
|
interface nsIDrawable : nsISupports
|
|
{
|
|
|
|
/**
|
|
* consts used for changing the clip rect and region
|
|
*
|
|
* @name clip constants
|
|
* @see changeClipRectangle()
|
|
* @see changeClipRegion()
|
|
*/
|
|
//@{
|
|
const short clipIntersect = 0;
|
|
const short clipUnion = 1;
|
|
const short clipSubtract = 2;
|
|
//@}
|
|
|
|
/**
|
|
* Get the width and height of this drawable.
|
|
*
|
|
* @param width The width of the drawable in pixels.
|
|
* @param height The height of the drawable in pixels.
|
|
*/
|
|
void getSize(out gfx_dimension width, out gfx_dimension height);
|
|
|
|
/**
|
|
* Get the width of this drawable.
|
|
*
|
|
* @see getSize()
|
|
*/
|
|
readonly attribute gfx_dimension width;
|
|
|
|
/**
|
|
* Get the height of this drawable.
|
|
*
|
|
* @see getSize()
|
|
*/
|
|
readonly attribute gfx_dimension height;
|
|
|
|
|
|
readonly attribute gfx_depth depth;
|
|
|
|
/**
|
|
* Draw a point at (\a x, \a y).
|
|
*
|
|
* @param x The x-coordinate to draw at.
|
|
* @param y The y-coordinate to draw at.
|
|
*
|
|
* @note uses foreground, clip
|
|
*/
|
|
void drawPoint(in gfx_coord x,
|
|
in gfx_coord y);
|
|
|
|
|
|
/**
|
|
* Draw a line between the points (\a x1, \a y1) and (\a x2, \a y2).
|
|
*
|
|
* @param x1 the first point's x coordinate.
|
|
* @param y1 the first point's y coordinate.
|
|
* @param x2 the second point's x coordinate.
|
|
* @param y2 the second point's y coordinate.
|
|
*
|
|
* @note uses foreground, line width, clip
|
|
*/
|
|
void drawLine(in gfx_coord x1,
|
|
in gfx_coord y1,
|
|
in gfx_coord x2,
|
|
in gfx_coord y2);
|
|
|
|
|
|
/**
|
|
* Draw a rectangle filled with backgroundColor
|
|
*
|
|
* @param aX The x-coordinate of top-left corner of rectangle.
|
|
* @param aY The y-coordinate of top-left corner of rectangle.
|
|
* @param aWidth The width of the rectangle.
|
|
* @param aHeight The height of the rectangle.
|
|
*
|
|
* @note uses foreground, background, line width, clip
|
|
* @see fillRectangle()
|
|
*/
|
|
void drawRectangle(in gfx_coord aX,
|
|
in gfx_coord aY,
|
|
in gfx_dimension aWidth,
|
|
in gfx_dimension aHeight);
|
|
/**
|
|
* Draw a rectangle filled with backgroundColor
|
|
*
|
|
* @param aX The x-coordinate of top-left corner of rectangle.
|
|
* @param aY The y-coordinate of top-left corner of rectangle.
|
|
* @param aWidth The width of the rectangle
|
|
* @param aHeight The height of the rectangle
|
|
*
|
|
* @note uses foreground, background, line width, clip
|
|
* @see drawRectangle()
|
|
*/
|
|
void fillRectangle(in gfx_coord aX,
|
|
in gfx_coord aY,
|
|
in gfx_dimension aWidth,
|
|
in gfx_dimension aHeight);
|
|
|
|
|
|
/**
|
|
* Draw an ellipse
|
|
*
|
|
* @param aX The x-coordinate of the rectangle in which to draw the ellipse.
|
|
* @param aY The y-coordinate of the rectangle in which to draw the ellipse.
|
|
* @param aWidth The width of the rectangle in which to draw the ellipse.
|
|
* @param aHeight The height of the rectangle in which to draw the ellipse.
|
|
*
|
|
* @note uses foreground, background, clip
|
|
* @see fillEllipse()
|
|
*/
|
|
void drawEllipse(in gfx_coord aX,
|
|
in gfx_coord aY,
|
|
in gfx_dimension aWidth,
|
|
in gfx_dimension aHeight);
|
|
/**
|
|
* Draw an ellipse filled with backgroundColor
|
|
*
|
|
* @param aX The x-coordinate of the rectangle in which to draw the ellipse.
|
|
* @param aY The y-coordinate of the rectangle in which to draw the ellipse.
|
|
* @param aWidth The width of the rectangle in which to draw the ellipse.
|
|
* @param aHeight The height of the rectangle in which to draw the ellipse.
|
|
*
|
|
* @note uses foreground, background, clip
|
|
* @see drawEllipse()
|
|
*/
|
|
void fillEllipse(in gfx_coord aX,
|
|
in gfx_coord aY,
|
|
in gfx_dimension aWidth,
|
|
in gfx_dimension aHeight);
|
|
|
|
|
|
/**
|
|
* Draw an arc
|
|
*
|
|
* @param x The x-coordinate for the arc's bounding rectangle.
|
|
* @param a The y-coordinate for the arc's bounding rectangle.
|
|
* @param width The width of the arc's bounding rectangle.
|
|
* @param height The height of the arc's bounding rectangle.
|
|
* @param angle1 the starting angle of the arc, in the ellipse
|
|
* @param angle2 The ending angle of the arc, in the ellipse
|
|
*
|
|
* @note uses foreground, clip
|
|
* @see fillArc()
|
|
*/
|
|
void drawArc(in gfx_coord x,
|
|
in gfx_coord y,
|
|
in gfx_dimension width,
|
|
in gfx_dimension height,
|
|
in gfx_angle angle1,
|
|
in gfx_angle angle2);
|
|
/**
|
|
* Draw an arc filled with backgroundColor
|
|
*
|
|
* @param x The x-coordinate for the arc's bounding rectangle.
|
|
* @param a The y-coordinate for the arc's bounding rectangle.
|
|
* @param width The width of the arc's bounding rectangle.
|
|
* @param height The height of the arc's bounding rectangle.
|
|
* @param angle1 the starting angle of the arc, in the ellipse
|
|
* @param angle2 The ending angle of the arc, in the ellipse
|
|
*
|
|
* @note uses foreground, background, clip
|
|
* @see drawArc()
|
|
*/
|
|
void fillArc(in gfx_coord x,
|
|
in gfx_coord y,
|
|
in gfx_dimension width,
|
|
in gfx_dimension height,
|
|
in gfx_angle angle1,
|
|
in gfx_angle angle2);
|
|
|
|
|
|
/**
|
|
* Draw a polygon
|
|
*
|
|
* @param points An array of nsPoint2 structs that define the vertices of the polygon.
|
|
* @param npoints The number of points in the array. This number must be at least two.
|
|
*
|
|
* @note currently noscript because xpidl doesn't support structs
|
|
* @see fillPolygon()
|
|
*/
|
|
[noscript] void drawPolygon([array, size_is(npoints), const] in nsPoint2 points,
|
|
[const] in unsigned long npoints);
|
|
/**
|
|
* Draw a polygon filled with backgroundColor
|
|
*
|
|
* @param points An array of nsPoint2 structs that define the vertices of the polygon.
|
|
* @param npoints The number of points in the array. This number must be at least two.
|
|
*
|
|
* @note currently noscript because xpidl doesn't support structs
|
|
* @see drawPolygon()
|
|
*/
|
|
[noscript] void fillPolygon([array, size_is(npoints), const] in nsPoint2 points,
|
|
[const] in unsigned long npoints);
|
|
|
|
/**
|
|
* Draw a wide string
|
|
*
|
|
* @param text the text to draw
|
|
* @param length the length of the text to draw
|
|
* @param x offset from the origin of the drawable to begin drawing
|
|
* @param y offset from the origin of the drawable to begin drawing
|
|
*
|
|
* @note The baseline of the characters are drawn starting at the x and y coordinates ???
|
|
*/
|
|
void drawString([const] in wstring text,
|
|
in unsigned long length,
|
|
in gfx_coord x,
|
|
in gfx_coord y);
|
|
|
|
/**
|
|
* Draw a C string
|
|
*
|
|
* @param text the text to draw
|
|
* @param length the length of the text to draw
|
|
* @param x offset from the origin of the drawable to begin drawing
|
|
* @param y offset from the origin of the drawable to begin drawing
|
|
*
|
|
* @note The baseline of the characters are drawn starting at the x and y coordinates ???
|
|
*/
|
|
void drawCString([const] in string text,
|
|
in unsigned long length,
|
|
in gfx_coord x,
|
|
in gfx_coord y);
|
|
|
|
/**
|
|
* Copy the data of 'this' drawable in to \a dest
|
|
*
|
|
* @param dest The nsIDrawable to copy the contents of 'this' in to.
|
|
* @param xsrc The source x-coordinate.
|
|
* @param ysrc The source y-coordinate.
|
|
* @param xdest The destination x-coordinate.
|
|
* @param ydest The destination y-coordinate.
|
|
* @param width The width of the area to copy.
|
|
* @param height The height of the area to copy.
|
|
*
|
|
* @note uses clipping (from dest or source??)
|
|
*/
|
|
void copyTo(in nsIDrawable dest,
|
|
in gfx_coord xsrc,
|
|
in gfx_coord ysrc,
|
|
in gfx_coord xdest,
|
|
in gfx_coord ydest,
|
|
in gfx_dimension width,
|
|
in gfx_dimension height);
|
|
|
|
/**
|
|
* Clear an area
|
|
*
|
|
* @param x The x-coordinate of the rectangular area to clear.
|
|
* @param y The y-coordinate of the rectangular area to clear.
|
|
* @param width The width of the area to clear.
|
|
* @param height The height of the area to clear.
|
|
*
|
|
* @note This should not generate an expose event
|
|
* @see clear()
|
|
*/
|
|
void clearArea(in gfx_coord x,
|
|
in gfx_coord y,
|
|
in gfx_dimension width,
|
|
in gfx_dimension height);
|
|
|
|
/**
|
|
* Clear the entire contents of the drawing area
|
|
*
|
|
* @note This should not generate an expose event
|
|
* @see clearArea()
|
|
*/
|
|
void clear();
|
|
|
|
/**
|
|
* Draw an image without scaling.
|
|
*
|
|
* @param aImage The image to draw in to this drawable.
|
|
* @param aSrcRect The source rectangle of aImage to draw in to this at aDestPoint.
|
|
* @param aDestPoint The point at which to start drawing aSrcRect of aImage.
|
|
*
|
|
* @see drawScaledImage()
|
|
* @see drawTile()
|
|
* @see drawScaledTile()
|
|
*/
|
|
[noscript] void drawImage(in nsIImage aImage,
|
|
[const] in nsRect2 aSrcRect,
|
|
[const] in nsPoint2 aDestPoint);
|
|
|
|
/**
|
|
* Draw an image scaling \a aSrcRect to \a aDestRect
|
|
*
|
|
* @param aImage The image to draw in to this drawable.
|
|
* @param aSrcRect The source rectangle of aImage to draw in to this at aDestPoint.
|
|
* @param aDestRect The destination rectangle.
|
|
*
|
|
* @note If size(\a aSrcRect) < size(\a aDestRect), scale larger.
|
|
* @note If size(\a aSrcRect) > size(\a aDestRect), scale smaller.
|
|
*
|
|
* @exception NS_ERROR_FAILURE if size(dest) == size(source). use drawImage()
|
|
*
|
|
* @see drawImage()
|
|
* @see drawTile()
|
|
* @see drawScaledTile()
|
|
*/
|
|
[noscript] void drawScaledImage(in nsIImage aImage,
|
|
[const] in nsRect2 aSrcRect,
|
|
[const] in nsRect2 aDestRect);
|
|
|
|
/**
|
|
* Tile an image without scaling.
|
|
*
|
|
* @param aImage The image to tile in to this drawable.
|
|
* @param aXOffset The x-coordinate of the upper right tile.
|
|
* @param aYOffset The y-coordinate of the upper right tile.
|
|
* @param aTargetRect The entire area to tile the image in to.
|
|
*
|
|
* @see drawImage()
|
|
* @see drawScaledImage()
|
|
* @see drawScaledTile()
|
|
*/
|
|
[noscript] void drawTile(in nsIImage aImage,
|
|
in gfx_coord aXOffset,
|
|
in gfx_coord aYOffset,
|
|
[const] in nsRect2 aTargetRect);
|
|
|
|
/**
|
|
* Tile an an image scaling \a aSrcRect to \a aDestRect
|
|
*
|
|
* @note why are the params here so different from the other image drawing methods???
|
|
*
|
|
* @see drawImage()
|
|
* @see drawScaledImage()
|
|
* @see drawTile()
|
|
*/
|
|
[noscript] void drawScaledTile(in nsIImage aImage,
|
|
in gfx_coord aXOffset,
|
|
in gfx_coord aYOffset,
|
|
in gfx_dimension aTileWidth,
|
|
in gfx_dimension aTileHeight,
|
|
[const] in nsRect2 aTargetRect);
|
|
|
|
/* drawBezierCurve() */
|
|
|
|
|
|
|
|
|
|
|
|
/* drawable state stuff */
|
|
|
|
/**
|
|
* Width of the current line in pixels.
|
|
*
|
|
* @note used by drawLine, .....?
|
|
*/
|
|
attribute gfx_coord lineWidth;
|
|
|
|
attribute gfx_color foregroundColor;
|
|
attribute gfx_color backgroundColor;
|
|
|
|
[noscript] void setFont([const] in nsFont font);
|
|
[noscript] nsFont getFont();
|
|
|
|
attribute nsIFontMetrics fontMetrics;
|
|
|
|
/* clipping */
|
|
void getClipOrigin(out gfx_coord x, out gfx_coord y);
|
|
void setClipOrigin(in gfx_coord x, in gfx_coord y);
|
|
|
|
/* these should all set the same thing */
|
|
/* [noscript] attribute nsRect2 clipRectangle; */
|
|
void getClipRectangle(out gfx_coord x, out gfx_coord y, out gfx_dimension width, out gfx_dimension height);
|
|
void setClipRectangle(in gfx_coord x, in gfx_coord y, in gfx_dimension width, in gfx_dimension height);
|
|
|
|
attribute nsIRegion clipRegion;
|
|
|
|
[noscript] void changeClipRectangle([const] in nsRect2 rect, in short clipOperation);
|
|
void changeClipRegion(/*[const]*/in nsIRegion aRegion, in short clipOperation);
|
|
|
|
};
|