Class Paths

    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.awt.image.BufferedImage applyClippingPath​(java.awt.Shape clip, java.awt.image.BufferedImage image)
      Applies the clipping path to the given image.
      static java.awt.image.BufferedImage applyClippingPath​(java.awt.Shape clip, java.awt.image.BufferedImage image, java.awt.image.BufferedImage destination)
      Applies the clipping path to the given image.
      static void main​(java.lang.String[] args)  
      static java.awt.image.BufferedImage readClipped​(javax.imageio.stream.ImageInputStream stream)
      Reads the clipping path from the given input stream, if any, and applies it to the first image in the stream.
      static java.awt.geom.Path2D readPath​(javax.imageio.stream.ImageInputStream stream)
      Reads the clipping path from the given input stream, if any.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • readPath

        public static java.awt.geom.Path2D readPath​(javax.imageio.stream.ImageInputStream stream)
                                             throws java.io.IOException
        Reads the clipping path from the given input stream, if any. Supports PSD, JPEG and TIFF as container formats for Photoshop resources, or a "bare" PSD Image Resource Block.
        Parameters:
        stream - the input stream to read from, not null.
        Returns:
        the path, or null if no path is found
        Throws:
        java.io.IOException - if a general I/O exception occurs during reading.
        javax.imageio.IIOException - if the input contains a bad path data.
        java.lang.IllegalArgumentException - is stream is null.
        See Also:
        AdobePathBuilder
      • applyClippingPath

        public static java.awt.image.BufferedImage applyClippingPath​(java.awt.Shape clip,
                                                                     java.awt.image.BufferedImage image)
        Applies the clipping path to the given image. All pixels outside the path will be transparent.
        Parameters:
        clip - the clipping path, not null
        image - the image to clip, not null
        Returns:
        the clipped image.
        Throws:
        java.lang.IllegalArgumentException - if clip or image is null.
      • applyClippingPath

        public static java.awt.image.BufferedImage applyClippingPath​(java.awt.Shape clip,
                                                                     java.awt.image.BufferedImage image,
                                                                     java.awt.image.BufferedImage destination)
        Applies the clipping path to the given image. Client code may decide the type of the 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.
        Parameters:
        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.
        Returns:
        the clipped image.
        Throws:
        java.lang.IllegalArgumentException - if clip, image or destination is null, or if destination is the same instance as image.
      • readClipped

        public static java.awt.image.BufferedImage readClipped​(javax.imageio.stream.ImageInputStream stream)
                                                        throws java.io.IOException
        Reads the clipping path from the given input stream, if any, and applies it to the first image in the stream. If no path was found, the image is returned without any clipping. Supports PSD, JPEG and TIFF as container formats for Photoshop resources.
        Parameters:
        stream - the stream to read from, not null
        Returns:
        the clipped image
        Throws:
        java.io.IOException - if a general I/O exception occurs during reading.
        javax.imageio.IIOException - if the input contains a bad image or path data.
        java.lang.IllegalArgumentException - is stream is null.
      • main

        public static void main​(java.lang.String[] args)
                         throws java.io.IOException,
                                java.lang.InterruptedException
        Throws:
        java.io.IOException
        java.lang.InterruptedException