Back to index

lightning-sunbird  0.9+nobinonly
Classes
Rendering Engine Interfaces

Classes

interface  nsISVGRenderer
 One of a number of interfaces (all starting with nsISVGRenderer*) to be implemented by an SVG rendering engine. More...
interface  nsISVGRendererCanvas
 One of a number of interfaces (all starting with nsISVGRenderer*) to be implemented by an SVG rendering engine. More...
interface  nsISVGRendererGlyphGeometry
 One of a number of interfaces (all starting with nsISVGRenderer*) to be implemented by an SVG rendering engine. More...
interface  nsISVGRendererGlyphMetrics
 One of a number of interfaces (all starting with nsISVGRenderer*) to be implemented by an SVG rendering engine. More...
interface  nsISVGRendererPathBuilder
 One of a number of interfaces (all starting with nsISVGRenderer*) to be implemented by an SVG rendering engine. More...
interface  nsISVGRendererPathGeometry
 One of a number of interfaces (all starting with nsISVGRenderer*) to be implemented by an SVG rendering engine. More...
interface  nsISVGRendererRegion
 One of a number of interfaces (all starting with nsISVGRenderer*) to be implemented by an SVG rendering engine. More...

Class Documentation

interface nsISVGRenderer

One of a number of interfaces (all starting with nsISVGRenderer*) to be implemented by an SVG rendering engine.

This interface serves as a factory for rendering engine-related objects. Each rendering engine needs to make available an nsIRenderer-object with a contract id of the form "@mozilla.org/svg/renderer;1?tech=NAME".

Engines implemented at the moment include an ms windows gdi+ engine ("@mozilla.org/svg/renderer;1?tech=GDIPLUS") and a (somewhat) cross-platform libart engine ("@mozilla.org/svg/renderer;1?tech=LIBART").

Definition at line 80 of file nsISVGRenderer.idl.

Inheritance diagram for nsISVGRenderer:
Collaboration diagram for nsISVGRenderer:

Public Member Functions

nsISVGRendererPathGeometry createPathGeometry (in nsISVGPathGeometrySource src)
 Create a rendering engine-native path geometry object for the source object given by 'src'.
nsISVGRendererGlyphMetrics createGlyphMetrics (in nsISVGGlyphMetricsSource src)
 Create a rendering engine-native glyph metrics object for the source object given by 'src'.
nsISVGRendererGlyphGeometry createGlyphGeometry (in nsISVGGlyphGeometrySource src)
 Create a rendering engine-native glyph geometry object for the source object given by 'src'.
nsISVGRendererCanvas createCanvas (in nsIRenderingContext ctx, in nsPresContext presContext,[const ] in nsRectRef dirtyRect)
 Create a rendering engine-native canvas object for the Mozilla-native rendering context 'ctx' and presentation context 'presContext'.
nsISVGRendererRegion createRectRegion (in float x, in float y, in float width, in float height)
 Create a rendering engine-native region object for the given axis-aligned rectangle.
nsISVGRendererSurface createSurface (in unsigned long width, in unsigned long height)
 Create a rendering engine-native surface object.

Member Function Documentation

Create a rendering engine-native canvas object for the Mozilla-native rendering context 'ctx' and presentation context 'presContext'.

Parameters:
ctxMozilla-native rendering context.
presContextPresentation context.
dirtyRectArea that the canvas should cover.
Returns:
A rendering engine-native canvas object.

Create a rendering engine-native glyph geometry object for the source object given by 'src'.

Parameters:
srcThe source object describing the glyph for which this object is being created.
Returns:
A rendering engine-native glyph geometry object.

Create a rendering engine-native glyph metrics object for the source object given by 'src'.

Parameters:
srcThe source object describing the glyph for which this metrics object is being created.
Returns:
A rendering engine-native glyph metrics object.

Create a rendering engine-native path geometry object for the source object given by 'src'.

Parameters:
srcThe source object describing the path for which this object is being created.
Returns:
A rendering engine-native path geometry object.
nsISVGRendererRegion nsISVGRenderer::createRectRegion ( in float  x,
in float  y,
in float  width,
in float  height 
)

