mxPngEncodeParam.Palette (JGraph X 2.1.0.7 API Specification)
Date: 2013-07-31

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

## com.mxgraph.util.png
Class mxPngEncodeParam.Palette

    java.lang.Object
      com.mxgraph.util.png.mxPngEncodeParam
          com.mxgraph.util.png.mxPngEncodeParam.Palette

Enclosing class:
  mxPngEncodeParam

    public static class mxPngEncodeParam.Palette

extends mxPngEncodeParam

Nested Class Summary

Nested classes/interfaces inherited from class com.mxgraph.util.png.mxPngEncodeParam
`mxPngEncodeParam.Gray, mxPngEncodeParam.Palette, mxPngEncodeParam.RGB`

Field Summary

Fields inherited from class com.mxgraph.util.png.mxPngEncodeParam
`bitDepth, bitDepthSet, INTENT_ABSOLUTE, INTENT_PERCEPTUAL, INTENT_RELATIVE, INTENT_SATURATION, PNG_FILTER_AVERAGE, PNG_FILTER_NONE, PNG_FILTER_PAETH, PNG_FILTER_SUB, PNG_FILTER_UP`

Constructor Summary
`mxPngEncodeParam.Palette()` Constructs an instance of `PNGEncodeParam.Palette`.

Method Summary
`int` | `getBackgroundPaletteIndex()` Returns the palette index of the suggested background color.
`int[]` | `getPalette()` Returns the current RGB palette.
`byte[]` | `getPaletteTransparency()` Returns the alpha values associated with each palette entry.
`boolean` | `isBackgroundSet()` Returns true if a 'bKGD' chunk will be output.
`boolean` | `isPaletteSet()` Returns true if a 'PLTE' chunk will be output.
`void` | `setBackgroundPaletteIndex(int index)` Sets the palette index of the suggested background color.
`void` | `setBitDepth(int bitDepth)` Sets the desired bit depth for a palette image.
`void` | `setPalette(int[] rgb)` Sets the RGB palette of the image to be encoded.
`void` | `setPaletteTransparency(byte[] alpha)` Sets the alpha values associated with each palette entry.
`void` | `unsetBackground()` Suppresses the 'bKGD' chunk from being output.
`void` | `unsetPalette()` Suppresses the 'PLTE' chunk from being output.

Methods inherited from class com.mxgraph.util.png.mxPngEncodeParam
`addPrivateChunk, filterRow, getBitDepth, getChromaticity, getCompressedText, getDefaultEncodeParam, getGamma, getICCProfileData, getInterlacing, getModificationTime, getNumPrivateChunks, getPaletteHistogram, getPhysicalDimension, getPrivateChunkData, getPrivateChunkType, getSignificantBits, getSRGBIntent, getText, isChromaticitySet, isCompressedTextSet, isGammaSet, isICCProfileDataSet, isModificationTimeSet, isPaletteHistogramSet, isPhysicalDimensionSet, isSignificantBitsSet, isSRGBIntentSet, isSuggestedPaletteSet, isTextSet, isTransparencySet, paethPredictor, removeAllPrivateChunks, removeUnsafeToCopyPrivateChunks, setChromaticity, setChromaticity, setCompressedText, setGamma, setICCProfileData, setInterlacing, setModificationTime, setPaletteHistogram, setPhysicalDimension, setPhysicalDimension, setSignificantBits, setSRGBIntent, setSuggestedPalette, setText, unsetBitDepth, unsetChromaticity, unsetCompressedText, unsetGamma, unsetICCProfileData, unsetModificationTime, unsetPaletteHistogram, unsetPhysicalDimension, unsetSignificantBits, unsetSRGBIntent, unsetSuggestedPalette, unsetText, unsetTransparency`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### mxPngEncodeParam.Palette

    public mxPngEncodeParam.Palette()

  Constructs an instance of `PNGEncodeParam.Palette`.

Method Detail

### unsetBackground

    public void unsetBackground()

  Suppresses the 'bKGD' chunk from being output.

  Overrides:
    `unsetBackground` in class `mxPngEncodeParam`

### isBackgroundSet

    public boolean isBackgroundSet()

  Returns true if a 'bKGD' chunk will be output.

  Overrides:
    `isBackgroundSet` in class `mxPngEncodeParam`

### setBitDepth

    public void setBitDepth(int bitDepth)

  Sets the desired bit depth for a palette image. The bit depth must be one of 1, 2, 4, or 8, or else an `IllegalArgumentException` will be thrown.

  Specified by:
    `setBitDepth` in class `mxPngEncodeParam`

### setPalette

    public void setPalette(int[] rgb)

  Sets the RGB palette of the image to be encoded. The `rgb` parameter contains alternating R, G, B values for each color index used in the image. The number of elements must be a multiple of 3 between 3 and 3*256.

  The 'PLTE' chunk will encode this information.

  Parameters:
    `rgb` - An array of `int`s.

### getPalette

    public int[] getPalette()

  Returns the current RGB palette.

  If the palette has not previously been set, or has been unset, an `IllegalStateException` will be thrown.

  Returns:
    An array of `int`s.
  Throws:
    `IllegalStateException` - if the palette is not set.

### unsetPalette

    public void unsetPalette()

  Suppresses the 'PLTE' chunk from being output.

### isPaletteSet

    public boolean isPaletteSet()

  Returns true if a 'PLTE' chunk will be output.

### setBackgroundPaletteIndex

    public void setBackgroundPaletteIndex(int index)

  Sets the palette index of the suggested background color.

  The 'bKGD' chunk will encode this information.

### getBackgroundPaletteIndex

    public int getBackgroundPaletteIndex()

  Returns the palette index of the suggested background color.

  If the background palette index has not previously been set, or has been unset, an `IllegalStateException` will be thrown.

  Throws:
    `IllegalStateException` - if the palette index is not set.

### setPaletteTransparency

    public void setPaletteTransparency(byte[] alpha)

  Sets the alpha values associated with each palette entry. The `alpha` parameter should have as many entries as there are RGB triples in the palette.

  The 'tRNS' chunk will encode this information.

### getPaletteTransparency

    public byte[] getPaletteTransparency()

  Returns the alpha values associated with each palette entry.

  If the palette transparency has not previously been set, or has been unset, an `IllegalStateException` will be thrown.

  Throws:
    `IllegalStateException` - if the palette transparency is not set.

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

Copyright (c) 2010 Gaudenz Alder. All rights reserved.