gnu.rfb
Class Hextile
java.lang.Object
gnu.rfb.Rect
gnu.rfb.Hextile
- All Implemented Interfaces:
- java.lang.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.
Constructor Summary |
Hextile(int[] pixels,
PixelFormat pixelFormat,
int offsetX,
int offsetY,
int scanline,
int x,
int y,
int w,
int h)
Constructor for encoding an image into Hextile. |
Hextile(int x,
int y,
int w,
int h,
PixelFormat pixelFormat,
java.io.DataInput input)
|
Hextile(int x,
int y,
int w,
int h,
PixelFormat pixelFormat,
java.lang.Object[] tiles)
Constructor for encoding image tiles into Hextile. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
pixelFormat
public PixelFormat pixelFormat
tiles
public java.lang.Object[] tiles
Hextile
public Hextile(int[] pixels,
PixelFormat pixelFormat,
int offsetX,
int offsetY,
int scanline,
int x,
int y,
int w,
int h)
- Constructor for encoding an image into Hextile.
- Parameters:
pixels
- The image as an array of pixels.pixelFormat
- The current pixel format of the image.offsetX
- The offset in the X direction of the image.offsetY
- The offset in the Y direction of the image.scanline
- The width of a single scan line.x
- The X coordinate of the image.y
- The Y coordinate of the image.w
- The width of the image.h
- The height of the image.
The vector is not parameterized because the contents of each element is
not certain.
Hextile
public Hextile(int x,
int y,
int w,
int h,
PixelFormat pixelFormat,
java.lang.Object[] tiles)
- Constructor for encoding image tiles into Hextile.
- Parameters:
x
- The X coordinate of the image.y
- The Y coordinate of the image.w
- The width of the image.h
- The height of the image.pixelFormat
- The current pixel format of the image.tiles
- The tiles to encode into Hextile.
Hextile
public Hextile(int x,
int y,
int w,
int h,
PixelFormat pixelFormat,
java.io.DataInput input)
decode
public int[] decode()
throws java.io.IOException
- Throws:
java.io.IOException
writeData
public void writeData(java.io.DataOutput output)
throws java.io.IOException
- Overrides:
writeData
in class Rect
- Throws:
java.io.IOException
clone
public java.lang.Object clone()
throws java.lang.CloneNotSupportedException
- Overrides:
clone
in class Rect
- Throws:
java.lang.CloneNotSupportedException