Create a rendering engine-native region object for the given axis-aligned rectangle.

Parameters:
xX-coordinate of rectangle (pixels).
yY-coordinate of rectangle (pixels).
widthWidth of rectangle (pixels).
heightHeight of rectangle (pixels).
Returns:
A rendering engine-native region object.
nsISVGRendererSurface nsISVGRenderer::createSurface ( in unsigned long  width,
in unsigned long  height 
)

Create a rendering engine-native surface object.

Parameters:
widthWidth of rectangle (pixels).
heightHeight of rectangle (pixels).
Returns:
A rendering engine-native surface object.
interface nsISVGRendererCanvas

One of a number of interfaces (all starting with nsISVGRenderer*) to be implemented by an SVG rendering engine.

See nsISVGRenderer for more details.

This interface abstracts a rendering engine-native canvas object onto which path and glyph geometries can be painted.

A canvas object is instantiated by the backend for a given Mozilla-native rendering object with a call to nsISVGRenderer::createCanvas().

Definition at line 73 of file nsISVGRendererCanvas.idl.

Inheritance diagram for nsISVGRendererCanvas:
Collaboration diagram for nsISVGRendererCanvas:

Public Member Functions

nsIRenderingContext lockRenderingContext ([const ] in nsRectRef rect)
 Lock a portion of the canvas and obtain a rendering context onto which Mozilla can paint non-svg content.
void unlockRenderingContext ()
 Unlock the canvas portion locked with a previous call to lockRenderingContext().
nsPresContext getPresContext ()
void clear (in nscolor color)
 Fill the canvas with the given color.
void flush ()
 Ensure that all renderings on the canvas have been flushed to the Mozilla-native rendering context.
void pushClip ()
 Push/Pop clip path.
void popClip ()
void setClipRect (in nsIDOMSVGMatrix canvasTM, in float x, in float y, in float width, in float height)
 Set rectangular clip region.
void pushSurface (in nsISVGRendererSurface surface)
 Push/Pop surface as primary drawing surface.
void popSurface ()
void compositeSurface (in nsISVGRendererSurface surface, in unsigned long x, in unsigned long y, in float opacity)
 Surface composition.
void compositeSurfaceMatrix (in nsISVGRendererSurface surface, in nsIDOMSVGMatrix canvasTM, in float opacity)

Public Attributes

const unsigned short SVG_RENDER_MODE_NORMAL = 0
 Set render mode (clipping or normal draw)
const unsigned short SVG_RENDER_MODE_CLIP = 1
attribute unsigned short renderMode

Member Function Documentation

Fill the canvas with the given color.

Parameters:
colorFill color.
void nsISVGRendererCanvas::compositeSurface ( in nsISVGRendererSurface  surface,
in unsigned long  x,
in unsigned long  y,
in float  opacity 
)

Surface composition.

Ensure that all renderings on the canvas have been flushed to the Mozilla-native rendering context.

Lock a portion of the canvas and obtain a rendering context onto which Mozilla can paint non-svg content.

This is needed for (partial) foreignObject support.

lockRenderingContext() calls are paired with unlockRenderingContext() calls.

Parameters:
rectArea to be locked.
Returns:
Mozilla-native rendering context for the locked area.

Push/Pop clip path.

Push/Pop surface as primary drawing surface.

void nsISVGRendererCanvas::setClipRect ( in nsIDOMSVGMatrix  canvasTM,
in float  x,
in float  y,
in float  width,
in float  height 
)

Set rectangular clip region.

Unlock the canvas portion locked with a previous call to lockRenderingContext().


Member Data Documentation

Definition at line 115 of file nsISVGRendererCanvas.idl.

Definition at line 114 of file nsISVGRendererCanvas.idl.

Set render mode (clipping or normal draw)

Definition at line 113 of file nsISVGRendererCanvas.idl.

interface nsISVGRendererGlyphGeometry

One of a number of interfaces (all starting with nsISVGRenderer*) to be implemented by an SVG rendering engine.

See nsISVGRenderer for more details.

The SVG rendering backend uses this interface to communicate to the rendering engine-native glyph objects.

