cox.jmatt.java.MathTools.markup.svg
Class GradientTag

java.lang.Object
  extended by cox.jmatt.java.MathTools.markup.Tag
      extended by cox.jmatt.java.MathTools.markup.svg.StyleTag
          extended by cox.jmatt.java.MathTools.markup.svg.GradientTag

public class GradientTag
extends StyleTag

This class provides both <linearGradient> and <radialGradient> tags. Tag-speciic methods affect only tags of that type. Although this class does extend StyleTag, only the defaults and methods related to transforms should be used.


Nested Class Summary
 
Nested classes/interfaces inherited from class cox.jmatt.java.MathTools.markup.svg.StyleTag
StyleTag.TagKeys
 
Field Summary
 
Fields inherited from class cox.jmatt.java.MathTools.markup.Tag
myTagName
 
Constructor Summary
GradientTag()
          Standard constructor for a linear gradient.
 
Method Summary
protected  java.lang.String _content()
          Implemented to handle stops and other internal content.
protected  void _setContent(java.lang.String pContent)
          Implemented to receive copied content and reset() function.
 GradientTag addStop(double pOffset, java.lang.String pColor, java.lang.Double pOpacity)
          Add a <stop> element to the gradient.
 GradientTag copyOf()
          Create and return a copy of this gradient.
 GradientTag setAsRadial(boolean isRadial)
          By default gradient tags are linear.
 GradientTag setCircle(java.lang.Double pCX, java.lang.Double pCY, java.lang.Double pRad)
          Set the transition circle for a (radial) gradient that does not completely fill its designated area.
 GradientTag setFocus(java.lang.Double pFX, java.lang.Double pFY)
          Set the focal point of the (radial) gradient if it is not the center.
 GradientTag setSpreadMethod(char pValue)
          Determine how a 'shortened' gradient will spread outside its defined transition area.
 GradientTag setTransitionLine(java.lang.Double pX1, java.lang.Double pY1, java.lang.Double pX2, java.lang.Double pY2)
          Set the transition line for a linear gradient that doesn't completely fill its designated area.
 
Methods inherited from class cox.jmatt.java.MathTools.markup.svg.StyleTag
_configureTag, _enableCopy, canHaveDefs, isInDefs, setDefaultPen, setDefaultStyle, setDefaultTransform, setPen, setStyle, setTransform
 
Methods inherited from class cox.jmatt.java.MathTools.markup.Tag
_addAttribute, _addAttributes, _addNAttribute, _asBoolean, _asDouble, _asInt, _attributes, _clampNAttribute, _clampNAttribute, _fixKey, _setEnableXMLTag, badPizza, closeTag, configureTag, configureTagFromGlobalPizza, makeTag, openTag, reset, setID, toString, validString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GradientTag

public GradientTag()
Standard constructor for a linear gradient.

Method Detail

setAsRadial

public GradientTag setAsRadial(boolean isRadial)
By default gradient tags are linear. Use this method to change that.


_content

protected java.lang.String _content()
Implemented to handle stops and other internal content.

Overrides:
_content in class Tag

_setContent

protected void _setContent(java.lang.String pContent)
Implemented to receive copied content and reset() function.

Overrides:
_setContent in class Tag

copyOf

public final GradientTag copyOf()
Create and return a copy of this gradient. All data will be copied!


addStop

public GradientTag addStop(double pOffset,
                           java.lang.String pColor,
                           java.lang.Double pOpacity)
Add a <stop> element to the gradient. The offset automatically has a percent sign ('%') appended. The pColor argument is mandatory but 'pOpacity' is not.

Parameters:
pOffset - The (percent) value at which the color stop is to occur.
pColor - The color value at this stop.
pOpacity - The opacity value at this stop or null to omit. If present, it must be between 0.0 and 1.0.

setSpreadMethod

public GradientTag setSpreadMethod(char pValue)

Determine how a 'shortened' gradient will spread outside its defined transition area. Since there are only three values, the argument passed is char.

Uppercase will also work.


setTransitionLine

public GradientTag setTransitionLine(java.lang.Double pX1,
                                     java.lang.Double pY1,
                                     java.lang.Double pX2,
                                     java.lang.Double pY2)
Set the transition line for a linear gradient that doesn't completely fill its designated area. This method has NO EFFECT if called on a <radialGradient>. The transition line is from the point (pX1, pY1) to (pX2, pY2).


setCircle

public GradientTag setCircle(java.lang.Double pCX,
                             java.lang.Double pCY,
                             java.lang.Double pRad)
Set the transition circle for a (radial) gradient that does not completely fill its designated area. No effect on a <linearGradient>.

Parameters:
pCX - The X-coordinate of the center.
pCY - The Y-coordinate of the center.
pRad - The radius of the transition area.

setFocus

public GradientTag setFocus(java.lang.Double pFX,
                            java.lang.Double pFY)
Set the focal point of the (radial) gradient if it is not the center. The new focal point will be (pFX, pFY). No effect on a <linearGradient>.