public class ImgWriterPPM extends ImgWriter
The size of the image that is written is the size of the source image. No component subsampling is allowed in any of the components that are written to the file.
Before writing, all coefficients are inversly level-shifted and then
"saturated" (they are limited * to the nominal dynamic range).
Ex: if the nominal range is 0-255, the following algorithm is
applied:
if coeff<0, output=0
if coeff>255, output=255
else output=coeff
The write() methods of an object of this class may not be called
concurrently from different threads.
NOTE: This class is not thread safe, for reasons of internal buffering.
DEF_STRIP_HEIGHT, h, src, w| Constructor and Description |
|---|
ImgWriterPPM(File out,
BlkImgDataSrc imgSrc,
int n1,
int n2,
int n3)
Creates a new writer to the specified File object, to write data from
the specified component.
|
ImgWriterPPM(String fname,
BlkImgDataSrc imgSrc,
int n1,
int n2,
int n3)
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 ImgWriterPPM(File out, BlkImgDataSrc imgSrc, int n1, int n2, int n3) throws IOException
The three components that will be written as R, G and B must be specified through the b1, b2 and b3 arguments.
out - The file where to write the dataimgSrc - The source from where to get the image data to write.n1 - The index of the first component from where to get the data,
that will be written as the red channel.n2 - The index of the second component from where to get the data,
that will be written as the green channel.n3 - The index of the third component from where to get the data,
that will be written as the green channel.IOExceptionDataBlkpublic ImgWriterPPM(String fname, BlkImgDataSrc imgSrc, int n1, int n2, int n3) throws IOException
The three components that will be written as R, G and B must be specified through the b1, b2 and b3 arguments.
fname - The name of the file where to write the dataimgSrc - The source from where to get the image data to write.n1 - The index of the first component from where to get the data,
that will be written as the red channel.n2 - The index of the second component from where to get the data,
that will be written as the green channel.n3 - The index of the third component from where to get the data,
that will be written as the green channel.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
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 any more.
write in class ImgWriterIOException - If an I/O error occurs.DataBlkpublic String toString()
Copyright © 2015. All rights reserved.