com.flagstone.transform.video
Class ImageBlock

java.lang.Object
  extended by com.flagstone.transform.video.ImageBlock
All Implemented Interfaces:
Copyable<ImageBlock>

public final class ImageBlock
extends Object
implements Copyable<ImageBlock>

ImageBlock is used to sub-divide an image into a set of blocks so they can be streamed using Screen Video. Image blocks are compared so only pixel information for the portions of the image that change are sent.

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.

See Also:
DefineVideo

Constructor Summary
ImageBlock(ImageBlock object)
          Creates and initialises a ImageBlock object using the values copied from another ImageBlock object.
ImageBlock(int blockWidth, int blockHeight, byte[] pixels)
          Create a new image block with the specified width and height and image data.
 
Method Summary
 ImageBlock copy()
          Creates a complete copy of this object.
 byte[] getBlock()
          Get the zipped image data for the block.
 int getHeight()
          Get the height of the block.
 int getWidth()
          Get 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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImageBlock

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

Parameters:
blockWidth - the width of the block in pixels.
blockHeight - the height of the block in pixels
pixels - the pixels covered by the block, compressed using the zip format.

ImageBlock

public ImageBlock(ImageBlock object)
Creates and initialises a ImageBlock object using the values copied from another ImageBlock object.

Parameters:
object - a ImageBlock object from which the values will be copied.
Method Detail

getWidth

public int getWidth()
Get the width of the block. although the block size is specified in parent ScreenVideoPacket 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.

getHeight

public int getHeight()
Get the height of the block. although the block size is specified in parent ScreenVideoPacket 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.

getBlock

public byte[] getBlock()
Get the zipped image data for the block.

Returns:
a copy of the block data.

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.

copy

public ImageBlock copy()
Creates a complete copy of this object.

Specified by:
copy in interface Copyable<ImageBlock>
Returns:
a deep-copy of this object. New instances of mutable objects are copied and immutable instances are shared.


Copyright © 2002-2010 Flagstone Software Ltd.. All Rights Reserved.