com.sencha.gxt.chart.client.draw.sprite
Class Sprite

java.lang.Object
  extended by com.sencha.gxt.chart.client.draw.sprite.Sprite
Direct Known Subclasses:
CircleSprite, EllipseSprite, ImageSprite, PathSprite, RectangleSprite, TextSprite

public abstract class Sprite
extends Object

A sprite is an object rendered in a Surface. There are different options and types of sprites.


Constructor Summary
Sprite()
          Creates a sprite and generates its id.
Sprite(Sprite sprite)
          Creates a copy of the given sprite.
 
Method Summary
 void clearDirtyFlags()
          Clears all of the dirty flags on the sprite.
abstract  Sprite copy()
          Returns a copy of the sprite.
 PreciseRectangle getBBox()
          Returns the bounding box of the sprite.
 PreciseRectangle getClipRectangle()
          Returns the PreciseRectangle that represents the clipping element.
 DrawComponent getComponent()
          Returns the draw component that the sprite is attached.
 Color getFill()
          Returns the Color of the sprite's fill.
 double getFillOpacity()
          Returns the opacity of the sprite's fill.
 double getOpacity()
          Returns the opacity of the sprite.
abstract  PathSprite getPathSprite()
          Returns the Sprite as a path.
 Rotation getRotation()
          Returns the Rotation of the sprite.
 Scaling getScaling()
          Returns the Scaling of the sprite.
 Color getStroke()
          Returns the Color of the stroke.
 double getStrokeOpacity()
          Returns the opacity of the stroke.
 double getStrokeWidth()
          Returns the stroke width.
 Surface getSurface()
          Returns the sprite's surface.
 Translation getTranslation()
          Returns the Translation of the sprite.
 int getzIndex()
          Returns the z-index of the sprite.
 boolean isClipRectangleDirty()
          Returns true if the clip rectangle changed since the last render.
 boolean isDirty()
          Returns true if the sprite changed since the last render.
 boolean isFillDirty()
          Returns true if the fill changed since the last render.
 boolean isFillOpacityDirty()
          Returns true if the fill opacity changed since the last render.
 boolean isHidden()
          Returns true if the sprite is hidden.
 boolean isHiddenDirty()
          Returns true if the sprite's hidden value is dirty.
 boolean isOpacityDirty()
          Returns true if the opacity changed since the last render.
 boolean isStrokeDirty()
          Returns true if the stroke changed since the last render.
 boolean isStrokeOpacityDirty()
          Returns true if the stroke opacity changed since the last render.
 boolean isStrokeWidthDirty()
          Returns true if the stroke width changed since the last render.
 boolean isTransformDirty()
          Returns true if one of the sprite's transform values is dirty.
 boolean isZIndexDirty()
          Returns true if the sprite's z-index value is dirty.
 void redraw()
          Renders the sprite to its surface.
 void remove()
          Removes the sprite from its surface.
 void setClipRectangle(PreciseRectangle clipRectangle)
          Sets the PreciseRectangle that represents the clipping element.
 void setComponent(DrawComponent component)
          Sets the draw component that the sprite is attached.
 void setCursor(String property)
          Sets the cursor property of the sprite.
 void setFill(Color fill)
          Sets the Color of the sprite's fill.
 void setFillOpacity(double fillOpacity)
          Sets the opacity of the sprite's fill.
 void setHidden(boolean hidden)
          Sets true if the sprite is hidden.
 void setOpacity(double opacity)
          Sets the opacity of the sprite.
 void setRotation(double degrees)
          Sets the Rotation of the sprite using the given angle.
 void setRotation(double x, double y, double degrees)
          Sets the Rotation of the sprite using the given coordinates and angle.
 void setRotation(Rotation rotation)
          Sets the Rotation of the sprite.
 void setScaling(double scale)
          Sets the Scaling using the given scale value.
 void setScaling(double x, double y, double centerX, double centerY)
          Sets the Scaling using the given x and y scale and the given origin.
 void setScaling(Scaling scaling)
          Sets the Scaling of the sprite.
 void setStroke(Color stroke)
          Sets the Color of the stroke.
 void setStrokeOpacity(double strokeOpacity)
          Sets the opacity of the stroke.
 void setStrokeWidth(double strokeWidth)
          Sets the stroke width.
 void setSurface(Surface surface)
          Sets the sprite's surface.
 void setTranslation(double x, double y)
          Sets the Translation of the sprite using the given x and y.
 void setTranslation(Translation translation)
          Sets the Translation of the sprite.
 void setZIndex(int zIndex)
          Sets the z-index of the sprite.
 Matrix transformMatrix()
          Returns and caches the calculated transformation matrix.
 void update(Sprite sprite)
          Updates the attributes of the sprite using the given sprite.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Sprite