A glyph object is instantiated by the rendering backend for a given nsISVGGlyphGeometrySource object with a call to nsISVGRenderer::createGlyphGeometry(). The glyph object is assumed to store a reference to its associated source object and provide glyph rendering and hit-testing for the (composite) glyph described by the nsISVGGlyphGeometrySource members.

Definition at line 67 of file nsISVGRendererGlyphGeometry.idl.

Inheritance diagram for nsISVGRendererGlyphGeometry:
Collaboration diagram for nsISVGRendererGlyphGeometry:

Public Member Functions

void render (in nsISVGRendererCanvas canvas)
 Paint this object.
nsISVGRendererRegion update (in unsigned long updatemask)
 Called by this object's corresponding nsISVGGlyphGeometrySource as a notification that some of the source's data (identified by paramter 'updatemask') has changed.
nsISVGRendererRegion getCoveredRegion ()
 Get a region object describing the area covered with paint by this glyph geometry.
boolean containsPoint (in float x, in float y)
 Hit-testing method.

Public Attributes

readonly attribute nsIDOMSVGRect boundingBox
 Transformed bounding box (does not include stroke width)

Member Function Documentation

Hit-testing method.

Does this glyph geometry (with all relevant transformations applied) contain the point x,y? Should work on a character-cell basis, rather than the actual character outline.

Parameters:
xX-coordinate of test point.
yY-coordinate of test point.
Returns:
PR_TRUE if the glyph geometry contains the point, PR_FALSE otherwise.

Get a region object describing the area covered with paint by this glyph geometry.

Returns:
Covered region.

Paint this object.

Parameters:
canvasThe canvas to render to.

Here is the caller graph for this function:

Called by this object's corresponding nsISVGGlyphGeometrySource as a notification that some of the source's data (identified by paramter 'updatemask') has changed.

Parameters:
updatemaskAn OR-ed combination of the UPDATEMASK_* constants defined in nsISVGGlyphGeometrySource.
Returns:
Region that needs to be redrawn.

Member Data Documentation

Transformed bounding box (does not include stroke width)

Definition at line 110 of file nsISVGRendererGlyphGeometry.idl.

interface nsISVGRendererGlyphMetrics

One of a number of interfaces (all starting with nsISVGRenderer*) to be implemented by an SVG rendering engine.

See nsISVGRenderer for more details.

The SVG rendering backend uses this interface to communicate to the rendering engine-native glyph metrics objects.

A glyph metrics object is instantiated by the backend for a given nsISVGGlyphMetricsSource object with a call to nsISVGRenderer::createGlyphMetrics(). The glyph metrics object is assumed to store a reference to its associated source object and provide metrics information about the (composite) glyph described by nsISVGGlyphMetricsSource::characterData, nsISVGGlyphMetricsSource::font, nsISVGGlyphMetricsSource::canvasTM, and other relevant style such as nsISVGGlyphMetricsSource::strokeWidth.

Definition at line 66 of file nsISVGRendererGlyphMetrics.idl.

Inheritance diagram for nsISVGRendererGlyphMetrics:
Collaboration diagram for nsISVGRendererGlyphMetrics:

Public Member Functions

nsIDOMSVGRect getExtentOfChar (in unsigned long charnum)
 Get the untransformed bounding box of an individual glyph.
float getAdvanceOfChar (in unsigned long charnum)
 Get the advance of an individual glyph.
float getBaselineOffset (in unsigned short baselineIdentifier)
 Retrieve the (y-axis) offset of the given baseline.
boolean update (in unsigned long updatemask)
 Called by this object's corresponding nsISVGGlyphMetricsSource as a notification that some of the source's data (identified by paramter 'updatemask') has changed.

Public Attributes

readonly attribute float advance
 Untransformed width of the composite glyph in pixels.
Baseline offset constants for getBaselineOffset()
const unsigned short BASELINE_ALPHABETIC = 0
const unsigned short BASELINE_HANGING = 1
const unsigned short BASELINE_IDEOGRAPHC = 2
const unsigned short BASELINE_MATHEMATICAL = 3
const unsigned short BASELINE_CENTRAL = 4
const unsigned short BASELINE_MIDDLE = 5
const unsigned short BASELINE_TEXT_BEFORE_EDGE = 6
const unsigned short BASELINE_TEXT_AFTER_EDGE = 7

