rebuild.graphics.tiff.tags
Class BitsPerSampleTag

java.lang.Object
  extended by rebuild.graphics.tiff.Tag
      extended by rebuild.graphics.tiff.tags.ShortTag
          extended by rebuild.graphics.tiff.tags.BitsPerSampleTag

public final class BitsPerSampleTag
extends ShortTag

The number of bits per component in the image.

Since:
BBX 1.0.1

Field Summary
 
Fields inherited from class rebuild.graphics.tiff.Tag
count, data, dataType, value
 
Constructor Summary
BitsPerSampleTag()
          Create a new BitsPerSample tag.
BitsPerSampleTag(int numberOfSamples)
          Create a new BitsPerSample tag.
BitsPerSampleTag(int numberOfSamples, short value)
          Create a new BitsPerSample tag.
BitsPerSampleTag(short[] samples)
          Create a new BitsPerSample tag.
 
Method Summary
 short getSample(int index)
          Get the sample value at the specified index.
static short getTagTypeValue()
          Get the Tag's type.
 boolean hasDefault()
          Get if this Tag can have a default value, often defined by a parameter-less constructor.
 boolean isDefault()
          Get if this Tag's current value is the default value.
 void setCount(int numberOfSamples)
          Set the number of samples that the BitsPerSample tag has.
 void setSample(int index, short value)
          Set the sample value at the specified index.
 void setValue(int bitCount)
          Set the bit count for all the samples.
 
Methods inherited from class rebuild.graphics.tiff.tags.ShortTag
extraData, getShort, setDataType, setExtraData, setShort, setupForBigTIFF, writeData
 
Methods inherited from class rebuild.graphics.tiff.Tag
equals, getBigCount, getBigValue, getCount, getDataType, getExtraData, getIfExtraDataExists, getTagType, getValue, hashCode, setCount, setValue, toString, write, write, write, write, writeBig
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BitsPerSampleTag

public BitsPerSampleTag()
Create a new BitsPerSample tag.


BitsPerSampleTag

public BitsPerSampleTag(int numberOfSamples)
Create a new BitsPerSample tag.

Parameters:
numberOfSamples - The number of samples that the image has. Each sample will be set to 8 for 8 bits per sample.

BitsPerSampleTag

public BitsPerSampleTag(int numberOfSamples,
                        short value)
Create a new BitsPerSample tag.

Parameters:
numberOfSamples - The number of samples that the image has.
value - The value of all the samples. If this is less than 1 bit it could make the image unreaable or cause errors.

BitsPerSampleTag

public BitsPerSampleTag(short[] samples)
Create a new BitsPerSample tag.

Parameters:
samples - The value of each sample.
Method Detail

getTagTypeValue

public static short getTagTypeValue()
Get the Tag's type.

Returns:
The Tag's type.

setValue

public void setValue(int bitCount)
Set the bit count for all the samples.

Overrides:
setValue in class Tag
Parameters:
bitCount - The number of bits in each sample.
See Also:
getValue

setSample

public void setSample(int index,
                      short value)
Set the sample value at the specified index.

Parameters:
index - The index of the sample.
value - The value to set at the specified index.

getSample

public short getSample(int index)
Get the sample value at the specified index.

Parameters:
index - The index of the sample.
Returns:
Return the value at the specified index.

setCount

public void setCount(int numberOfSamples)
Set the number of samples that the BitsPerSample tag has.

Overrides:
setCount in class ShortTag
Parameters:
numberOfSamples - The number of samples; Usually 1 for bilevel, grayscale, and palette-color images, 3 for RGB. The value is based off of SamplesPerPixel.
See Also:
getCount

hasDefault

public boolean hasDefault()
Get if this Tag can have a default value, often defined by a parameter-less constructor.

Overrides:
hasDefault in class ShortTag
Returns:
true if the Tag has a default value, false if otherwise. Default is false.

isDefault

public boolean isDefault()
Get if this Tag's current value is the default value. This is ignored if Tag#hasDefault() returns false.

Overrides:
isDefault in class ShortTag
Returns:
true if the Tag's value is the default value, false if otherwise.