public class TGADecoder
extends java.lang.Object
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Modifier and Type | Class and Description |
---|---|
static class |
TGADecoder.LEInputStream
This class implements a DataInputStream reading integer values in
little endian byte order.
|
Constructor and Description |
---|
TGADecoder() |
Modifier and Type | Method and Description |
---|---|
static ImageData |
decode(java.io.InputStream in)
Starts the docuding of an Targa image and returns it as
ImageData . |
static ImageData |
decode(TGADecoder.LEInputStream in)
Starts the docuding of an Targa image and returns it as
ImageData . |
static void |
swapD(byte[] data,
int width,
int bpp)
Swaps the image data horizontally and vertically.
|
static void |
swapH(byte[] data,
int width,
int bpp)
Swaps the image data horizontally.
|
static void |
swapV(byte[] data,
int width)
Swaps the image data vertically.
|
public static ImageData decode(java.io.InputStream in) throws java.io.IOException
ImageData
.in
- The InputStream
to the Targa fileImageData
.java.io.IOException
- If the stream can not be read or the image format
is not supported.public static ImageData decode(TGADecoder.LEInputStream in) throws java.io.IOException
ImageData
.in
- The LEInputStream
to the Targa fileImageData
.java.io.IOException
- If the stream can not be read or the image format
is not supported.public static void swapD(byte[] data, int width, int bpp)
data
- The data to be swapped.width
- The image widthbpp
- the number of bytes per pixelpublic static void swapH(byte[] data, int width, int bpp)
data
- The data to be swapped.width
- The image widthbpp
- the number of bytes per pixelpublic static void swapV(byte[] data, int width)
data
- The data to be swapped.width
- The image widthbpp
- the number of bytes per pixel