Member Function Documentation

Get the advance of an individual glyph.

float nsISVGRendererGlyphMetrics::getBaselineOffset ( in unsigned short  baselineIdentifier)

Retrieve the (y-axis) offset of the given baseline.

Parameters:
baselineIdentifierOne of the BASELINE_* constants defined in this interface.
Returns:
Y-axis offset in pixels relative to top of bounding box.

Get the untransformed bounding box of an individual glyph.

Parameters:
charnumThe index of the character in nsISVGGlyphMetricsSource::characterData whose glyph bounding box is to be determined
Returns:
The untransformed bounding box in pixel coordinates

Called by this object's corresponding nsISVGGlyphMetricsSource as a notification that some of the source's data (identified by paramter 'updatemask') has changed.

Parameters:
updatemaskAn OR-ed combination of the UPDATEMASK_* constants defined in nsISVGGlyphMetricsSource.
Returns:
PR_TRUE if the metrics have changed as a result of the source update, PR_FALSE otherwise.

Member Data Documentation

Untransformed width of the composite glyph in pixels.

Definition at line 71 of file nsISVGRendererGlyphMetrics.idl.

interface nsISVGRendererPathBuilder

One of a number of interfaces (all starting with nsISVGRenderer*) to be implemented by an SVG rendering engine.

See nsISVGRenderer for more details.

This interface is used by an nsISVGRendererPathGeometry object in a call to nsISVGPathGeometrySource::constructPath() to obtain a native representation of the path described by nsISVGPathGeometrySource.

Definition at line 57 of file nsISVGRendererPathBuilder.idl.

Inheritance diagram for nsISVGRendererPathBuilder:
Collaboration diagram for nsISVGRendererPathBuilder:

Public Member Functions

void moveto (in float x, in float y)
 Move current position and start new sub-path.
void lineto (in float x, in float y)
 Draw a straight line from the current position to (x,y).
void curveto (in float x, in float y, in float x1, in float y1, in float x2, in float y2)
 Draw cubic Bezier curve from the current position to (x,y) using (x1,y1) as the control point at the beginning og the curve and (x2,y2) as the control point at the end of the curve.
void arcto (in float x, in float y, in float r1, in float r2, in float angle, in boolean largeArcFlag, in boolean sweepFlag)
 Draw an elliptical arc from the current position to (x,y).
void closePath (out float newX, out float newY)
 Close the current subpath.
void endPath ()
 End the path description.

Member Function Documentation

void nsISVGRendererPathBuilder::arcto ( in float  x,
in float  y,
in float  r1,
in float  r2,
in float  angle,
in boolean  largeArcFlag,
in boolean  sweepFlag 
)

Draw an elliptical arc from the current position to (x,y).

Advance current position to (x,y).

Parameters:
xX-coordinate of end point (untransformed).
yY-coordinate of end point (untransformed).
r1Radius of ellipse in X direction (untransformed).
r2Radius of ellipse in Y direction (untransformed).
angleRotation of ellipse as a whole (untransformed).
largeArcFlagPR_TRUE: choose the large arc (>=180 degrees), PR_FALSE: choose the smaller arc (<=180 degrees)
sweepFlagPR_TRUE: sweep in positive angle direction, PR_FALSE: sweep in negative angle direction
void nsISVGRendererPathBuilder::closePath ( out float  newX,
out float  newY 
)

Close the current subpath.

Move current position back to beginning of subpath.

Parameters:
newXX-coordinate of new current position (untransformed).
newYY-coordinate of new current position (untransformed).
void nsISVGRendererPathBuilder::curveto ( in float  x,
in float  y,
in float  x1,
in float  y1,
in float  x2,
in float  y2 
)

Draw cubic Bezier curve from the current position to (x,y) using (x1,y1) as the control point at the beginning og the curve and (x2,y2) as the control point at the end of the curve.

Advance current position to (x,y).

