Class RMGradientFill
- java.lang.Object
- 
- com.inductiveautomation.rm.base.RMListenerList
- 
- com.inductiveautomation.rm.base.RMObject
- 
- com.inductiveautomation.rm.graphics.RMFill
- 
- com.inductiveautomation.rm.graphics.RMGradientFill
 
 
 
 
- 
- All Implemented Interfaces:
- Archivable,- RMPropertyChanger,- java.lang.Cloneable
 - Direct Known Subclasses:
- RMRadialGradientFill
 
 public class RMGradientFill extends RMFill This class represents a fill that draws a linear gradient between an arbitrary list of colors.
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classRMGradientFill.ColorStopSimple static class to represent a stop (they're immutable).
 - 
Constructor SummaryConstructors Constructor Description RMGradientFill()Creates an uninitialized gradient fill.RMGradientFill(RMColor aColor1, RMColor aColor2, float aRotation)Creates a gradient fill from the given start color to the given end color with the given roll.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description RMGradientFillclone()Standard clone implementation.RMGradientFillderiveGradient(boolean isRadial)Returns a new gradient which is a copy of this gradient but of a different type.RMGradientFillderiveGradient(float aRoll)Returns a new gradient which is a copy of this gradient but with a different roll value.booleanequals(java.lang.Object anObj)Standard equals implementation.java.lang.ObjectfromXML(RXArchiver anArchiver, RXElement anElement)XML unarchival.RMColorgetColor()Returns the color associated with this fill.RMGradientFill.ColorStopgetColorStop(int anIndex)Returns the individual color stop at given index.intgetColorStopCount()Returns the number of color stops in the gradientjava.util.List<RMGradientFill.ColorStop>getColorStops()Returns the list of color stops.voidgetGradientAxis(RMRect aRect, java.awt.geom.Point2D p1, java.awt.geom.Point2D p2)Returns the 2 points, in the shape's coordinate system, which define the gradient.voidgetGradientAxis(RMShape aShape, RMPath aPath, java.awt.geom.Point2D p1, java.awt.geom.Point2D p2)Returns the 2 points, in the shape's coordinate system, which define the gradient.java.awt.geom.Rectangle2DgetGradientBounds(java.awt.Shape aShape)Returns the gradient bounds for a given shape which is the bounds required to encompass the entire shape in the coordinates of the gradient rotation (effectively the bounds of the shape rotated by opposite gradient rotation).java.awt.PaintgetPaint(float startx, float starty, float endx, float endy)Returns a java.awt.Paint instance to draw this gradient.floatgetRoll()Returns the gradient's rotation.RMColorgetStopColor(int index)Returns the color of the stop at the given index.floatgetStopPosition(int index)Returns the position (in the range {0-1}) for the given stop index.booleanhasAlpha()Returns true if any of the colors in the gradient have alphaintinsertColorStop(RMColor aColor, float position)Adds a new color stop at the given position.booleanisRadial()Returns whether gradient is radial.voidpaint(RMShapePainter aPntr, RMShape aShape)Render this fill in a shape painter.voidremoveColorStop(int index)Removes the stop at the given index.voidreverseColors()Reverse the order of the color stopsvoidsetColor(RMColor aColor)Sets color of first stop.voidsetColorStop(int index, RMColor aColor, float position)Sets the color & position of the stop at the given index.protected voidsetRoll(float aRoll)Sets the gradient's rotation.voidsetStops(java.util.List<RMGradientFill.ColorStop> newStops)Resets all the stops from the new list.java.lang.StringtoString()Standard to string implementation.RXElementtoXML(RXArchiver anArchiver)XML archival.- 
Methods inherited from class com.inductiveautomation.rm.graphics.RMFillderiveFill, getBounds, getName, readAttributes
 - 
Methods inherited from class com.inductiveautomation.rm.base.RMObjectaddPropertyChangeListener, animUpdate, firePropertyChange, firePropertyChange, firePropertyChange, getPCEvent, removePropertyChangeListener, sendPropertyChange
 - 
Methods inherited from class com.inductiveautomation.rm.base.RMListenerListaddListener, getListener, getListenerCount, getListenerCount, getListenerList, getListeners, hasListeners, removeListener
 
- 
 
- 
- 
- 
Method Detail- 
getColorStopCountpublic int getColorStopCount() Returns the number of color stops in the gradient
 - 
getColorStoppublic RMGradientFill.ColorStop getColorStop(int anIndex) Returns the individual color stop at given index.
 - 
getColorStopspublic java.util.List<RMGradientFill.ColorStop> getColorStops() Returns the list of color stops.
 - 
setColorStoppublic void setColorStop(int index, RMColor aColor, float position)Sets the color & position of the stop at the given index.
 - 
removeColorStoppublic void removeColorStop(int index) Removes the stop at the given index.
 - 
setStopspublic void setStops(java.util.List<RMGradientFill.ColorStop> newStops) Resets all the stops from the new list.
 - 
insertColorStoppublic int insertColorStop(RMColor aColor, float position) Adds a new color stop at the given position. Returns the index of the new stop.
 - 
reverseColorspublic void reverseColors() Reverse the order of the color stops
 - 
getRollpublic float getRoll() Returns the gradient's rotation.
 - 
setRollprotected void setRoll(float aRoll) Sets the gradient's rotation.
 - 
isRadialpublic boolean isRadial() Returns whether gradient is radial.
 - 
deriveGradientpublic RMGradientFill deriveGradient(float aRoll) Returns a new gradient which is a copy of this gradient but with a different roll value.
 - 
deriveGradientpublic RMGradientFill deriveGradient(boolean isRadial) Returns a new gradient which is a copy of this gradient but of a different type.
 - 
getGradientBoundspublic java.awt.geom.Rectangle2D getGradientBounds(java.awt.Shape aShape) Returns the gradient bounds for a given shape which is the bounds required to encompass the entire shape in the coordinates of the gradient rotation (effectively the bounds of the shape rotated by opposite gradient rotation). The gradient should be defined in these bounds so that rendered shapes completely utilizes the color range.
 - 
getGradientAxispublic void getGradientAxis(RMShape aShape, RMPath aPath, java.awt.geom.Point2D p1, java.awt.geom.Point2D p2) Returns the 2 points, in the shape's coordinate system, which define the gradient.
 - 
getGradientAxispublic void getGradientAxis(RMRect aRect, java.awt.geom.Point2D p1, java.awt.geom.Point2D p2) Returns the 2 points, in the shape's coordinate system, which define the gradient.
 - 
getColorpublic RMColor getColor() Returns the color associated with this fill.
 - 
setColorpublic void setColor(RMColor aColor) Sets color of first stop.
 - 
getStopColorpublic RMColor getStopColor(int index) Returns the color of the stop at the given index.
 - 
getStopPositionpublic float getStopPosition(int index) Returns the position (in the range {0-1}) for the given stop index.
 - 
hasAlphapublic boolean hasAlpha() Returns true if any of the colors in the gradient have alpha
 - 
getPaintpublic java.awt.Paint getPaint(float startx, float starty, float endx, float endy)Returns a java.awt.Paint instance to draw this gradient.
 - 
paintpublic void paint(RMShapePainter aPntr, RMShape aShape) Render this fill in a shape painter.
 - 
equalspublic boolean equals(java.lang.Object anObj) Standard equals implementation.
 - 
clonepublic RMGradientFill clone() Standard clone implementation.
 - 
toXMLpublic RXElement toXML(RXArchiver anArchiver) XML archival.- Specified by:
- toXMLin interface- Archivable
- Overrides:
- toXMLin class- RMFill
 
 - 
fromXMLpublic java.lang.Object fromXML(RXArchiver anArchiver, RXElement anElement) XML unarchival.- Specified by:
- fromXMLin interface- Archivable
- Overrides:
- fromXMLin class- RMFill
 
 
- 
 
-