Class anim.Sprite
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class anim.Sprite

java.lang.Object
   |
   +----anim.Sprite

public class Sprite
extends Object
An abstract class to define a sprite object.

Copyright (c) 1996-1997 Intel Corporation

See Also:
DynamicDataSprite, StaticDataSprite

CONSTRUCTOR INDEX

 O Sprite()

METHOD INDEX

 O adjustCurrentImageNumber(int)
Adjust a sprite object's current image number.
 O adjustPosition(Point3D)
Adjust a sprite object's position on its destination surface.
 O applyEffect(Effect)
Applies an effect to a sprite object.
 O effectCount()
Returns the number of effects currently applied to a Sprite.
 O effectElements()
Returns an enumeration of the effects currently applied to a sprite object.
 O getCurrentImageNumber()
Returns a sprite object's current image number.
 O getDestination()
Returns a Sprite's surface.
 O getInputView()
Gets a sprite object's view port on it's input data.
 O getOutputView()
Gets a sprite object's output view.
 O getPosition()
Returns a sprite object's position.
 O isVisible()
Checks if a sprite object is visible.
 O prepare()
Prepares a sprite object and its effects for drawing.
 O removeEffect(Effect)
Removes an effect from a sprite object.
 O setCurrentImageNumber(int)
Sets a sprite object's current image number.
 O setDestination(Surface)
Maps a Sprite to a surface.
 O setPosition(Point3D)
Sets a sprite object's position on its destination surface.
 O setVisibility(boolean)
Sets the visibility of the sprite to true (visible) or false (invisible)
 O toggleVisibility()
Toggles the visibility of a sprite object.
 O toString()
Returns the String representation of this Sprite's internal state.

CONSTRUCTORS

 O Sprite
  public Sprite()

METHODS

 O setVisibility
  public void setVisibility(boolean cond)
Sets the visibility of the sprite to true (visible) or false (invisible)
Parameters:
cond - If true, show the sprite object, else hide the sprite object.
See Also:
isVisible, toggleVisibility
 O toggleVisibility
  public void toggleVisibility()
Toggles the visibility of a sprite object.
See Also:
isVisible, setVisibility
 O isVisible
  public boolean isVisible()
Checks if a sprite object is visible. When a sprite object is created, it is initially visible.
Returns:
true if the object is visible; false otherwise.
See Also:
setVisibility, toggleVisibility
 O getOutputView
  public Rectangle getOutputView()
Gets a sprite object's output view. The output view is a rectangular area projected by the object onto its output. It is in the coordinate system of the parent surface.
Returns:
OutputView for the Sprite
See Also:
getInputView
 O getInputView
  public Rectangle getInputView()
Gets a sprite object's view port on it's input data. The view port is the rectangular sub-area of the input to display. InputView is on the coordinate system of the AnimImage
 O setDestination
  public void setDestination(Surface s)
Maps a Sprite to a surface.
Parameters:
s - The surface on which to map the Sprite.
See Also:
getDestination, setPosition
 O getDestination
  public Surface getDestination()
Returns a Sprite's surface.
Returns:
The surface that the Sprite is mapped to, null if none.
See Also:
setDestination
 O setPosition
  public boolean setPosition(Point3D p)
Sets a sprite object's position on its destination surface. This defines the location of the object on its surface. Where the location is a (2D) point on the (2D) surface and a depth. Valid ranges for the position are -2^31 to 2^31 for x and y and 0 to 2^16-1 for depth. Negative depth is not allowed. Depth of 0 is at the glass of the screen.
Parameters:
p - The new position of the object on the surface.
Returns:
false if Depth is negative. true otherwise
See Also:
adjustPosition, getPosition, setDestination, Surface
 O getPosition
  public Point3D getPosition()
Returns a sprite object's position. Position is on the coordinate system of the surface.
See Also:
setPosition, adjustPosition, setDestination, Surface
 O adjustPosition
  public boolean adjustPosition(Point3D deltaPoint)
Adjust a sprite object's position on its destination surface. This adjusts the (2D) location of the object on its surface and its depth. The current position is changed by adding the specified point values (which may be positive or negative). Valid ranges for the position are -2^31 to 2^31 for x and y and 0 to 2^16-1 for depth. Negative depth is not allowed. Depth of 0 is at the glass of the screen.
Parameters:
deltaPoint - contains the increment/decrement values for the position
Returns:
false if the adjustment makes the depth negative true otherwise
See Also:
setPosition, getPosition
 O setCurrentImageNumber
  public boolean setCurrentImageNumber(int index)
Sets a sprite object's current image number. Noteable cases include:
Parameters:
index - the sequence position (zero is first) for the new current image
Returns:
false if the index was invalid (e.g., out of bounds) and the object doesn't automatically adjust (e.g., clip or wrap the index). This could happen because the source for this object is a SingleImage and an image number greater than zero was requested or its an ImageSequence and an out of range image number was requested. a false value is also returned if the sprite does not currently have any data associated with it true otherwise
See Also:
getCurrentImageNumber, adjustCurrentImageNumber, SingleImage, ImageSequence, DynamicDataSprite, StaticDataSprite
 O getCurrentImageNumber
  public int getCurrentImageNumber()
Returns a sprite object's current image number. The default current image, defined when the object is created, is zero.
Returns:
s the sequence position (zero is first) of the current image
See Also:
setCurrentImageNumber, adjustCurrentImageNumber
 O adjustCurrentImageNumber
  public boolean adjustCurrentImageNumber(int deltaIndex)
Adjust a sprite object's current image number. The current image number is changed by adding the specified delta modulo the size of the set of images. That is, if the new image number overflows or underflows the image set, it wraps around to the other end of the set.
Parameters:
deltaIndex - specifies the increment/decrement value for the image number
Returns:
false if this adjustment causes the image number to be out of range as determined by the range in the source data object. a false value is also returned if the sprite does not currently have any data associated with it true otherwise
See Also:
setCurrentImageNumber, getCurrentImageNumber
 O applyEffect
  public boolean applyEffect(Effect e)
Applies an effect to a sprite object. You can apply multiple effects to a sprite object.

Usage Model

  1. Apply all the effects you want to use on an object.
  2. Call each effect's activate method to turn effects on and off as needed.
  3. When you no longer need an effect, remove it by calling removeEffect.

Parameters:
e - the effect to apply
Returns:
false if parameters for this effect are out of range or if the specified effect is already applied to a sprite. a false value is also returned if the sprite does not currently have any data associated with it true otherwise
See Also:
prepare, removeEffect, activate
 O prepare
  public boolean prepare()
Prepares a sprite object and its effects for drawing. This is a performance optimization call. calling this method causes all the effects applied to this sprite to be executed and a temporary off screen image that can be directly blitted at draw time is prepared.
Returns:
true if successful, false if failed.
 O removeEffect
  public boolean removeEffect(Effect e)
Removes an effect from a sprite object.
Parameters:
e - the effect to remove
Returns:
false if the supplied effect is not currently applied to this sprite object. a false value is also returned if the sprite does not currently have any data associated with it
See Also:
applyEffect
 O effectCount
  public int effectCount()
Returns the number of effects currently applied to a Sprite.
Returns:
number of effects applied to Sprite
 O effectElements
  public Enumeration effectElements()
Returns an enumeration of the effects currently applied to a sprite object. Use the Enumeration methods on the returned object to fetch the elements sequentially.
Returns:
enumeration of effects applied to Sprite
 O toString
  public String toString()
Returns the String representation of this Sprite's internal state.
Overrides:
toString in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index
Free Web Hosting