com.flagstone.transform
Class FSImageBlock

java.lang.Object
  extended by com.flagstone.transform.FSImageBlock
All Implemented Interfaces:
java.lang.Cloneable

public class FSImageBlock
extends java.lang.Object
implements java.lang.Cloneable

When an image is sent in a ScreenVideo stream only pixel information for the portions of the image that change are sent. FSImageBlock is used to sub-divide an image into a set of blocks. The blocks from successive frames can then be compared to determine which blocks are encoded in the stream. An image is divided by tiling the blocks across the image from top-left to bottom right. If the image is not covered an integer number of blocks then the size of the blocks along the right and bottom edges of the image are reduced in size. The FSImageBlock is a contains class for the image data and is used in conjunction with the FsStreamVideoPacket class.


Constructor Summary
FSImageBlock(int width, int height, byte[] data)
          Create a new image block with the specified width and height and image data.
 
Method Summary
 java.lang.Object clone()
           
 boolean equals(java.lang.Object anObject)
           
 byte[] getData()
          Returns the zipped image data for the block.
 int getHeight()
          Return the height of the block.
 int getWidth()
          Return the width of the block.
 boolean isEmpty()
          When a ScreenVideo stream is created only the image blocks that change are included.
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FSImageBlock

public FSImageBlock(int width,
                    int height,
                    byte[] data)
Create a new image block with the specified width and height and image data. The image is compressed using the zip format.

Parameters:
width - the width of the block in pixels.
height - the height of the block in pixels
data - the pixels covered by the block, compressed using the zip format.
Method Detail

getWidth

public int getWidth()
Return the width of the block. although the block size is specified in parent FSScreenVideoPacket object the actual block size used may vary if the tiled array of blocks overlaps the edge of the image.

Returns:
the width of the block in pixels.

getHeight

public int getHeight()
Return the height of the block. although the block size is specified in parent FSScreenVideoPacket object the actual block size used may vary if the tiled array of blocks overlaps the edge of the image.

Returns:
the height of the block in pixels.

getData

public byte[] getData()
Returns the zipped image data for the block.

Returns:
an array of bytes containing the portion of the image in the block.

isEmpty

public boolean isEmpty()
When a ScreenVideo stream is created only the image blocks that change are included. The blocks that do not change are encoded as empty blocks which have width and height of zero and do not contain any image data. This convenience method is used to determine when an image block contains any valid image data.

Returns:
true if the block covers an area of the image that changed or false if no image data is included.

clone

public java.lang.Object clone()
Overrides:
clone in class java.lang.Object

equals

public boolean equals(java.lang.Object anObject)
Overrides:
equals in class java.lang.Object