Transparency
public class InverseColorMapIndexColorModel extends IndexColorModel
IndexColorModel
, that is backed by an
inverse color-map, for fast look-ups.Modifier and Type | Field | Description |
---|---|---|
protected com.twelvemonkeys.image.InverseColorMap |
inverseMap |
|
protected int |
mapSize |
|
protected int[] |
rgbs |
pixel_bits, transferType
BITMASK, OPAQUE, TRANSLUCENT
Constructor | Description |
---|---|
InverseColorMapIndexColorModel(int pNumBits,
int pSize,
byte[] pReds,
byte[] pGreens,
byte[] pBlues) |
Creates an
InverseColorMapIndexColorModel from the given arrays
of red, green, and blue components. |
InverseColorMapIndexColorModel(int pNumBits,
int pSize,
byte[] pReds,
byte[] pGreens,
byte[] pBlues,
int pTransparentIndex) |
Creates an
InverseColorMapIndexColorModel from the given arrays
of red, green, and blue components, plus one transparent index. |
InverseColorMapIndexColorModel(int pNumBits,
int pSize,
int[] pRGBs,
int pStart,
boolean pAlpha,
int pTransparentIndex,
int pTransferType) |
Creates an
InverseColorMapIndexColorModel from the given array
of RGB components, plus one transparent index. |
InverseColorMapIndexColorModel(IndexColorModel pColorModel) |
Creates an
InverseColorMapIndexColorModel from an existing
IndexColorModel . |
Modifier and Type | Method | Description |
---|---|---|
static IndexColorModel |
create(Image pImage,
int pNumCols,
int pFlags) |
Creates an
IndexColorModel optimized for the given Image . |
Object |
getDataElements(int rgb,
Object pixel) |
Returns a data element array representation of a pixel in this
ColorModel, given an integer pixel representation in the
default RGB color model.
|
String |
toString() |
coerceData, getAlpha, getAlphaRaster, getBlue, getColorSpace, getComponentSize, getDataElement, getDataElements, getGreen, getNormalizedComponents, getNormalizedComponents, getNumColorComponents, getNumComponents, getPixelSize, getRed, getRGB, getRGBdefault, getTransferType, getUnnormalizedComponents, hasAlpha, isAlphaPremultiplied
convertToIntDiscrete, createCompatibleSampleModel, createCompatibleWritableRaster, equals, finalize, getAlpha, getAlphas, getBlue, getBlues, getComponents, getComponents, getComponentSize, getDataElement, getDataElements, getGreen, getGreens, getMapSize, getRed, getReds, getRGB, getRGBs, getTransparency, getTransparentPixel, getValidPixels, hashCode, isCompatibleRaster, isCompatibleSampleModel, isValid, isValid
protected int[] rgbs
protected int mapSize
protected com.twelvemonkeys.image.InverseColorMap inverseMap
public InverseColorMapIndexColorModel(IndexColorModel pColorModel)
InverseColorMapIndexColorModel
from an existing
IndexColorModel
.pColorModel
- the color model to create from.IllegalArgumentException
- if pColorModel
is null
public InverseColorMapIndexColorModel(int pNumBits, int pSize, int[] pRGBs, int pStart, boolean pAlpha, int pTransparentIndex, int pTransferType)
InverseColorMapIndexColorModel
from the given array
of RGB components, plus one transparent index.pNumBits
- the number of bits each pixel occupiespSize
- the size of the color component arrayspRGBs
- the array of packed RGB color componentspStart
- the starting offset of the first color componentpAlpha
- indicates whether alpha values are contained in pRGBs
pTransparentIndex
- the index of the transparent pixelpTransferType
- the data type of the array used to represent pixelsIllegalArgumentException
- if bits is less than 1 or greater than 16,
or if size is less than 1IndexColorModel(int, int, int[], int, boolean, int, int)
public InverseColorMapIndexColorModel(int pNumBits, int pSize, byte[] pReds, byte[] pGreens, byte[] pBlues, int pTransparentIndex)
InverseColorMapIndexColorModel
from the given arrays
of red, green, and blue components, plus one transparent index.pNumBits
- the number of bits each pixel occupiespSize
- the size of the color component arrayspReds
- the array of red color componentspGreens
- the array of green color componentspBlues
- the array of blue color componentspTransparentIndex
- the index of the transparent pixelIllegalArgumentException
- if bits is less than 1 or greater than 16,
or if size is less than 1IndexColorModel(int, int, byte[], byte[], byte[], int)
public InverseColorMapIndexColorModel(int pNumBits, int pSize, byte[] pReds, byte[] pGreens, byte[] pBlues)
InverseColorMapIndexColorModel
from the given arrays
of red, green, and blue components.pNumBits
- the number of bits each pixel occupiespSize
- the size of the color component arrayspReds
- the array of red color componentspGreens
- the array of green color componentspBlues
- the array of blue color componentsIllegalArgumentException
- if bits is less than 1 or greater than 16,
or if size is less than 1IndexColorModel(int, int, byte[], byte[], byte[])
public static IndexColorModel create(Image pImage, int pNumCols, int pFlags)
IndexColorModel
optimized for the given Image
.pImage
- the Image
containing the RGB samplespNumCols
- the maximum number of colors in the IndexColorModel
pFlags
- flagsIndexColorModel
public Object getDataElements(int rgb, Object pixel)
setDataElements
method of a WritableRaster
object. If the pixel variable is
null
, a new array is allocated. If pixel
is not null
, it must be
a primitive array of type transferType
; otherwise, a
ClassCastException
is thrown. An
ArrayIndexOutOfBoundsException
is
thrown if pixel
is not large enough to hold a pixel
value for this ColorModel
. The pixel array is returned.
Since OpaqueIndexColorModel
can be subclassed, subclasses
inherit the implementation of this method and if they don't
override it then they throw an exception if they use an
unsupported transferType
.
#param rgb the integer pixel representation in the default RGB
color model
#param pixel the specified pixel
#return an array representation of the specified pixel in this
OpaqueIndexColorModel
.
#throws ClassCastException if pixel
is not a primitive array of type transferType
#throws ArrayIndexOutOfBoundsException if
pixel
is not large enough to hold a pixel value
for this ColorModel
#throws UnsupportedOperationException if transferType
is invalid
public String toString()
toString
in class IndexColorModel
Copyright © 2018. All rights reserved.