Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.poi.hssf.usermodel
Class HSSFPalette

    java.lang.Object
      org.apache.poi.hssf.usermodel.HSSFPalette

    public final 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` | `addColor(byte red, byte green, byte blue)` Adds a new color into an empty color slot.
`HSSFColor` | `findColor(byte red, byte green, byte blue)` Finds the first occurance of a given color
`HSSFColor` | `findSimilarColor(byte red, byte green, byte blue)` Finds the closest matching color in the custom palette.
`HSSFColor` | `findSimilarColor(int red, int green, int blue)` Finds the closest matching color in the custom palette.
`HSSFColor` | `getColor(int index)` Retrieves the color at a given index
`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

### getColor

    public HSSFColor getColor(int 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

### findSimilarColor

    public HSSFColor findSimilarColor(byte red,
                                      byte green,
                                      byte blue)

  Finds the closest matching color in the custom palette. The method for finding the distance between the colors is fairly primative.

  Parameters:
    `red` - The red component of the color to match.
    `green` - The green component of the color to match.
    `blue` - The blue component of the color to match.
  Returns:
    The closest color or null if there are no custom colors currently defined.

### findSimilarColor

    public HSSFColor findSimilarColor(int red,
                                      int green,
                                      int blue)

  Finds the closest matching color in the custom palette. The method for finding the distance between the colors is fairly primative.

  Parameters:
    `red` - The red component of the color to match.
    `green` - The green component of the color to match.
    `blue` - The blue component of the color to match.
  Returns:
    The closest color or null if there are no custom colors currently defined.

### 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

### addColor

    public HSSFColor addColor(byte red,
                              byte green,
                              byte blue)

  Adds a new color into an empty color slot.

  Parameters:
    `red` - The red component
    `green` - The green component
    `blue` - The blue component
  Returns:
    The new custom color.
  Throws:
    `java.lang.RuntimeException` - if there are more more free color indexes.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright 2010 The Apache Software Foundation or its licensors, as applicable.