hotline.iconlib
Class HLIconData

java.lang.Object
  |
  +--hotline.iconlib.HLIconData

public class HLIconData
extends java.lang.Object

data structure where all the important icon information data is stored

See Also:
developer site

Constructor Summary
HLIconData()
           
 
Method Summary
 boolean add(byte red, byte green, byte blue)
          add a new RGB entry to the dat-field
 boolean add(hotline.iconlib.HLRGB h)
          add a new RGB value of a HLRGB object to the data-field
 boolean add(int RGB)
          add a new RGB entry to the data-field
 hotline.iconlib.HLRGB get(int index)
          get the desired HLRGB object
 int getARGB(int index)
          get the desired RGB as an integer, including the alpha channel
 int[] getARGBField()
          get RGB data including the alpha channel, whereas the color-byte-order is: Alpha|Red|Green|Blue
 byte getBlue(int index)
          returns the blue component of the RGB entry specified by index
 int[] getData()
          get access to the int[] data field
 byte getGreen(int index)
          returns the green component of the RGB entry specified by index
 int getHeight()
          returns the icon height in pixel
 byte[][] getPalette()
          get access to the palette as a two dimensional field, where the first dimension is the entry number and the second dimension has red, green and blue at indices 0, 1, 2
this example extracts the red value from the 16th palette color: ...
 int getPalLengthBytes()
          returns the palette length in bytes, note: In order to receive the number of palette entries you need to divide this value by 4 (four) since they are aligned to 4-byte-boundaries, or you can simply use the getPalLengthLW() method
 int getPalLengthLW()
          returns the palette length in longwords, identical to the number of palette entries
 byte[] getRawData()
          get access to raw data: all pixels are stored as 1 byte entries, their values indicate their palette color entry
 byte getRed(int index)
          returns the red component of the RGB entry specified by index
 int getRGB(int index)
          get the desired RGB as an integer
 int[] getRGBField()
          get RGB data , whereas the color-byte-order is: *|Red|Green|Blue
 int getTransparency()
          Returns the color used for transparency as RGB in big endian format.
 int getWidth()
          returns the icon width in pixel
 int getWidthInBytes()
          returns the icon width in bytes
 void malloc(int size)
          allocate the memory necessary for the HLRGB objects
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HLIconData

public HLIconData()
Method Detail

malloc

public void malloc(int size)
allocate the memory necessary for the HLRGB objects

Parameters:
size - number of HLRGB units for which the memory should be allocated

add

public boolean add(hotline.iconlib.HLRGB h)
add a new RGB value of a HLRGB object to the data-field

Parameters:
h - HLRGB object to be added
Returns:
true when everything went alright, false otherwise
See Also:
HLRGB

add

public boolean add(int RGB)
add a new RGB entry to the data-field

Parameters:
RGB - int with red in bits 23-16, green 15-8, blue 7-0
Returns:
true when everything went alright, false otherwise

add

public boolean add(byte red,
                   byte green,
                   byte blue)
add a new RGB entry to the dat-field

Returns:
true when everything went alright, false otherwise

get

public hotline.iconlib.HLRGB get(int index)
get the desired HLRGB object

Parameters:
index - index of the HLRGB object in the dat-field, starting at index 0
Returns:
HLRGB object, null if failure

getRGB

public int getRGB(int index)
get the desired RGB as an integer

Parameters:
index - index of the RGB value in the data-field, starting at index 0
Returns:
RGB value, -1 if an error occured

getARGB

public int getARGB(int index)
get the desired RGB as an integer, including the alpha channel

Parameters:
index - index of the RGB value in the data-field, starting at index 0
Returns:
AlphaRGB value

getARGBField

public int[] getARGBField()
get RGB data including the alpha channel, whereas the color-byte-order is: Alpha|Red|Green|Blue

Returns:
ARGB data in an int[] field, null if there was an error

getRGBField

public int[] getRGBField()
get RGB data , whereas the color-byte-order is: *|Red|Green|Blue

Returns:
RGB data in an int[] field, null if there was an error

getWidth

public int getWidth()
returns the icon width in pixel

Returns:
width in pixel

getHeight

public int getHeight()
returns the icon height in pixel

Returns:
height in pixel

getWidthInBytes

public int getWidthInBytes()
returns the icon width in bytes

Returns:
width in bytes

getPalLengthBytes

public int getPalLengthBytes()
returns the palette length in bytes, note: In order to receive the number of palette entries you need to divide this value by 4 (four) since they are aligned to 4-byte-boundaries, or you can simply use the getPalLengthLW() method

Returns:
palette length in bytes

getPalLengthLW

public int getPalLengthLW()
returns the palette length in longwords, identical to the number of palette entries

Returns:
palette length in longwords

getTransparency

public int getTransparency()
Returns the color used for transparency as RGB in big endian format. You should use this function and not access transparency directly since values are stored shifted 8 bits by the hotline app

Returns:
transparency color as RGB in big endian format

getPalette

public byte[][] getPalette()
get access to the palette as a two dimensional field, where the first dimension is the entry number and the second dimension has red, green and blue at indices 0, 1, 2
this example extracts the red value from the 16th palette color:
                      ...
                      HLIconData hlid = new HLIconData();
                     ...
                     byte     red = hlid.getPalette()[15][0];
                     ...
          

Returns:
RGB palette

getRed

public byte getRed(int index)
returns the red component of the RGB entry specified by index

Parameters:
index - index in the data-field, starting at 0
Returns:
red component, -1 on error

getGreen

public byte getGreen(int index)
returns the green component of the RGB entry specified by index

Parameters:
index - index in the data-field, starting at 0
Returns:
green component, -1 on error

getBlue

public byte getBlue(int index)
returns the blue component of the RGB entry specified by index

Parameters:
index - index in the data-field, starting at 0
Returns:
blue component, -1 on error

getRawData

public byte[] getRawData()
get access to raw data: all pixels are stored as 1 byte entries, their values indicate their palette color entry

Returns:
raw data

getData

public int[] getData()
get access to the int[] data field

Returns:
data-field