org.apache.poi.hssf.usermodel
Class HSSFPalette

java.lang.Object
  |
  +--org.apache.poi.hssf.usermodel.HSSFPalette

public class HSSFPalette
extends java.lang.Object

Represents a workbook color palette. Internally, the XLS format refers to colors using an offset into the palette record. Thus, the first color in the palette has the index 0x8, the second has the index 0x9, etc. through 0x40

Author:
Brian Sanders (bsanders at risklabs dot com)

Constructor Summary
protected HSSFPalette(PaletteRecord palette)
           
 
Method Summary
 HSSFColor findColor(byte red, byte green, byte blue)
          Finds the first occurance of a given color
 HSSFColor getColor(short index)
          Retrieves the color at a given index
 void setColorAtIndex(short index, byte red, byte green, byte blue)
          Sets the color at the given offset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HSSFPalette

protected HSSFPalette(PaletteRecord palette)
Method Detail

getColor

public HSSFColor getColor(short index)
Retrieves the color at a given index

Parameters:
index - the palette index, between 0x8 to 0x40 inclusive
Returns:
the color, or null if the index is not populated

findColor

public HSSFColor findColor(byte red,
                           byte green,
                           byte blue)
Finds the first occurance of a given color

Parameters:
red - the RGB red component, between 0 and 255 inclusive
green - the RGB green component, between 0 and 255 inclusive
blue - the RGB blue component, between 0 and 255 inclusive
Returns:
the color, or null if the color does not exist in this palette

setColorAtIndex

public void setColorAtIndex(short index,
                            byte red,
                            byte green,
                            byte blue)
Sets the color at the given offset

Parameters:
index - the palette index, between 0x8 to 0x40 inclusive
red - the RGB red component, between 0 and 255 inclusive
green - the RGB green component, between 0 and 255 inclusive
blue - the RGB blue component, between 0 and 255 inclusive

jakarta-poi 1.10.0-dev

Copyright © 2003 Apache jakarta-poi project. All Rights Reserved.