本文整理汇总了Java中org.apache.sanselan.formats.tiff.TiffElement类的典型用法代码示例。如果您正苦于以下问题:Java TiffElement类的具体用法?Java TiffElement怎么用?Java TiffElement使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TiffElement类属于org.apache.sanselan.formats.tiff包,在下文中一共展示了TiffElement类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ImageDataOffsets
import org.apache.sanselan.formats.tiff.TiffElement; //导入依赖的package包/类
public ImageDataOffsets(final TiffElement.DataElement imageData[],
final int[] imageDataOffsets,
final TiffOutputField imageDataOffsetsField)
{
this.imageDataOffsets = imageDataOffsets;
this.imageDataOffsetsField = imageDataOffsetsField;
outputItems = new TiffOutputItem[imageData.length];
for (int i = 0; i < imageData.length; i++)
{
TiffOutputItem item = new TiffOutputItem.Value("TIFF image data",
imageData[i].data);
outputItems[i] = item;
}
}
示例2: ImageDataOffsets
import org.apache.sanselan.formats.tiff.TiffElement; //导入依赖的package包/类
public ImageDataOffsets(final TiffElement.DataElement imageData[],
final int[] imageDataOffsets,
final TiffOutputField imageDataOffsetsField)
{
this.imageDataOffsets = imageDataOffsets;
this.imageDataOffsetsField = imageDataOffsetsField;
outputItems = new TiffOutputItem[imageData.length];
for (int i = 0; i < imageData.length; i++)
{
TiffOutputItem item = new TiffOutputItem.Value("TIFF image data",
imageData[i].data);
outputItems[i] = item;
}
}
示例3: dumpElements
import org.apache.sanselan.formats.tiff.TiffElement; //导入依赖的package包/类
private void dumpElements(ByteSource byteSource, List elements)
throws IOException
{
int last = TIFF_HEADER_SIZE;
for (int i = 0; i < elements.size(); i++)
{
TiffElement element = (TiffElement) elements.get(i);
if (element.offset > last)
{
final int SLICE_SIZE = 32;
int gepLength = element.offset - last;
Debug.debug("gap of " + gepLength + " bytes.");
byte bytes[] = byteSource.getBlock(last, gepLength);
if (bytes.length > 2 * SLICE_SIZE)
{
Debug.debug("\t" + "head", BinaryFileFunctions.head(bytes,
SLICE_SIZE));
Debug.debug("\t" + "tail", BinaryFileFunctions.tail(bytes,
SLICE_SIZE));
}
else
Debug.debug("\t" + "bytes", bytes);
}
Debug.debug("element[" + i + "]:" + element.getElementDescription()
+ " (" + element.offset + " + " + element.length + " = "
+ (element.offset + element.length) + ")");
if (element instanceof TiffDirectory)
{
TiffDirectory dir = (TiffDirectory) element;
Debug.debug("\t" + "next Directory Offset: "
+ dir.nextDirectoryOffset);
}
last = element.offset + element.length;
}
Debug.debug();
}
示例4: write
import org.apache.sanselan.formats.tiff.TiffElement; //导入依赖的package包/类
public void write(OutputStream os, TiffOutputSet outputSet)
throws IOException, ImageWriteException
{
List analysis = analyzeOldTiff();
int oldLength = exifBytes.length;
if (analysis.size() < 1)
throw new ImageWriteException("Couldn't analyze old tiff data.");
else if (analysis.size() == 1)
{
TiffElement onlyElement = (TiffElement) analysis.get(0);
// Debug.debug("onlyElement", onlyElement.getElementDescription());
if (onlyElement.offset == TIFF_HEADER_SIZE
&& onlyElement.offset + onlyElement.length
+ TIFF_HEADER_SIZE == oldLength)
{
// no gaps in old data, safe to complete overwrite.
new TiffImageWriterLossy(byteOrder).write(os, outputSet);
return;
}
}
// if (true)
// throw new ImageWriteException("hahah");
// List directories = outputSet.getDirectories();
TiffOutputSummary outputSummary = validateDirectories(outputSet);
List outputItems = outputSet.getOutputItems(outputSummary);
int outputLength = updateOffsetsStep(analysis, outputItems);
// Debug.debug("outputLength", outputLength);
outputSummary.updateOffsets(byteOrder);
writeStep(os, outputSet, analysis, outputItems, outputLength);
}
示例5: dumpElements
import org.apache.sanselan.formats.tiff.TiffElement; //导入依赖的package包/类
private void dumpElements(ByteSource byteSource, List elements)
throws IOException
{
int last = TIFF_HEADER_SIZE;
for (int i = 0; i < elements.size(); i++)
{
TiffElement element = (TiffElement) elements.get(i);
if (element.offset > last)
{
final int SLICE_SIZE = 32;
int gepLength = element.offset - last;
Debug.debug("gap of " + gepLength + " bytes.");
byte bytes[] = byteSource.getBlock(last, gepLength);
if (bytes.length > 2 * SLICE_SIZE)
{
Debug.debug("\t" + "head", BinaryFileFunctions.head(bytes,
SLICE_SIZE));
Debug.debug("\t" + "tail", BinaryFileFunctions.tail(bytes,
SLICE_SIZE));
}
else
Debug.debug("\t" + "bytes", bytes);
}
Debug.debug("element[" + i + "]:" + element.getElementDescription()
+ " (" + element.offset + " + " + element.length + " = "
+ (element.offset + element.length) + ")");
if (element instanceof TiffDirectory)
{
TiffDirectory dir = (TiffDirectory) element;
Debug.debug("\t" + "next Directory Offset: "
+ dir.nextDirectoryOffset);
}
last = element.offset + element.length;
}
Debug.debug();
}
示例6: write
import org.apache.sanselan.formats.tiff.TiffElement; //导入依赖的package包/类
public void write(OutputStream os, TiffOutputSet outputSet)
throws IOException, ImageWriteException
{
List analysis = analyzeOldTiff();
int oldLength = exifBytes.length;
if (analysis.size() < 1)
throw new ImageWriteException("Couldn't analyze old tiff data.");
else if (analysis.size() == 1)
{
TiffElement onlyElement = (TiffElement) analysis.get(0);
// Debug.debug("onlyElement", onlyElement.getElementDescription());
if (onlyElement.offset == TIFF_HEADER_SIZE
&& onlyElement.offset + onlyElement.length
+ TIFF_HEADER_SIZE == oldLength)
{
// no gaps in old data, safe to complete overwrite.
new TiffImageWriterLossy(byteOrder).write(os, outputSet);
return;
}
}
// if (true)
// throw new ImageWriteException("hahah");
// List directories = outputSet.getDirectories();
TiffOutputSummary outputSummary = validateDirectories(outputSet);
List outputItems = outputSet.getOutputItems(outputSummary);
int outputLength = updateOffsetsStep(analysis, outputItems);
// Debug.debug("outputLength", outputLength);
outputSummary.updateOffsets(byteOrder);
writeStep(os, outputSet, analysis, outputItems, outputLength);
}
示例7: compare
import org.apache.sanselan.formats.tiff.TiffElement; //导入依赖的package包/类
public int compare(Object o1, Object o2)
{
TiffElement e1 = (TiffElement) o1;
TiffElement e2 = (TiffElement) o2;
return e1.length - e2.length;
}
示例8: compare
import org.apache.sanselan.formats.tiff.TiffElement; //导入依赖的package包/类
public int compare(Object o1, Object o2)
{
TiffElement e1 = (TiffElement) o1;
TiffElement e2 = (TiffElement) o2;
return e1.length - e2.length;
}