Parameters:
xX-coordinate of end point (untransformed).
yY-coordinate of end point (untransformed).
x1X-coordinate of first control point (untransformed).
y1Y-coordinate of first control point (untransformed).
x2X-coordinate of second control point (untransformed).
y2Y-coordinate of second control point (untransformed).

End the path description.

Guaranteed to be the last function called.

void nsISVGRendererPathBuilder::lineto ( in float  x,
in float  y 
)

Draw a straight line from the current position to (x,y).

Advance current position to (x,y).

Parameters:
xX-coordinate of end point (untransformed).
yY-coordinate of end point (untransformed).
void nsISVGRendererPathBuilder::moveto ( in float  x,
in float  y 
)

Move current position and start new sub-path.

Parameters:
xX-coordinate (untransformed).
yY-coordinate (untransformed).
interface nsISVGRendererPathGeometry

One of a number of interfaces (all starting with nsISVGRenderer*) to be implemented by an SVG rendering engine.

See nsISVGRenderer for more details.

The SVG rendering backend uses this interface to communicate to the rendering engine-native path objects.

A path geometry object is instantiated by the rendering backend for a given nsISVGPathGeometrySource object with a call to nsISVGRenderer::createPathGeometry(). The path geometry object is assumed to store a reference to its associated source object and provide rendering, hit-testing and metrics for the path described by the nsISVGPathGeometrySource members.

Definition at line 67 of file nsISVGRendererPathGeometry.idl.

Inheritance diagram for nsISVGRendererPathGeometry:
Collaboration diagram for nsISVGRendererPathGeometry:

Public Member Functions

void render (in nsISVGRendererCanvas canvas)
 Paint this object.
nsISVGRendererRegion update (in unsigned long updatemask)
 Called by this object's corresponding nsISVGPathGeometrySource as a notification that some of the source's data (identified by paramter 'updatemask') has changed.
nsISVGRendererRegion getCoveredRegion ()
 Get a region object describing the area covered with paint by this path geometry.
boolean containsPoint (in float x, in float y)
 Hit-testing method.
void flatten (out nsSVGPathData data)

Public Attributes

readonly attribute nsIDOMSVGRect boundingBox
 Bounding box (does not include stroke width)

Member Function Documentation

Hit-testing method.

Does this path geometry (with all relevant transformations applied) contain the point x,y? Mode of operation (e.g. whether to test fill or stroke) is determined by nsISVGPathGeometrySource::hittestMask.

Parameters:
xX-coordinate of test point.
yY-coordinate of test point.
Returns:
PR_TRUE if the path geometry contains the point, PR_FALSE otherwise.

Get a region object describing the area covered with paint by this path geometry.

Returns:
Covered region.

Paint this object.

Parameters:
canvasThe canvas to render to.

Called by this object's corresponding nsISVGPathGeometrySource as a notification that some of the source's data (identified by paramter 'updatemask') has changed.

Parameters:
updatemaskAn OR-ed combination of the UPDATEMASK_* constants defined in nsISVGPathGeometrySource.
Returns:
Region that needs to be redrawn.

Member Data Documentation

Bounding box (does not include stroke width)

Definition at line 111 of file nsISVGRendererPathGeometry.idl.

interface nsISVGRendererRegion

One of a number of interfaces (all starting with nsISVGRenderer*) to be implemented by an SVG rendering engine.

See nsISVGRenderer for more details.

This interface abstracts a rendering engine-native region object.

Definition at line 57 of file nsISVGRendererRegion.idl.

Inheritance diagram for nsISVGRendererRegion:
Collaboration diagram for nsISVGRendererRegion:

Public Member Functions

nsISVGRendererRegion combine (in nsISVGRendererRegion other)
 Return union of this region with another region.
void getRectangleScans (in nsISVGRectangleSink sink)
 Write a sequence of rectangles approximating this region to the sink object.

Member Function Documentation

Return union of this region with another region.

Parameters:
otherRegion to combine with.
Returns:
Union region.

Write a sequence of rectangles approximating this region to the sink object.

The approximation can be crude but should fully contain the actual region area.

Parameters:
sinkRectangle sink to write to.