Package com.twelvemonkeys.imageio.path
Class AdobePathReader
- java.lang.Object
-
- com.twelvemonkeys.imageio.path.AdobePathReader
-
public final class AdobePathReader extends java.lang.Object
Reads aShape
object from an Adobe Photoshop Path resource.- See Also:
- Adobe Photoshop Path resource format
-
-
Constructor Summary
Constructors Constructor Description AdobePathReader(byte[] data)
Creates a path reader that will read its data from abyte
array.AdobePathReader(java.io.DataInput data)
Creates a path reader that will read its data from aDataInput
, such as anImageInputStream
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private AdobePathSegment
nextSegment()
private java.awt.geom.Path2D
pathToShape(java.util.List<java.util.List<AdobePathSegment>> paths)
The Correct Order...java.awt.geom.Path2D
readPath()
Builds the path by reading from the supplied input.
-
-
-
Constructor Detail
-
AdobePathReader
public AdobePathReader(java.io.DataInput data)
Creates a path reader that will read its data from aDataInput
, such as anImageInputStream
. The data length is assumed to be a multiple of 26.- Parameters:
data
- the input to read data from.- Throws:
java.lang.IllegalArgumentException
- ifdata
isnull
-
AdobePathReader
public AdobePathReader(byte[] data)
Creates a path reader that will read its data from abyte
array. The array length must be a multiple of 26, and greater than 0.- Parameters:
data
- the array to read data from.- Throws:
java.lang.IllegalArgumentException
- ifdata
isnull
, or not a multiple of 26.
-
-
Method Detail
-
readPath
public java.awt.geom.Path2D readPath() throws java.io.IOException
Builds the path by reading from the supplied input.- Returns:
- the path
- Throws:
javax.imageio.IIOException
- if the input contains a bad path data.java.io.IOException
- if a general I/O exception occurs during reading.
-
pathToShape
private java.awt.geom.Path2D pathToShape(java.util.List<java.util.List<AdobePathSegment>> paths)
The Correct Order... P1, P2, P3, P4, P5, P6 (Closed) moveTo(P1) curveTo(P1.cpl, P2.cpp, P2.ap); curveTo(P2.cpl, P3.cpp, P3.ap); curveTo(P3.cpl, P4.cpp, P4.ap); curveTo(P4.cpl, P5.cpp, P5.ap); curveTo(P5.cpl, P6.cpp, P6.ap); curveTo(P6.cpl, P1.cpp, P1.ap); closePath()
-
nextSegment
private AdobePathSegment nextSegment() throws java.io.IOException
- Throws:
java.io.IOException
-
-