Package voltage.core

# Class VoltageImage

java.lang.Object
voltage.core.VoltageComponent
voltage.core.VoltageImage

public class VoltageImage extends VoltageComponent
Display images and animations

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static enum`
  `VoltageImage.AnimationMode`
  The mode to animate such as forward, backwards, etc

- ## Field Summary

  ### Fields inherited from class voltage.core.VoltageComponent

  `componentName, displayName`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `VoltageImage(String name, String displayName, VoltageModule module, boolean bIsAnimation)`
  Creates the Voltage Image object.
  `VoltageImage(String name, VoltageModule module, boolean bIsAnimation)`
  Creates the Voltage Image object.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `AddImageFromMemory(byte[] data)`
  Adds a new image to an animation from memory.
  `void`
  `AddNewImage(String resourceName)`
  Adds a new image to an animation.
  `void`
  `Animate(boolean bLoop)`
  Starts the animation This starts animating.
  `void`
  `Clear()`
  Clears any images from this control.
  `int`
  `GetCurrentFrame()`
  Gets the current frame
  `int`
  `GetNumberOfFrames()`
  Returns the number of frames.
  `void`
  `SetAnimateMode(VoltageImage.AnimationMode animMode)`
  Sets the mode of an animation
  `void`
  `SetAnimationSpeed(int milsPerFrame, boolean bReset)`
  Sets the animation speed.
  `void`
  `SetCurrentFrame(int curFrame)`
  Sets the current frame.
  `void`
  `SetCurrentImage(String resourceName)`
  Sets the image.
  `void`
  `StartAnimation(VoltageImage.AnimationMode animMode, boolean bLoopAnimation, int milsPerFrame, int startImage)`
  Start the animation and sets the options in one call.

  ### Methods inherited from class voltage.core.VoltageComponent

  `AddChildComponent, GetComponentID, GetDisplayName, GetHeight, GetMaxValue, GetMinValue, GetRect, GetSkin, GetTooltipText, GetTransparency, GetUserProperty, GetValue, GetWidth, GetX, GetY, IsEnabled, IsVisible, RemoveChildComponent, SetCanBeAutomated, SetEnabled, SetPosition, SetRect, SetRect, SetSize, SetSkin, SetTransparency, SetUnits, SetUserProperty, SetValue, SetValue, SetValueNoNotification, SetVisible, SetWantsMouseNotifications, SetZOrder, SkewNormalizedValue, UpdateGUIValue, WantsMouseNotifications`

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### VoltageImage

    public VoltageImage(String name, String displayName, VoltageModule module, boolean bIsAnimation)
    Creates the Voltage Image object.
    Parameters:
      `name` - the name of the control
      `displayName` - the display name of the control
      `module` - the module this belongs to
      `bIsAnimation` - set to true if this is an animation.

  - ### VoltageImage

    public VoltageImage(String name, VoltageModule module, boolean bIsAnimation)
    Creates the Voltage Image object.
    Parameters:
      `name` - the name of the control
      `module` - the module this belongs to
      `bIsAnimation` - set to true if this is an animation.

- ## Method Details

  - ### SetCurrentImage

    public void SetCurrentImage(String resourceName)
    Sets the image.
    Parameters:
      `resourceName` - the resource name of the image.

  - ### AddNewImage

    public void AddNewImage(String resourceName)
    Adds a new image to an animation. This will append the image to the last frame.
    Parameters:
      `resourceName` - the resource name of the image.

  - ### AddImageFromMemory

    public void AddImageFromMemory(byte[] data)
    Adds a new image to an animation from memory.
    Parameters:
      `data` - contents of an image file. (Note this is not pixels and represents a file like png, jpg, etc)

  - ### Clear

    public void Clear()
    Clears any images from this control.

  - ### GetNumberOfFrames

    public int GetNumberOfFrames()
    Returns the number of frames.
    Returns:
      the number of frames in this animation.

  - ### SetCurrentFrame

    public void SetCurrentFrame(int curFrame)
    Sets the current frame.
    Parameters:
      `curFrame` - the frame index to set.

  - ### GetCurrentFrame

    public int GetCurrentFrame()
    Gets the current frame
    Returns:
      the current frame index.

  - ### SetAnimationSpeed

    public void SetAnimationSpeed(int milsPerFrame, boolean bReset)
    Sets the animation speed.
    Parameters:
      `milsPerFrame` - the number of milliseconds per frame.
      `bReset` - if the animation is running, this will restart it at the new frame rate from the current frame.

  - ### Animate

    public void Animate(boolean bLoop)
    Starts the animation This starts animating.
    Parameters:
      `bLoop` - a flag to determine if it will loop.

  - ### SetAnimateMode

    public void SetAnimateMode(VoltageImage.AnimationMode animMode)
    Sets the mode of an animation
    Parameters:
      `animMode` - the animation mode.

  - ### StartAnimation

    public void StartAnimation(VoltageImage.AnimationMode animMode, boolean bLoopAnimation, int milsPerFrame, int startImage)
    Start the animation and sets the options in one call.
    Parameters:
      `animMode` - is the type of animation.
      `bLoopAnimation` - should the animation loop continuously?
      `milsPerFrame` - the number of milliseconds for each frame of the animation.
      `startImage` - the frame to start on.