public final class Paths extends Object
readPath(javax.imageio.stream.ImageInputStream)
BufferedImage
applyClippingPath(java.awt.Shape, java.awt.image.BufferedImage)
readClipped(javax.imageio.stream.ImageInputStream)
AdobePathBuilder
Modifier and Type | Method and Description |
---|---|
static BufferedImage |
applyClippingPath(Shape clip,
BufferedImage image)
Applies the clipping path to the given image.
|
static BufferedImage |
applyClippingPath(Shape clip,
BufferedImage image,
BufferedImage destination)
Applies the clipping path to the given image.
|
static void |
main(String[] args) |
static BufferedImage |
readClipped(ImageInputStream stream)
Reads the clipping path from the given input stream, if any,
and applies it to the first image in the stream.
|
static Path2D |
readPath(ImageInputStream stream)
Reads the clipping path from the given input stream, if any.
|
public static Path2D readPath(ImageInputStream stream) throws IOException
stream
- the input stream to read from, not null
.null
if no path is foundIOException
- if a general I/O exception occurs during reading.IIOException
- if the input contains a bad path data.IllegalArgumentException
- is stream
is null
.AdobePathBuilder
public static BufferedImage applyClippingPath(Shape clip, BufferedImage image)
clip
- the clipping path, not null
image
- the image to clip, not null
IllegalArgumentException
- if clip
or image
is null
.public static BufferedImage applyClippingPath(Shape clip, BufferedImage image, BufferedImage destination)
destination
image.
The destination
image is assumed to be fully transparent,
and have same dimensions as image
.
All pixels outside the path will be transparent.clip
- the clipping path, not null
.image
- the image to clip, not null
.destination
- the destination image, may not be null
or same instance as image
.IllegalArgumentException
- if clip
, image
or destination
is null
,
or if destination
is the same instance as image
.public static BufferedImage readClipped(ImageInputStream stream) throws IOException
stream
- the stream to read from, not null
IOException
- if a general I/O exception occurs during reading.IIOException
- if the input contains a bad image or path data.IllegalArgumentException
- is stream
is null
.public static void main(String[] args) throws IOException, InterruptedException
IOException
InterruptedException
Copyright © 2017. All rights reserved.