public class ImgWriterPGX extends ImgWriter
The file consists of a one line text header followed by the data.
Header: "PG"+ ws +<endianess>+ ws +[sign]+ws + <bit-depth>+" "+<width>+" "+<height>+'\n'
where:
If the data is unsigned, level shifting is applied adding 2^(bit depth - 1)
NOTE: This class is not thread safe, for reasons of internal buffering.
ImgWriter,
BlkImgDataSrcDEF_STRIP_HEIGHT, h, src, w| Constructor and Description |
|---|
ImgWriterPGX(File out,
BlkImgDataSrc imgSrc,
int c,
boolean isSigned)
Creates a new writer to the specified File object, to write data from
the specified component.
|
ImgWriterPGX(String fname,
BlkImgDataSrc imgSrc,
int c,
boolean isSigned)
Creates a new writer to the specified file, to write data from the
specified component.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the underlying file or netwrok connection to where the data is
written.
|
void |
flush()
Writes all buffered data to the file or resource.
|
String |
toString()
Returns a string of information about the object, more than 1 line
long.
|
void |
write()
Writes the source's current tile to the output.
|
void |
write(int ulx,
int uly,
int w,
int h)
Writes the data of the specified area to the file, coordinates are
relative to the current tile of the source.
|
public ImgWriterPGX(File out, BlkImgDataSrc imgSrc, int c, boolean isSigned) throws IOException
The size of the image that is written to the file is the size of the component from which to get the data, specified by b, not the size of the source image (they differ if there is some sub-sampling).
All the header informations are given by the BlkImgDataSrc source (component width, component height, bit-depth) and sign flag, which are provided to the constructor. The endianness is always big-endian (MSB first).
out - The file where to write the dataimgSrc - The source from where to get the image data to write.c - The index of the component from where to get the data.isSigned - Whether the datas are signed or not (needed only when
writing header).IOExceptionDataBlkpublic ImgWriterPGX(String fname, BlkImgDataSrc imgSrc, int c, boolean isSigned) throws IOException
The size of the image that is written to the file is the size of the component from which to get the data, specified by b, not the size of the source image (they differ if there is some sub-sampling).
All header information is given by the BlkImgDataSrc source (component width, component height, bit-depth) and sign flag, which are provided to the constructor. The endianness is always big-endian (MSB first).
fname - The name of the file where to write the dataimgSrc - The source from where to get the image data to write.c - The index of the component from where to get the data.isSigned - Whether the datas are signed or not (needed only when
writing header).IOExceptionDataBlkpublic void close()
throws IOException
close in class ImgWriterIOException - If an I/O error occurs.public void flush()
throws IOException
flush in class ImgWriterIOException - If an I/O error occurs.public void write(int ulx,
int uly,
int w,
int h)
throws IOException
If the data is unisigned, level shifting is applied adding 2^(bit depth - 1)
This method may not be called concurrently from different threads.
If the data returned from the BlkImgDataSrc source is progressive, then it is requested over and over until it is not progressive anymore.
write in class ImgWriterulx - The horizontal coordinate of the upper-left corner of the
area to write, relative to the current tile.uly - The vertical coordinate of the upper-left corner of the area
to write, relative to the current tile.width - The width of the area to write.height - The height of the area to write.IOException - If an I/O error occurs.public void write()
throws IOException
If the data returned from the BlkImgDataSrc source is progressive, then it is requested over and over until it is not progressive anymore.
write in class ImgWriterIOException - If an I/O error occurs.DataBlkpublic String toString()
Copyright © 2015. All rights reserved.