Home

# Class goog.graphics.SvgGraphics

A Graphics implementation for drawing using SVG.

extends goog.graphics.AbstractGraphics

Instance Method Summary
| `addDef(string defKey, ?Element defElement) ⇒ string` Adds a defintion of an element to the global definitions.
| `append_(?goog.graphics.Element element, ?goog.graphics.SvgGroupElement= opt_group)` Appends an element.
| `clear()` Remove all drawing elements from the graphics.
| `createDom()` Creates the DOM representation of the graphics area.
| `createGroup(?goog.graphics.SvgGroupElement= opt_group) ⇒ ?goog.graphics.GroupElement` Create an empty group of drawing elements.
| `createSvgElement_(string tagName, ?Object= opt_attributes) ⇒ ?Element` Creates an SVG element. Used internally and by different SVG classes.
| `disposeInternal()` Disposes of the component by removing event handlers, detacing DOM nodes from the document body, and removing references to them.
| `drawEllipse(number cx, number cy, number rx, number ry, ?goog.graphics.Stroke stroke, ?goog.graphics.Fill fill, ?goog.graphics.SvgGroupElement= opt_group) ⇒ ?goog.graphics.EllipseElement` Draw an ellipse.
| `drawImage(number x, number y, number width, number height, string src, ?goog.graphics.SvgGroupElement= opt_group) ⇒ ?goog.graphics.ImageElement` Draw an image.
| `drawPath(?goog.graphics.Path path, ?goog.graphics.Stroke stroke, ?goog.graphics.Fill fill, ?goog.graphics.SvgGroupElement= opt_group) ⇒ ?goog.graphics.PathElement` Draw a path.
| `drawRect(number x, number y, number width, number height, ?goog.graphics.Stroke stroke, ?goog.graphics.Fill fill, ?goog.graphics.SvgGroupElement= opt_group) ⇒ ?goog.graphics.RectElement` Draw a rectangle.
| `drawTextOnLine(string text, number x1, number y1, number x2, number y2, string align, ?goog.graphics.Font font, ?goog.graphics.Stroke stroke, ?goog.graphics.Fill fill, ?goog.graphics.SvgGroupElement= opt_group) ⇒ ?goog.graphics.TextElement` Draw a text string vertically centered on a given line.
| `enterDocument()` Called when the component's element is known to be in the document. Anything using document.getElementById etc. should be done at this stage. If the component contains child components, this call is propagated to its children.
| `exitDocument()` Called by dispose to clean up the elements and listeners created by a component, or by a parent component/application who has removed the component from the document but wants to reuse it later. If the component contains child components, this call is propagated to its children. It should be possible for the component to be rendered again once this method has been called.
| `getDef(string defKey) ⇒ ?string` Returns the id of a definition element.
| `getPixelSize() ⇒ ?goog.math.Size`
| `getTextWidth(string text, ?goog.graphics.Font font)` Measure and return the width (in pixels) of a given text string. Text measurement is needed to make sure a text can fit in the allocated area. The way text length is measured is by writing it into a div that is after the visible area, measure the div width, and immediatly erase the written value.
| `getViewBox_() ⇒ string`
| `isDomClonable() ⇒ boolean`
| `removeDef(string defKey)` Removes a definition of an elemnt from the global definitions.
| `setCoordOrigin(number left, number top)` Changes the coordinate system position.
| `setCoordSize(number coordWidth, number coordHeight)` Changes the coordinate size.
| `setElementAttributes(?Element element, ?Object attributes)` Sets properties to an SVG element. Used internally and by different SVG elements.
| `setElementFill(?goog.graphics.StrokeAndFillElement element, ?goog.graphics.Fill fill)` Sets the fill of the given element.
| `setElementStroke(?goog.graphics.StrokeAndFillElement element, ?goog.graphics.Stroke stroke)` Sets the stroke of the given element.
| `setElementTransform(?goog.graphics.Element element, number x, number y, number angle, number centerX, number centerY)` Set the transformation of an element.
| `setSize(number pixelWidth, number pixelHeight)` Change the size of the canvas.
| `setViewBox_()` Sets up the view box.
| `updateManualViewBox_()` Updates the transform of the root element to fake a viewBox. Should only be called when useManualViewbox_ is set.

Static Method Summary
| `getResizeCheckTimer_() ⇒ ?goog.Timer`
| `getSvgPath(?goog.graphics.Path path) ⇒ string` Returns a string representation of a logical path suitable for use in an SVG element.