Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## quicktime.app.anim
Class Compositor

    java.lang.Object
      |
      +--quicktime.app.spaces.SimpleSpace
            |
            +--quicktime.app.anim.SWCompositor
                  |
                  +--quicktime.app.anim.Compositor

All Implemented Interfaces:
  Collection, Compositable, Drawable, DrawingNotifier, DynamicCollection, DynamicImage, ImageSpec, Listener, QTDisplaySpace, QTDrawable, Space, Ticklish, Transformable

public class Compositor
extends SWCompositor

The Compositor uses the SpriteWorld compositing services of the SWCompositor to composit an image out of its member objects. The member object of a Compositor is required to at least implement the ImageSpec interface. In which case the Compositor will create the TwoDSprite that presents that image data in its display space. If a TwoDSprite itself is added to the Compositor it is added directly as a member (as TwoDSprite implements the ImageSpec interface.

Field Summary
`protected java.util.Hashtable` | `membersTable` Dual hashtables are kept for both members and sprites as this improves the runtime performance of Compositors (particularly with large numbers of sprites).
`protected java.util.Hashtable` | `spritesTable` Dual hashtables are kept for both members and sprites as this improves the runtime performance of Compositors (particularly with large numbers of sprites).

Fields inherited from class quicktime.app.anim.SWCompositor
`hitTestFlag, taskFlag`

Fields inherited from class quicktime.app.spaces.SimpleSpace
`containedSpaces, controllersVec, ticklers, timer`

Fields inherited from interface quicktime.app.time.Ticklish
`kScale`

Constructor Summary
`` | `Compositor(QDGraphics spriteGWorld, QDColor backgroundColor)` This constructor creates a Compositor with a background color.
`` | `Compositor(QDGraphics spriteGWorld, QDColor backgroundColor, int scale, int period)` This constructor creates a Compositor with a background color.
`` | `Compositor(QDGraphics spriteGWorld, QDColor backgroundColor, QDGraphics background)` This constructor creates a Compositor with a background picutre as drawn in the supplied QDGraphics background parameter.
`` | `Compositor(QDGraphics spriteGWorld, QDColor backgroundColor, QDGraphics background, int scale, int period)` This constructor creates a Compositor with a background picutre as drawn in the supplied QDGraphics background parameter.
`protected` | `Compositor(QDGraphics spriteGWorld, QDColor backgroundColor, QDGraphics background, int scale, int period, Protocol defaultProtocol)` Used by subclasses to construct a Compositor.

Method Summary
`boolean` | `addMember(java.lang.Object member)` Adds a member to the Compositor.
`boolean` | `addMember(java.lang.Object member, int layer)` Adds a member to the Compositor.
`boolean` | `addMember(java.lang.Object member, int layer, boolean initiallyVisible)` Adds a member to the Compositor.
`int` | `getBackLayer()` Returns the backmost layer of all of the TwoDSprite presenters of the Compositor.
`int` | `getFrontLayer()` Returns the frontmost layer of all of the TwoDSprite presenters of the Compositor.
`TwoDSprite` | `getMemberSprite(java.lang.Object member)` This method returns the TwoDSprite presenter that is presenting the image data of the given member.
`java.lang.Object` | `getSpriteMember(TwoDSprite sprite)` This method returns the member that is being presented by the supplied TwoDSprite presenter.
`boolean` | `isEmpty()` Returns true if there are no members of the Compositor.
`java.util.Enumeration` | `members()` Return an enumeration to enumerate over all of the members that have been added to the Compositor.
`void` | `removeMember(java.lang.Object member)` Remove a sprite from the Compositor and remove it visually.
`int` | `size()` Returns the number of members of the collection.
`java.util.Enumeration` | `sprites()` This returns an Enumeration that allows your application to iterate over the TwoDSprite presenters that are responsible for presenting the image data within the Compositor.

Methods inherited from class quicktime.app.anim.SWCompositor
`addDrawingListener, addedToCompositor, createMembers, getClip, getCompositable, getDescription, getDisplayBounds, getGraphicsMode, getGWorld, getImage, getInitialSize, getInvalidatorList, getLayerable, getMatrix, getMemberInvalidator, getOriginalSize, getParent, getStatistics, getTransformable, hasRecordMovie, hitTest, idle, isAutoRedrawing, postProcessAdd, postProcessRemove, redraw, removedFromCompositor, removeDrawingListener, resetStatistics, saveMembers, setAutoRedrawing, setClip, setDisplayBounds, setGraphicsMode, setGWorld, setLocation, setMatrix, setRecordMovie, tickle, toString`

Methods inherited from class quicktime.app.spaces.SimpleSpace
`addController, addedTo, controllers, finalize, getProtocol, getSource, getTimer, hasMember, isAppropriate, memberAdded, memberRemoved, removeAllControllers, removeAllMembers, removeController, removedFrom, tickleList, timeChanged`

Methods inherited from class java.lang.Object
`clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Methods inherited from interface quicktime.app.spaces.Listener
`addedTo, removedFrom`

Methods inherited from interface quicktime.app.spaces.Space
`addController, controllers, getSource, getTimer, removeController, tickleList`

Methods inherited from interface quicktime.app.spaces.DynamicCollection
`getProtocol`

Methods inherited from interface quicktime.app.spaces.Collection
`hasMember, isAppropriate`

Methods inherited from interface quicktime.app.time.Ticklish
`timeChanged`

Field Detail

### membersTable

    protected java.util.Hashtable membersTable

  Dual hashtables are kept for both members and sprites as this improves the runtime performance of Compositors (particularly with large numbers of sprites). This is the container that is used to store the members of a Compositor. The member as added is stored as the key of the hash table. The member's TwoDSprite presenter is stored as the value corresponding to that key. If the member is itself a TwoDSprite it is stored as both key and value.

### spritesTable

    protected java.util.Hashtable spritesTable

  Dual hashtables are kept for both members and sprites as this improves the runtime performance of Compositors (particularly with large numbers of sprites). This is the container that is used to store the TwoDSprites of a Compositor. The member as added is stored as the value of the hash table. The member's TwoDSprite presenter is stored as the key of that value. If the member is itself a TwoDSprite it is stored as both key and value.

Constructor Detail

### Compositor

    public Compositor(QDGraphics spriteGWorld,
                      QDColor backgroundColor)
               throws QTException

  This constructor creates a Compositor with a background color. It has a default scale of 10 fps at a rate of 1.
  Parameters:
    `spriteGWorld` - Specifies the sprites offscreen QDGraphics. The size of this QDGraphics determines the corresponding display size when the SpriteWorld is added to its display surface.
    `backgroundColor` - Specifies the background color.

### Compositor

    public Compositor(QDGraphics spriteGWorld,
                      QDColor backgroundColor,
                      QDGraphics background)
               throws QTException

  This constructor creates a Compositor with a background picutre as drawn in the supplied QDGraphics background parameter. It has a default scale of 10 fps at a rate of 1.
  Parameters:
    `spriteGWorld` - Specifies the sprites offscreen QDGraphics. The size of this QDGraphics determines the corresponding display size when the SpriteWorld is added to its display surface.
    `backgroundColor` - Specifies the background color.
    `background` - Specifies the background QDGraphics to be used to composit background sprites into. This will give better performance if the sprites in front of the background are changing.

### Compositor

    public Compositor(QDGraphics spriteGWorld,
                      QDColor backgroundColor,
                      int scale,
                      int period)
               throws QTException

  This constructor creates a Compositor with a background color.
  Parameters:
    `spriteGWorld` - Specifies the sprites offscreen QDGraphics. The size of this QDGraphics determines the corresponding display size when the SpriteWorld is added to its display surface.
    `backgroundColor` - Specifies the background color.
    `scale` - the amount with which a second is divided into at a rate of one
    `period` - the number of scale ticks that elapse between invocations of the action.

### Compositor

    public Compositor(QDGraphics spriteGWorld,
                      QDColor backgroundColor,
                      QDGraphics background,
                      int scale,
                      int period)
               throws QTException

  This constructor creates a Compositor with a background picutre as drawn in the supplied QDGraphics background parameter.
  Parameters:
    `spriteGWorld` - Specifies the sprites offscreen QDGraphics. The size of this QDGraphics determines the corresponding display size when the SpriteWorld is added to its display surface.
    `backgroundColor` - Specifies the background color.
    `background` - Specifies the background QDGraphics to be used to composit background sprites into. This will give better performance if the sprites in front of the background are changing.
    `scale` - the amount with which a second is divided into at a rate of one
    `period` - the number of scale ticks that elapse between invocations of the action.

### Compositor

    protected Compositor(QDGraphics spriteGWorld,
                         QDColor backgroundColor,
                         QDGraphics background,
                         int scale,
                         int period,
                         Protocol defaultProtocol)
                  throws QTException

  Used by subclasses to construct a Compositor. The subclass must specify a background or a backgroundColor but not both.
  Parameters:
    `spriteGWorld` - this the buffer which the internal SpriteWorld uses to composit its image into.
    `background` - Specifies the background QDGraphics to be used to composit background sprites into. This will give better performance if the sprites in front of the background are changing.
    `backgroundColor` - this is background color that can be supplied to the SpriteWorld
    `scale` - the initial scale of the Space's timer
    `period` - the initial period of the Space's timer
    `defaultProtocol` - the minimal Protocol that members of the SWCompositor must meet

Method Detail

### members

    public java.util.Enumeration members()

  Return an enumeration to enumerate over all of the members that have been added to the Compositor.
  Returns:
    an Enumeration

### sprites

    public java.util.Enumeration sprites()

  This returns an Enumeration that allows your application to iterate over the TwoDSprite presenters that are responsible for presenting the image data within the Compositor.
  Overrides:
    `sprites` in class `SWCompositor`
  Returns:
    an Enumeration;

### isEmpty

    public boolean isEmpty()

  Returns true if there are no members of the Compositor.
  Returns:
    a boolean

### getMemberSprite

    public TwoDSprite getMemberSprite(java.lang.Object member)

  This method returns the TwoDSprite presenter that is presenting the image data of the given member. It returns null if the object is not a member.
  Overrides:
    `getMemberSprite` in class `SWCompositor`
  Parameters:
    `member` - the member object
  Returns:
    the member's TwoDSprite presenter

### getSpriteMember

    public java.lang.Object getSpriteMember(TwoDSprite sprite)

  This method returns the member that is being presented by the supplied TwoDSprite presenter. It returns null if the TwoDSprite is not present in the Compositor.
  Overrides:
    `getSpriteMember` in class `SWCompositor`
  Parameters:
    `sprite` - the TwoDSprite presenter
  Returns:
    the member that is being presented by the supplied TwoDSprite presenter

### addMember

    public boolean addMember(java.lang.Object member)
                      throws QTException

  Adds a member to the Compositor. The member must be some kind of ImageSpec object. If the member implements the Layerable interface it will get the layer and assign the layer appropriately. If the member is an instanceof the TwoDSprite class, then it will use the visibility state of that class. Otherwise, the member will be added with default settings of visiblity set to true and a layer of 1.
  Overrides:
    `addMember` in class `SimpleSpace`
  Parameters:
    `member` - the object to add.
  Returns:
    true if the object is appropriate for this collection

### addMember

    public boolean addMember(java.lang.Object member,
                             int layer)
                      throws QTException

  Adds a member to the Compositor. The member must be some kind of ImageSpec object. If the member is an instanceof the TwoDSprite class, then it will use the visibility state of that class. The member will be added with default settings of visiblity set to true.
  Parameters:
    `member` - the object to add.
    `layer` - the layer within the Compositor that the member will be presented at.
  Returns:
    true if the object is appropriate for this collection

### addMember

    public boolean addMember(java.lang.Object member,
                             int layer,
                             boolean initiallyVisible)
                      throws QTException

  Adds a member to the Compositor. The member must be some kind of ImageSpec object.
  Parameters:
    `member` - the object to add.
    `layer` - the layer within the Compositor that the member will be presented at.
    `initiallyVisible` - if true the member is intially visible.
  Returns:
    true if the object is appropriate for this collection

### size

    public int size()

  Returns the number of members of the collection.
  Returns:
    an int

### getFrontLayer

    public int getFrontLayer()
                      throws QTException

  Returns the frontmost layer of all of the TwoDSprite presenters of the Compositor.
  Returns:
    the frontmost layer

### getBackLayer

    public int getBackLayer()
                     throws QTException

  Returns the backmost layer of all of the TwoDSprite presenters of the Compositor.
  Returns:
    the backmost layer

### removeMember

    public void removeMember(java.lang.Object member)
                      throws QTException

  Remove a sprite from the Compositor and remove it visually. If the applications have defined control actions to this member these actions should be disabled before the member is removed from the Compositor.
  Overrides:
    `removeMember` in class `SimpleSpace`
  Parameters:
    `member` - the member to remove

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD