Class IFFUtil
java.lang.Object
com.twelvemonkeys.imageio.plugins.iff.IFFUtil
IFFUtil
Bit rotate methods based on Sue-Ken Yap, "A Fast 90-Degree Bitmap Rotator," in GRAPHICS GEMS II, James Arvo ed., Academic Press, 1991, ISBN 0-12-064480-0.
- Version:
- $Id: IFFUtil.java,v 1.0 06.mar.2006 13:31:35 haku Exp$
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static void
bitRotateCCW
(byte[] src, int srcPos, int srcStep, byte[] dst, int dstPos, int dstStep) Rotate bits counterclockwise.(package private) static void
bitRotateCCW
(int[] src, int srcPos, int srcStep, byte[] dst, int dstPos, int dstStep) Rotate bits counterclockwise.(package private) static void
bitRotateCW
(byte[] src, int srcPos, int srcStep, byte[] dst, int dstPos, int dstStep) Rotate bits clockwise.private static long[]
rtable
(int n) Creates a rotation table(package private) static String
toChunkStr
(int chunkId) Converts an int to a four letter String.(package private) static int
toInt
(byte[] bytes) Converts a byte array to an int.
-
Field Details
-
RTABLE
private static final long[][] RTABLE
-
-
Constructor Details
-
IFFUtil
IFFUtil()
-
-
Method Details
-
rtable
private static long[] rtable(int n) Creates a rotation table- Parameters:
n
- number of bits -1- Returns:
- the rotation table
-
bitRotateCW
static void bitRotateCW(byte[] src, int srcPos, int srcStep, byte[] dst, int dstPos, int dstStep) Rotate bits clockwise. The IFFImageReader uses this to convert pixel bits from planar to chunky. Bits from the source are rotated 90 degrees clockwise written to the destination.- Parameters:
src
- source pixel datasrcPos
- starting index of 8 x 8 bit source tilesrcStep
- byte offset between adjacent rows in sourcedst
- destination pixel datadstPos
- starting index of 8 x 8 bit destination tiledstStep
- byte offset between adjacent rows in destination
-
bitRotateCCW
static void bitRotateCCW(int[] src, int srcPos, int srcStep, byte[] dst, int dstPos, int dstStep) Rotate bits counterclockwise. The IFFImageWriter uses this to convert pixel bits from chunky to planar.- Parameters:
src
- source pixel data (only lower 8 bits used)srcPos
- starting index of 8 x 8 bit source tilesrcStep
- byte offset between adjacent rows in sourcedst
- destination pixel datadstPos
- starting index of 8 x 8 bit destination tiledstStep
- byte offset between adjacent rows in destination
-
bitRotateCCW
static void bitRotateCCW(byte[] src, int srcPos, int srcStep, byte[] dst, int dstPos, int dstStep) Rotate bits counterclockwise. The IFFImageWriter uses this to convert pixel bits from chunky to planar.- Parameters:
src
- source pixel datasrcPos
- starting index of 8 x 8 bit source tilesrcStep
- byte offset between adjacent rows in sourcedst
- destination pixel datadstPos
- starting index of 8 x 8 bit destination tiledstStep
- byte offset between adjacent rows in destination
-
toInt
static int toInt(byte[] bytes) Converts a byte array to an int.- Parameters:
bytes
- a byte array of length 4- Returns:
- the bytes converted to an int
- Throws:
ArrayIndexOutOfBoundsException
- if length is invalid input: '<' 4
-
toChunkStr
Converts an int to a four letter String.- Parameters:
chunkId
- the chunk identifier- Returns:
- a String
-