public Sprite()
Creates a sprite and generates its id.


Sprite

public Sprite(Sprite sprite)
Creates a copy of the given sprite.

Parameters:
sprite - the sprite to be copied
Method Detail

clearDirtyFlags

public void clearDirtyFlags()
Clears all of the dirty flags on the sprite.


copy

public abstract Sprite copy()
Returns a copy of the sprite.

Returns:
copy of the sprite

getBBox

public PreciseRectangle getBBox()
Returns the bounding box of the sprite.

Returns:
the bounding box of the sprite

getClipRectangle

public PreciseRectangle getClipRectangle()
Returns the PreciseRectangle that represents the clipping element.

Returns:
the rectangle that represents the clipping element

getComponent

public DrawComponent getComponent()
Returns the draw component that the sprite is attached.

Returns:
the draw component that the sprite is attached

getFill

public Color getFill()
Returns the Color of the sprite's fill.

Returns:
the color of the sprite's fill

getFillOpacity

public double getFillOpacity()
Returns the opacity of the sprite's fill.

Returns:
the opacity of the sprite's fill

getOpacity

public double getOpacity()
Returns the opacity of the sprite.

Returns:
the opacity of the sprite

getPathSprite

public abstract PathSprite getPathSprite()
Returns the Sprite as a path.

Returns:
the sprite as a path

getRotation

public Rotation getRotation()
Returns the Rotation of the sprite.

Returns:
the rotation of the sprite

getScaling

public Scaling getScaling()
Returns the Scaling of the sprite.

Returns:
the scaling of the sprite

getStroke

public Color getStroke()
Returns the Color of the stroke.

Returns:
the color of the stroke

getStrokeOpacity

public double getStrokeOpacity()
Returns the opacity of the stroke.

Returns:
the opacity of the stroke

getStrokeWidth

public double getStrokeWidth()
Returns the stroke width.

Returns:
the stroke width

getSurface

public Surface getSurface()
Returns the sprite's surface.

Returns:
the sprite's surface

getTranslation

public Translation getTranslation()
Returns the Translation of the sprite.

Returns:
the translation of the sprite

getzIndex

public int getzIndex()
Returns the z-index of the sprite. Determines the order of drawing sprites to the surface.

Returns:
the z-index of the sprite

isClipRectangleDirty

public boolean isClipRectangleDirty()
Returns true if the clip rectangle changed since the last render.

Returns:
true if the clip rectangle changed since the last render

isDirty

public boolean isDirty()
Returns true if the sprite changed since the last render.

Returns:
true if the sprite changed since the last render

isFillDirty

public boolean isFillDirty()
Returns true if the fill changed since the last render.

Returns:
true if the fill changed since the last render

isFillOpacityDirty

public boolean isFillOpacityDirty()
Returns true if the fill opacity changed since the last render.

Returns:
true if the fill opacity changed since the last render

isHidden

public boolean isHidden()
Returns true if the sprite is hidden.

Returns:
true if the sprite is hidden

isHiddenDirty

public boolean isHiddenDirty()
Returns true if the sprite's hidden value is dirty. A value is dirty if it has been changed since the previous rendering of the sprite.

Returns:
true if the sprite's hidden value is dirty

isOpacityDirty

public boolean isOpacityDirty()
Returns true if the opacity changed since the last render.

Returns:
true if the opacity changed since the last render

isStrokeDirty

public boolean isStrokeDirty()
Returns true if the stroke changed since the last render.

Returns:
true if the stroke changed since the last render

isStrokeOpacityDirty

public boolean isStrokeOpacityDirty()
Returns true if the stroke opacity changed since the last render.

Returns:
true if the stroke opacity changed since the last render

