VNCj

gnu.rfb
Class Hextile

java.lang.Object
  |
  +--gnu.rfb.Rect
        |
        +--gnu.rfb.Hextile
All Implemented Interfaces:
Cloneable

public class Hextile
extends Rect

Hextile Encoding.

The rectangle is divided up into 'tiles' of 16x16 pixels, starting at the top left going in left-to-right, top-to-bottom order. If the width of the rectangle is not an exact multiple of 16 then the width of the last tile in each row will be correspondingly smaller. Similarly if the height is not an exact multiple of 16 then the height of each tile in the final row will also be smaller. Each tile begins with a "subencoding" type byte, which is a mask made up of a number of bits. If the Raw bit is set then the other bits are irrelevant; w*h pixel values follow (where w and h are the width and height of the tile). Otherwise the tile is encoded in a similar way to RRE, except that the position and size of each subrectangle can be specified in just two bytes. The other bits in the mask are as follows:

BackgroundSpecified - if set, a pixel value follows which specifies the background colour for this tile. The first non-raw tile in a rectangle must have this bit set. If this bit isn't set then the background is the same as the last tile.

ForegroundSpecified - if set, a pixel value follows which specifies the foreground colour to be used for all subrectangles in this tile. If this bit is set then the SubrectsColoured bit must be zero.

AnySubrects - if set, a single byte follows giving the number of subrectangles following. If not set, there are no subrectangles (i.e. the whole tile is just solid background colour).

SubrectsColoured - if set then each subrectangle is preceded by a pixel value giving the colour of that subrectangle. If not set, all subrectangles are the same colour, the foreground colour; if the ForegroundSpecified bit wasn't set then the foreground is the same as the last tile.

The position and size of each subrectangle is specified in two bytes.


Nested Class Summary
static class Hextile.SubRect
           
static class Hextile.Tile
           
 
Field Summary
 PixelFormat pixelFormat
           
 Object[] tiles
           
 
Fields inherited from class gnu.rfb.Rect
count, h, w, x, y
 
Constructor Summary
Hextile(int[] pixels, PixelFormat pixelFormat, int offsetX, int offsetY, int scanline, int x, int y, int w, int h)
           
Hextile(int x, int y, int w, int h, PixelFormat pixelFormat, Object[] tiles)
           
 
Method Summary
 Object clone()
           
private  byte[] raw(int[] pixels, int scanline, int x, int y, int w, int h)
           
private  Hextile.Tile tile(int[] pixels, int scanline, int x, int y, int w, int h)
           
 void writeData(DataOutput output)
           
 
Methods inherited from class gnu.rfb.Rect
bestEncoding, copyPixels, encode, encode, encode, getBackground, toString, transform, writePixel
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

pixelFormat

public PixelFormat pixelFormat

tiles

public Object[] tiles
Constructor Detail

Hextile

public Hextile(int[] pixels,
               PixelFormat pixelFormat,
               int offsetX,
               int offsetY,
               int scanline,
               int x,
               int y,
               int w,
               int h)

Hextile

public Hextile(int x,
               int y,
               int w,
               int h,
               PixelFormat pixelFormat,
               Object[] tiles)
Method Detail

writeData

public void writeData(DataOutput output)
               throws IOException
Overrides:
writeData in class Rect
IOException

clone

public Object clone()
             throws CloneNotSupportedException
Overrides:
clone in class Rect
CloneNotSupportedException

tile

private Hextile.Tile tile(int[] pixels,
                          int scanline,
                          int x,
                          int y,
                          int w,
                          int h)

raw

private byte[] raw(int[] pixels,
                   int scanline,
                   int x,
                   int y,
                   int w,
                   int h)

VNCj