isStrokeWidthDirty

public boolean isStrokeWidthDirty()
Returns true if the stroke width changed since the last render.

Returns:
true if the stroke widht changed since the last render

isTransformDirty

public boolean isTransformDirty()
Returns true if one of the sprite's transform values is dirty. A value is dirty if it has been changed since the previous rendering of the sprite.

Returns:
true if one of the sprite's transform values is dirty

isZIndexDirty

public boolean isZIndexDirty()
Returns true if the sprite's z-index value is dirty. A value is dirty if it has been changed since the previous rendering of the sprite.

Returns:
true if the sprite's z-index value is dirty

redraw

public void redraw()
Renders the sprite to its surface.


remove

public void remove()
Removes the sprite from its surface.


setClipRectangle

public void setClipRectangle(PreciseRectangle clipRectangle)
Sets the PreciseRectangle that represents the clipping element.

Parameters:
clipRectangle - the rectangle that represents the clipping element

setComponent

public void setComponent(DrawComponent component)
Sets the draw component that the sprite is attached.

Parameters:
component - the draw component that the sprite is attached

setCursor

public void setCursor(String property)
Sets the cursor property of the sprite.

Parameters:
property - cursor property

setFill

public void setFill(Color fill)
Sets the Color of the sprite's fill.

Parameters:
fill - the color of the sprite's fill

setFillOpacity

public void setFillOpacity(double fillOpacity)
Sets the opacity of the sprite's fill.

Parameters:
fillOpacity - the opacity of the sprite's fill

setHidden

public void setHidden(boolean hidden)
Sets true if the sprite is hidden.

Parameters:
hidden - true if the sprite is hidden

setOpacity

public void setOpacity(double opacity)
Sets the opacity of the sprite.

Parameters:
opacity - the opacity of the sprite

setRotation

public void setRotation(double degrees)
Sets the Rotation of the sprite using the given angle.

Parameters:
degrees - the angle of rotation

setRotation

public void setRotation(double x,
                        double y,
                        double degrees)
Sets the Rotation of the sprite using the given coordinates and angle.

Parameters:
x - the x-coordinate of rotation
y - the y-coordinate of rotation
degrees - the angle of rotation

setRotation

public void setRotation(Rotation rotation)
Sets the Rotation of the sprite.

Parameters:
rotation - the rotation of the sprite

setScaling

public void setScaling(double scale)
Sets the Scaling using the given scale value.

Parameters:
scale - the scale value

setScaling

public void setScaling(double x,
                       double y,
                       double centerX,
                       double centerY)
Sets the Scaling using the given x and y scale and the given origin.

Parameters:
x - the scale on the x axis
y - the scale on the y axis
centerX - x-coordinate of the origin
centerY - y-coordinate of the origin

setScaling

public void setScaling(Scaling scaling)
Sets the Scaling of the sprite.

Parameters:
scaling - the scaling of the sprite

setStroke

public void setStroke(Color stroke)
Sets the Color of the stroke.

Parameters:
stroke - the color of the stroke

setStrokeOpacity

public void setStrokeOpacity(double strokeOpacity)
Sets the opacity of the stroke.

Parameters:
strokeOpacity - the opacity of the stroke

setStrokeWidth

public void setStrokeWidth(double strokeWidth)
Sets the stroke width.

Parameters:
strokeWidth - the stroke width

setSurface

public void setSurface(Surface surface)
Sets the sprite's surface.

Parameters:
surface - the sprite's surface

setTranslation

public void setTranslation(double x,
                           double y)
Sets the Translation of the sprite using the given x and y.

Parameters:
x - the translation on the x-axis
y - the translation on the y-axis

setTranslation

public void setTranslation(Translation translation)
Sets the Translation of the sprite.

Parameters:
translation - the translation of the sprite

setZIndex

public void setZIndex(int zIndex)
Sets the z-index of the sprite.

Parameters:
zIndex - the z-index of the sprite

transformMatrix

public Matrix transformMatrix()
Returns and caches the calculated transformation matrix.

Returns:
the calculated transformation matrix

update

public void update(Sprite sprite)
Updates the attributes of the sprite using the given sprite.

Parameters:
sprite - the sprite attributes to use


Copyright © 2011. All Rights Reserved.